How to convert color values to TCastleColor

color value #F1C09E or RGB(241,192,158) or $009EC0F1
The above three color values are the same color, with different manifestations

How to convert color values to TCastleColor?

There’re various ways:

  • If your color value is in hexadecimal color notation, like your first example, then can pass the string to HexToColor() function. Example: Color := HexToColor('#F1C09E');
  • If you have the values of R, G, B like in your second example, then you take each value and divide it to 255, then pass the results to Vector4() function. Example: Color := Vector4(241 / 255, 192 / 255, 158 / 255, 1);

Thank you very much