Custom Delphi Colours

chendriksen picture chendriksen · Mar 18, 2010 · Viewed 13.7k times · Source

If i want to set a colour property to something thats non-standard (i.e. not something like clBlack or clRed) how can i do this? Can i set something like hexadecimal colours?

Answer

James Barrass picture James Barrass · Mar 18, 2010

RGB in Windows.pas

function RGB(r, g, b: Byte): COLORREF;

you can cast the result to be a TColor.

e.g

MyColour := TColor(RGB(Red,Green,Blue));