Colors and themes

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Colors and themes

All colors are in 32 bit RGBA format  To convert from windows color use Win2Color(WinColor) (htutils unit).

 

Following functions are used for color encoding/decoding

 

  function htmlHextoColor(const s: string): cardinal;

  Convert color string in any format to color.

 

  function htmlHextoColorSys(const s: stringout SysColorFlag: integer): cardinal;

  Convert color string in any format to color, returns System flag for system colors.

 
  function HtStringtoSysColor(const Color: string): cardinal;

  Convert system color name to color using current theme.

 
  function htmlColortoHex(C: cardinal): string;

  Convert color to rrbbgg format

 
  function htmlColortoStr(C: cardinal): string;

  Convert color to #rrbbgg format

 
  function HtStringtoColor(const Color: hstring): cardinal;

  Convert string color code (f.e. green) to color value. When color not found returns zero

 

Note, that when using alpha, it should be in last two symbols: #rrggbbaa

 

There are number or system color names mapped to current system or Delphi theme colors on Windows and OSX.

 

ACTIVEBORDER

ACTIVECAPTION

APPWORKSPACE

BACKGROUND

BTNFACE

BTNHIGHLIGHT

BTNSHADOW

BTNTEXT

BUTTONFACE

BUTTONTEXT

C3DDKSHADOW

C3DFACE

C3DHIGHLIGHT

C3DHILIGHT

C3DLIGHT

C3DSHADOW

CANVAS

CANVASTEXT

CAPTIONTEXT

DESKTOP

FIELD

FIELDTEXT

GRADIENTACTIVECAPTION

GRADIENTINACTIVECAPTION

GRAYTEXT

HIGHLIGHT

HIGHLIGHTTEXT

HOTLIGHT

INACTIVEBORDER

INACTIVECAPTION

INACTIVECAPTIONTEXT

INFOBK

INFOTEXT

MENU

MENUBAR

MENUHIGHLIGHT

MENUTEXT

SCROLLBAR

WINDOW

WINDOWFRAME

WINDOWTEXT

 

To define custom color mapping, write own 

 

function ThemeColorProc(ColorID: integer): cardinal;

 

and register it using 

 

 THtmlNode.SetThemeColorPrc(ThemeColorProc);