Get Panel Attributes - Colours
-
I cant seem to get the colour attributes to work in script with a panel. Im trying to set the panels colours by using panel.get("bgColour"); but it returns this number....


but then when I pasted that number from the console into here to show u guys it shows up as this whole object...weird.
{ "alignment": "left", "fontStyle": "plain", "fontSize": 16.0, "fontName": "Source Code Pro", "textColour": "3253075780", "itemColour2": 4212199697, "itemColour": 0, "bgColour": 0, "width": 140.0, "height": 30.0 }How do I get the panel colours?
-
@Chazrox that is the color, as a decimal rather than hex.
-
@David-Healey How do I convert that to a HEX? and why did it produce that object when I pasted that decimal number in the chat?
-
@Chazrox It's possible that you didn't actually copy the decimal value and it pasted whatever else was on your clipboard.
If you use a clipboard manager, call it up and see what's actually in your clipboard history.
-
@Chazrox said in Get Panel Attributes - Colours:
How do I convert that to a HEX?
Engine.intToHexString()but you should be able to use the integer representation directly in your paint routines I think. -
@dannytaurus quite possible!
-
@David-Healey Yup that worked. Thanks!
Works.
var ColourNOW = 3758365736; Console.print(Engine.intToHexString(ColourNOW)); panelColourTesting.set("itemColour", ColourNOW); -
In the end, a number is a number. The format (base) is just a chosen representation of the same number, be it decimal, hexadecimal, binary, octal or whatever fancy base-factorial one can invent

-
@ustk great insight! Very true. I guess I could have just tried the decimal point first but I automatically thought it would be wrong. I just tried it and it does work both ways. Thanks!
-
C Chazrox marked this topic as a question
-
C Chazrox has marked this topic as solved