dhiru Posted September 27, 2017 Share Posted September 27, 2017 Hi, I have created labels that shows my objects on the top of the screen; however unfortunately the objects use brickProceduralTexture which take brick color as Babylon.Color3 woodTexture.brickColor = new BABYLON.Color3(rColor / 255, gColor / 255, bColor / 255); however I want to match that with the background color of my BABYLON.GUI.Rectangle; which takes the background as a Color; to avoid confusion I wanted to match the colors. var label = new BABYLON.GUI.Rectangle("label for scorecard"); label.background = "black"; I am sure there is something simple I am missing -- I tried reading the documentation and also passing different colors but could not get it to work. Please advise. Quote Link to comment Share on other sites More sharing options...
brianzinn Posted September 27, 2017 Share Posted September 27, 2017 There is a static method on Color3 for 0-255 numbers. ie: Color3.FromInts(255, 255, 102) To answer your question, for background you can use HEX representation. ie: label.background = "#FFAF00"; for orange. So, 255 to 'FF' is just Number(255).toString(16) in javascript (16 is the base). Then just concatenate the 3 together `#${redHex}${greenHex}${blueHex}`, if you use string interpolation. Maybe there is something easier built-in to do that already, but I'm not aware of anything. Quote Link to comment Share on other sites More sharing options...
dhiru Posted October 3, 2017 Author Share Posted October 3, 2017 Many thanks! -- I will try and let you know if I can find something simpler! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.