How to return a constant color on the Internet from a color saved as a string?

//clWebSnow = $FAFAFF; defined in Graphics.pas
Listbox1.Items.Add( ColorToString( clRed ) );
Listbox1.Items.Add( ColorToString( clWebSnow ) );

How can you return "WebSnow" as a string to show the color as a color constant, like WebSnow?

All I can get is “$ FAFAFF” as a string with web colors stored as a string, while StandardColors and ExtendedColors return color constant values.

Example: clRed is displayed as red in the list and displayed as red in the label header. clWebSnow is displayed as "$ FAFAFF" in the list and displayed as FAFAFF in the label header.

Bill

+3
source share
2 answers

See RGBToWebColorName in GraphUtil .

  Label1.Caption := RGBToWebColorName(clWebSnow); // returns "clWebSnow"
+8

ColorToString IntToIdent, "", Graphics.pas. , - Graphics.pas, .

0

Source: https://habr.com/ru/post/1715018/


All Articles