Could someone explain to me the color strategy in Delphi? It seems very unusual compared to everything else I've worked in. I don't understand the numeric designations. I know I can say this:
var myColor: TColor;
myColor := rgb(158,54,210)
or
myColor := clYellow;
I get all that.
But I wanted to set up some color constants and it for obvious reasons can't use the rgb function. It has to be like this:
const myColor := $651541;
It's clearly not a hex color. I tried that. I used all sorts of converters online and on my system to convert an rgb code to some sort of numeric value I could use but it never came out right.
I even tried this to figure out the code:
var x: TColor;
x := TColor(rgb(158,54,210))
and then put a break point on x so I could see what it was. That didn't work either. What I expected to be beige turned out to be some sort of blue.
How do I convert something like rgb(158,54,210) to a $ color code that I can use in code? This is very annoying sometimes. Like I said, I've used all sorts of other systems and this seems quite different and I'm not finding anything useful online to help me understand this even in the Embarcadero Delphi documentation pages.
And when I go into a color setting in the properties window of a control and try using what's supposed to be hex according to Delphi documentation, that doesn't work right either. None of this really makes any sense. I ended up bailing on my constants and just used variables that I set to rgb colors in the startup routine of my application but I'd really like to know how this is supposed to work.
Thanks,
Keith
var myColor: TColor;
myColor := rgb(158,54,210)
or
myColor := clYellow;
I get all that.
But I wanted to set up some color constants and it for obvious reasons can't use the rgb function. It has to be like this:
const myColor := $651541;
It's clearly not a hex color. I tried that. I used all sorts of converters online and on my system to convert an rgb code to some sort of numeric value I could use but it never came out right.
I even tried this to figure out the code:
var x: TColor;
x := TColor(rgb(158,54,210))
and then put a break point on x so I could see what it was. That didn't work either. What I expected to be beige turned out to be some sort of blue.
How do I convert something like rgb(158,54,210) to a $ color code that I can use in code? This is very annoying sometimes. Like I said, I've used all sorts of other systems and this seems quite different and I'm not finding anything useful online to help me understand this even in the Embarcadero Delphi documentation pages.
And when I go into a color setting in the properties window of a control and try using what's supposed to be hex according to Delphi documentation, that doesn't work right either. None of this really makes any sense. I ended up bailing on my constants and just used variables that I set to rgb colors in the startup routine of my application but I'd really like to know how this is supposed to work.
Thanks,
Keith