Ignore:
Timestamp:
Dec 22, 2016, 8:49:19 PM (7 years ago)
Author:
chronos
Message:
  • Modified: Updated BGRABitmap package.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GraphicTest/Packages/bgrabitmap/csscolorconst.inc

    r472 r494  
    1 {$IFDEF INCLUDE_COLOR_CONST}
    2 {$UNDEF INCLUDE_COLOR_CONST}
     1{=== Color definitions ===}
     2
     3{$IFDEF INCLUDE_INTERFACE}
     4{$UNDEF INCLUDE_INTERFACE}
     5var
     6  {* This is the value used for transparent pixels. In theory, any
     7     color with alpha = 0 is transparent, however it is recommended to
     8     use all other channels to zero as well. }
     9  BGRAPixelTransparent: TBGRAPixel;
     10
     11  {* [#FFFFFF] White opaque }
     12  BGRAWhite: TBGRAPixel;
     13  {* [#000000] Black opaque }
     14  BGRABlack: TBGRAPixel;
     15
    316const
     17  {* This color [#000001] looks just like black. It is needed for drawing black
     18     shapes using the ''Canvas'' property of ''TBGRABitmap''. This is a standard
     19     ''TCanvas'' and when drawing with pure black (''clBlack''), there is no way to know if
     20     something has been drawn or if it is transparent }
     21  clBlackOpaque = TColor($010000);
     22
     23var
    424  //VGA colors
    5   VGABlack: TBGRAPixel = (blue: 0; green: 0; red: 0; alpha: 255);
    6   VGAGray: TBGRAPixel = (blue: 128; green: 128; red: 128; alpha: 255);
    7   VGASilver: TBGRAPixel = (blue: 192; green: 192; red: 192; alpha: 255);
    8   VGAWhite: TBGRAPixel = (blue: 255; green: 255; red: 255; alpha: 255);
    9   VGAMaroon: TBGRAPixel = (blue: 0; green: 0; red: 128; alpha: 255);
    10   VGARed: TBGRAPixel = (blue: 0; green: 0; red: 255; alpha: 255);
    11   VGAPurple: TBGRAPixel = (blue: 128; green: 0; red: 128; alpha: 255);
    12   VGAFuchsia: TBGRAPixel = (blue: 255; green: 0; red: 255; alpha: 255);
    13   VGAGreen: TBGRAPixel = (blue: 0; green: 128; red: 0; alpha: 255);
    14   VGALime: TBGRAPixel = (blue: 0; green: 255; red: 0; alpha: 255);
    15   VGAOlive: TBGRAPixel = (blue: 0; green: 128; red: 128; alpha: 255);
    16   VGAYellow: TBGRAPixel = (blue: 0; green: 255; red: 255; alpha: 255);
    17   VGANavy: TBGRAPixel = (blue: 128; green: 0; red: 0; alpha: 255);
    18   VGABlue: TBGRAPixel = (blue: 255; green: 0; red: 0; alpha: 255);
    19   VGATeal: TBGRAPixel = (blue: 128; green: 128; red: 0; alpha: 255);
    20   VGAAqua: TBGRAPixel = (blue: 255; green: 255; red: 0; alpha: 255);
     25  VGABlack,VGAGray,VGASilver,VGAWhite,
     26  VGAMaroon,VGARed,VGAPurple,VGAFuchsia,
     27  VGAGreen,VGALime,VGAOlive,VGAYellow,
     28  VGANavy,VGABlue,VGATeal,VGAAqua: TBGRAPixel;
    2129
    2230  //Red colors
    23   CSSIndianRed: TBGRAPixel = (blue: 92; green: 92; red: 205; alpha: 255);
    24   CSSLightCoral: TBGRAPixel = (blue: 128; green: 128; red: 240; alpha: 255);
    25   CSSSalmon: TBGRAPixel = (blue: 114; green: 128; red: 250; alpha: 255);
    26   CSSDarkSalmon: TBGRAPixel = (blue: 122; green: 150; red: 233; alpha: 255);
    27   CSSRed: TBGRAPixel = (blue: 0; green: 0; red: 255; alpha: 255);
    28   CSSCrimson: TBGRAPixel = (blue: 60; green: 20; red: 220; alpha: 255);
    29   CSSFireBrick: TBGRAPixel = (blue: 34; green: 34; red: 178; alpha: 255);
    30   CSSDarkRed: TBGRAPixel = (blue: 0; green: 0; red: 139; alpha: 255);
    31 
     31  CSSIndianRed,CSSLightCoral,CSSSalmon,CSSDarkSalmon,
     32  CSSRed,CSSCrimson,CSSFireBrick,CSSDarkRed: TBGRAPixel;
    3233  //Pink colors
    33   CSSPink: TBGRAPixel = (blue: 203; green: 192; red: 255; alpha: 255);
    34   CSSLightPink: TBGRAPixel = (blue: 193; green: 182; red: 255; alpha: 255);
    35   CSSHotPink: TBGRAPixel = (blue: 180; green: 105; red: 255; alpha: 255);
    36   CSSDeepPink: TBGRAPixel = (blue: 147; green: 20; red: 255; alpha: 255);
    37   CSSMediumVioletRed: TBGRAPixel = (blue: 133; green: 21; red: 199; alpha: 255);
    38   CSSPaleVioletRed: TBGRAPixel = (blue: 147; green: 112; red: 219; alpha: 255);
    39 
     34  CSSPink,CSSLightPink,CSSHotPink,CSSDeepPink,
     35  CSSMediumVioletRed,CSSPaleVioletRed: TBGRAPixel;
    4036  //Orange colors
    41   CSSLightSalmon: TBGRAPixel = (blue: 122; green: 160; red: 255; alpha: 255);
    42   CSSCoral: TBGRAPixel = (blue: 80; green: 127; red: 255; alpha: 255);
    43   CSSTomato: TBGRAPixel = (blue: 71; green: 99; red: 255; alpha: 255);
    44   CSSOrangeRed: TBGRAPixel = (blue: 0; green: 69; red: 255; alpha: 255);
    45   CSSDarkOrange: TBGRAPixel = (blue: 0; green: 140; red: 255; alpha: 255);
    46   CSSOrange: TBGRAPixel = (blue: 0; green: 165; red: 255; alpha: 255);
    47 
     37  CSSLightSalmon,CSSCoral,CSSTomato,CSSOrangeRed,
     38  CSSDarkOrange,CSSOrange: TBGRAPixel;
    4839  //Yellow colors
    49   CSSGold: TBGRAPixel = (blue: 0; green: 215; red: 255; alpha: 255);
    50   CSSYellow: TBGRAPixel = (blue: 0; green: 255; red: 255; alpha: 255);
    51   CSSLightYellow: TBGRAPixel = (blue: 224; green: 255; red: 255; alpha: 255);
    52   CSSLemonChiffon: TBGRAPixel = (blue: 205; green: 250; red: 255; alpha: 255);
    53   CSSLightGoldenrodYellow: TBGRAPixel = (blue: 210; green: 250; red: 250; alpha: 255);
    54   CSSPapayaWhip: TBGRAPixel = (blue: 213; green: 239; red: 255; alpha: 255);
    55   CSSMoccasin: TBGRAPixel = (blue: 181; green: 228; red: 255; alpha: 255);
    56   CSSPeachPuff: TBGRAPixel = (blue: 185; green: 218; red: 255; alpha: 255);
    57   CSSPaleGoldenrod: TBGRAPixel = (blue: 170; green: 232; red: 238; alpha: 255);
    58   CSSKhaki: TBGRAPixel = (blue: 140; green: 230; red: 240; alpha: 255);
    59   CSSDarkKhaki: TBGRAPixel = (blue: 107; green: 183; red: 189; alpha: 255);
    60 
     40  CSSGold,CSSYellow,CSSLightYellow,CSSLemonChiffon,
     41  CSSLightGoldenrodYellow,CSSPapayaWhip,CSSMoccasin,CSSPeachPuff,
     42  CSSPaleGoldenrod,CSSKhaki,CSSDarkKhaki: TBGRAPixel;
    6143  //Purple colors
    62   CSSLavender: TBGRAPixel = (blue: 250; green: 230; red: 230; alpha: 255);
    63   CSSThistle: TBGRAPixel = (blue: 216; green: 191; red: 216; alpha: 255);
    64   CSSPlum: TBGRAPixel = (blue: 221; green: 160; red: 221; alpha: 255);
    65   CSSViolet: TBGRAPixel = (blue: 238; green: 130; red: 238; alpha: 255);
    66   CSSOrchid: TBGRAPixel = (blue: 214; green: 112; red: 218; alpha: 255);
    67   CSSFuchsia: TBGRAPixel = (blue: 255; green: 0; red: 255; alpha: 255);
    68   CSSMagenta: TBGRAPixel = (blue: 255; green: 0; red: 255; alpha: 255);
    69   CSSMediumOrchid: TBGRAPixel = (blue: 211; green: 85; red: 186; alpha: 255);
    70   CSSMediumPurple: TBGRAPixel = (blue: 219; green: 112; red: 147; alpha: 255);
    71   CSSBlueViolet: TBGRAPixel = (blue: 226; green: 43; red: 138; alpha: 255);
    72   CSSDarkViolet: TBGRAPixel = (blue: 211; green: 0; red: 148; alpha: 255);
    73   CSSDarkOrchid: TBGRAPixel = (blue: 204; green: 50; red: 153; alpha: 255);
    74   CSSDarkMagenta: TBGRAPixel = (blue: 139; green: 0; red: 139; alpha: 255);
    75   CSSPurple: TBGRAPixel = (blue: 128; green: 0; red: 128; alpha: 255);
    76   CSSIndigo: TBGRAPixel = (blue: 130; green: 0; red: 75; alpha: 255);
    77   CSSDarkSlateBlue: TBGRAPixel = (blue: 139; green: 61; red: 72; alpha: 255);
    78   CSSSlateBlue: TBGRAPixel = (blue: 205; green: 90; red: 106; alpha: 255);
    79   CSSMediumSlateBlue: TBGRAPixel = (blue: 238; green: 104; red: 123; alpha: 255);
    80 
     44  CSSLavender,CSSThistle,CSSPlum,CSSViolet,
     45  CSSOrchid,CSSFuchsia,CSSMagenta,CSSMediumOrchid,
     46  CSSMediumPurple,CSSBlueViolet,CSSDarkViolet,CSSDarkOrchid,
     47  CSSDarkMagenta,CSSPurple,CSSIndigo,CSSDarkSlateBlue,
     48  CSSSlateBlue,CSSMediumSlateBlue: TBGRAPixel;
    8149  //Green colors
    82   CSSGreenYellow: TBGRAPixel = (blue: 47; green: 255; red: 173; alpha: 255);
    83   CSSChartreuse: TBGRAPixel = (blue: 0; green: 255; red: 127; alpha: 255);
    84   CSSLawnGreen: TBGRAPixel = (blue: 0; green: 252; red: 124; alpha: 255);
    85   CSSLime: TBGRAPixel = (blue: 0; green: 255; red: 0; alpha: 255);
    86   CSSLimeGreen: TBGRAPixel = (blue: 50; green: 205; red: 50; alpha: 255);
    87   CSSPaleGreen: TBGRAPixel = (blue: 152; green: 251; red: 152; alpha: 255);
    88   CSSLightGreen: TBGRAPixel = (blue: 144; green: 238; red: 144; alpha: 255);
    89   CSSMediumSpringGreen: TBGRAPixel = (blue: 154; green: 250; red: 0; alpha: 255);
    90   CSSSpringGreen: TBGRAPixel = (blue: 127; green: 255; red: 0; alpha: 255);
    91   CSSMediumSeaGreen: TBGRAPixel = (blue: 113; green: 179; red: 60; alpha: 255);
    92   CSSSeaGreen: TBGRAPixel = (blue: 87; green: 139; red: 46; alpha: 255);
    93   CSSForestGreen: TBGRAPixel = (blue: 34; green: 139; red: 34; alpha: 255);
    94   CSSGreen: TBGRAPixel = (blue: 0; green: 128; red: 0; alpha: 255);
    95   CSSDarkGreen: TBGRAPixel = (blue: 0; green: 100; red: 0; alpha: 255);
    96   CSSYellowGreen: TBGRAPixel = (blue: 50; green: 205; red: 154; alpha: 255);
    97   CSSOliveDrab: TBGRAPixel = (blue: 35; green: 142; red: 107; alpha: 255);
    98   CSSOlive: TBGRAPixel = (blue: 0; green: 128; red: 128; alpha: 255);
    99   CSSDarkOliveGreen: TBGRAPixel = (blue: 47; green: 107; red: 85; alpha: 255);
    100   CSSMediumAquamarine: TBGRAPixel = (blue: 170; green: 205; red: 102; alpha: 255);
    101   CSSDarkSeaGreen: TBGRAPixel = (blue: 143; green: 188; red: 143; alpha: 255);
    102   CSSLightSeaGreen: TBGRAPixel = (blue: 170; green: 178; red: 32; alpha: 255);
    103   CSSDarkCyan: TBGRAPixel = (blue: 139; green: 139; red: 0; alpha: 255);
    104   CSSTeal: TBGRAPixel = (blue: 128; green: 128; red: 0; alpha: 255);
    105 
     50  CSSGreenYellow,CSSChartreuse,CSSLawnGreen,CSSLime,
     51  CSSLimeGreen,CSSPaleGreen,CSSLightGreen,CSSMediumSpringGreen,
     52  CSSSpringGreen,CSSMediumSeaGreen,CSSSeaGreen,CSSForestGreen,
     53  CSSGreen,CSSDarkGreen,CSSYellowGreen,CSSOliveDrab,
     54  CSSOlive,CSSDarkOliveGreen,CSSMediumAquamarine,CSSDarkSeaGreen,
     55  CSSLightSeaGreen,CSSDarkCyan,CSSTeal: TBGRAPixel;
    10656  //Blue/Cyan colors
    107   CSSAqua: TBGRAPixel = (blue: 255; green: 255; red: 0; alpha: 255);
    108   CSSCyan: TBGRAPixel = (blue: 255; green: 255; red: 0; alpha: 255);
    109   CSSLightCyan: TBGRAPixel = (blue: 255; green: 255; red: 224; alpha: 255);
    110   CSSPaleTurquoise: TBGRAPixel = (blue: 238; green: 238; red: 175; alpha: 255);
    111   CSSAquamarine: TBGRAPixel = (blue: 212; green: 255; red: 127; alpha: 255);
    112   CSSTurquoise: TBGRAPixel = (blue: 208; green: 224; red: 64; alpha: 255);
    113   CSSMediumTurquoise: TBGRAPixel = (blue: 204; green: 209; red: 72; alpha: 255);
    114   CSSDarkTurquoise: TBGRAPixel = (blue: 209; green: 206; red: 0; alpha: 255);
    115   CSSCadetBlue: TBGRAPixel = (blue: 160; green: 158; red: 95; alpha: 255);
    116   CSSSteelBlue: TBGRAPixel = (blue: 180; green: 130; red: 70; alpha: 255);
    117   CSSLightSteelBlue: TBGRAPixel = (blue: 222; green: 196; red: 176; alpha: 255);
    118   CSSPowderBlue: TBGRAPixel = (blue: 230; green: 224; red: 176; alpha: 255);
    119   CSSLightBlue: TBGRAPixel = (blue: 230; green: 216; red: 173; alpha: 255);
    120   CSSSkyBlue: TBGRAPixel = (blue: 235; green: 206; red: 135; alpha: 255);
    121   CSSLightSkyBlue: TBGRAPixel = (blue: 250; green: 206; red: 135; alpha: 255);
    122   CSSDeepSkyBlue: TBGRAPixel = (blue: 255; green: 191; red: 0; alpha: 255);
    123   CSSDodgerBlue: TBGRAPixel = (blue: 255; green: 144; red: 30; alpha: 255);
    124   CSSCornflowerBlue: TBGRAPixel = (blue: 237; green: 149; red: 100; alpha: 255);
    125   CSSRoyalBlue: TBGRAPixel = (blue: 255; green: 105; red: 65; alpha: 255);
    126   CSSBlue: TBGRAPixel = (blue: 255; green: 0; red: 0; alpha: 255);
    127   CSSMediumBlue: TBGRAPixel = (blue: 205; green: 0; red: 0; alpha: 255);
    128   CSSDarkBlue: TBGRAPixel = (blue: 139; green: 0; red: 0; alpha: 255);
    129   CSSNavy: TBGRAPixel = (blue: 128; green: 0; red: 0; alpha: 255);
    130   CSSMidnightBlue: TBGRAPixel = (blue: 112; green: 25; red: 25; alpha: 255);
    131 
     57  CSSAqua,CSSCyan,CSSLightCyan,CSSPaleTurquoise,
     58  CSSAquamarine,CSSTurquoise,CSSMediumTurquoise,CSSDarkTurquoise,
     59  CSSCadetBlue,CSSSteelBlue,CSSLightSteelBlue,CSSPowderBlue,
     60  CSSLightBlue,CSSSkyBlue,CSSLightSkyBlue,CSSDeepSkyBlue,
     61  CSSDodgerBlue,CSSCornflowerBlue,CSSRoyalBlue,CSSBlue,
     62  CSSMediumBlue,CSSDarkBlue,CSSNavy,CSSMidnightBlue: TBGRAPixel;
    13263  //Brown colors
    133   CSSCornsilk: TBGRAPixel = (blue: 220; green: 248; red: 255; alpha: 255);
    134   CSSBlanchedAlmond: TBGRAPixel = (blue: 205; green: 235; red: 255; alpha: 255);
    135   CSSBisque: TBGRAPixel = (blue: 196; green: 228; red: 255; alpha: 255);
    136   CSSNavajoWhite: TBGRAPixel = (blue: 173; green: 222; red: 255; alpha: 255);
    137   CSSWheat: TBGRAPixel = (blue: 179; green: 222; red: 245; alpha: 255);
    138   CSSBurlyWood: TBGRAPixel = (blue: 135; green: 184; red: 222; alpha: 255);
    139   CSSTan: TBGRAPixel = (blue: 140; green: 180; red: 210; alpha: 255);
    140   CSSRosyBrown: TBGRAPixel = (blue: 143; green: 143; red: 188; alpha: 255);
    141   CSSSandyBrown: TBGRAPixel = (blue: 96; green: 164; red: 244; alpha: 255);
    142   CSSGoldenrod: TBGRAPixel = (blue: 32; green: 165; red: 218; alpha: 255);
    143   CSSDarkGoldenrod: TBGRAPixel = (blue: 11; green: 134; red: 184; alpha: 255);
    144   CSSPeru: TBGRAPixel = (blue: 63; green: 133; red: 205; alpha: 255);
    145   CSSChocolate: TBGRAPixel = (blue: 30; green: 105; red: 210; alpha: 255);
    146   CSSSaddleBrown: TBGRAPixel = (blue: 19; green: 69; red: 139; alpha: 255);
    147   CSSSienna: TBGRAPixel = (blue: 45; green: 82; red: 160; alpha: 255);
    148   CSSBrown: TBGRAPixel = (blue: 42; green: 42; red: 165; alpha: 255);
    149   CSSMaroon: TBGRAPixel = (blue: 0; green: 0; red: 128; alpha: 255);
    150 
     64  CSSCornsilk, CSSBlanchedAlmond, CSSBisque, CSSNavajoWhite,
     65  CSSWheat, CSSBurlyWood, CSSTan, CSSRosyBrown,
     66  CSSSandyBrown, CSSGoldenrod, CSSDarkGoldenrod, CSSPeru,
     67  CSSChocolate, CSSSaddleBrown, CSSSienna, CSSBrown,
     68  CSSMaroon: TBGRAPixel;
    15169  //White colors
    152   CSSWhite: TBGRAPixel = (blue: 255; green: 255; red: 255; alpha: 255);
    153   CSSSnow: TBGRAPixel = (blue: 250; green: 250; red: 255; alpha: 255);
    154   CSSHoneydew: TBGRAPixel = (blue: 240; green: 255; red: 250; alpha: 255);
    155   CSSMintCream: TBGRAPixel = (blue: 250; green: 255; red: 245; alpha: 255);
    156   CSSAzure: TBGRAPixel = (blue: 255; green: 255; red: 240; alpha: 255);
    157   CSSAliceBlue: TBGRAPixel = (blue: 255; green: 248; red: 240; alpha: 255);
    158   CSSGhostWhite: TBGRAPixel = (blue: 255; green: 248; red: 248; alpha: 255);
    159   CSSWhiteSmoke: TBGRAPixel = (blue: 245; green: 245; red: 245; alpha: 255);
    160   CSSSeashell: TBGRAPixel = (blue: 255; green: 245; red: 238; alpha: 255);
    161   CSSBeige: TBGRAPixel = (blue: 220; green: 245; red: 245; alpha: 255);
    162   CSSOldLace: TBGRAPixel = (blue: 230; green: 245; red: 253; alpha: 255);
    163   CSSFloralWhite: TBGRAPixel = (blue: 240; green: 250; red: 255; alpha: 255);
    164   CSSIvory: TBGRAPixel = (blue: 240; green: 255; red: 255; alpha: 255);
    165   CSSAntiqueWhite: TBGRAPixel = (blue: 215; green: 235; red: 250; alpha: 255);
    166   CSSLinen: TBGRAPixel = (blue: 230; green: 240; red: 250; alpha: 255);
    167   CSSLavenderBlush: TBGRAPixel = (blue: 245; green: 240; red: 255; alpha: 255);
    168   CSSMistyRose: TBGRAPixel = (blue: 255; green: 228; red: 255; alpha: 255);
    169 
     70  CSSWhite, CSSSnow, CSSHoneydew, CSSMintCream,
     71  CSSAzure, CSSAliceBlue, CSSGhostWhite, CSSWhiteSmoke,
     72  CSSSeashell, CSSBeige, CSSOldLace, CSSFloralWhite,
     73  CSSIvory, CSSAntiqueWhite, CSSLinen, CSSLavenderBlush,
     74  CSSMistyRose: TBGRAPixel;
    17075  //Gray colors
    171   CSSGainsboro: TBGRAPixel = (blue: 220; green: 220; red: 220; alpha: 255);
    172   CSSLightGray: TBGRAPixel = (blue: 211; green: 211; red: 211; alpha: 255);
    173   CSSSilver: TBGRAPixel = (blue: 192; green: 192; red: 192; alpha: 255);
    174   CSSDarkGray: TBGRAPixel = (blue: 169; green: 169; red: 169; alpha: 255);
    175   CSSGray: TBGRAPixel = (blue: 128; green: 128; red: 128; alpha: 255);
    176   CSSDimGray: TBGRAPixel = (blue: 105; green: 105; red: 105; alpha: 255);
    177   CSSLightSlateGray: TBGRAPixel = (blue: 153; green: 136; red: 119; alpha: 255);
    178   CSSSlateGray: TBGRAPixel = (blue: 144; green: 128; red: 112; alpha: 255);
    179   CSSDarkSlateGray: TBGRAPixel = (blue: 79; green: 79; red: 47; alpha: 255);
    180   CSSBlack: TBGRAPixel = (blue: 0; green: 0; red: 0; alpha: 255);
     76  CSSGainsboro, CSSLightGray, CSSSilver, CSSDarkGray,
     77  CSSGray, CSSDimGray, CSSLightSlateGray, CSSSlateGray,
     78  CSSDarkSlateGray, CSSBlack: TBGRAPixel;
     79
     80type
     81  TBGRAColorDefinition = record
     82    Name: string;
     83    Color: TBGRAPixel;
     84  end;
     85
     86  { TBGRAColorList }
     87  {* Contains a fixed list of colors }
     88  TBGRAColorList = class
     89  protected
     90    FFinished: boolean;
     91    FNbColors: integer;
     92    FColors: array of TBGRAColorDefinition;
     93    function GetByIndex(Index: integer): TBGRAPixel;
     94    function GetByName(Name: string): TBGRAPixel;
     95    function GetName(Index: integer): string;
     96    procedure Add(Name: string; out Color: TBGRAPixel; red,green,blue: byte); overload;
     97  public
     98    {** Creates an empty color list }
     99    constructor Create;
     100    {** Add a color to the list }
     101    procedure Add(Name: string; const Color: TBGRAPixel);
     102    {** Ends the color list and prevents further modifications }
     103    procedure Finished;
     104    {** Returns the index of a color with a given name }
     105    function IndexOf(Name: string): integer;
     106    {** Returns the index of a color. Colors are considered to match if
     107        the difference is less than or equal to ''AMaxDiff'' }
     108    function IndexOfColor(const AColor: TBGRAPixel; AMaxDiff: Word = 0): integer;
     109
     110    {** Gets the color associated with a color name }
     111    property ByName[Name: string]: TBGRAPixel read GetByName;
     112    {** Gets the color at the specified index }
     113    property ByIndex[Index: integer]: TBGRAPixel read GetByIndex; default;
     114    {** Gets the name of the color at the specified index }
     115    property Name[Index: integer]: string read GetName;
     116    {** Gets the number of colors }
     117    property Count: integer read FNbColors;
     118  end;
     119
     120var
     121  {* List of VGA colors:
     122   * [#000000] Black, [#808080] Gray, [#C0C0C0] Silver, [#FFFFFF] White,
     123   * [#800000] Maroon, [#FF0000] Red,  [#800080] Purple, [#FF00FF] Fuchsia,
     124   * [#008000] Green,  [#00FF00] Lime, [#808000] Olive,  [#FFFF00] Yellow,
     125   * [#000080] Navy,   [#0000FF] Blue, [#008080] Teal,   [#00FFFF] Aqua.
     126   * Shortcut constants are provided: [#000000] ''VGABlack'', [#808080] ''VGAGray''... }
     127  VGAColors: TBGRAColorList;
     128  {* List of [http://www.w3schools.com/cssref/css_colornames.asp web colors].
     129  Shortcut constants are provided: [#000000] ''CSSBlack'', [#FF0000] ''CSSRed''... }
     130  CSSColors: TBGRAColorList;
     131
     132{------------------- string conversion ------------------------}
     133
     134{* Converts a ''TBGRAPixel'' value into a string, using color names provided in ''AColorList'', and
     135   considering that a color matches in the color list if its difference is within ''AMaxDiff'' }
     136function BGRAToStr(c: TBGRAPixel; AColorList: TBGRAColorList = nil; AMaxDiff: Word= 0): string;
     137{* Converts a fully defined string into a ''TBGRAPixel'' value. Color names from ''VGAColors'' and ''CSSColors''
     138   are used if there is an exact match }
     139function StrToBGRA(str: string): TBGRAPixel;
     140{* Converts a string into a ''TBGRAPixel'' value. If the value is not fully defined or that
     141   there is an error, ''DefaultColor'' is returned.
     142   Color names from ''VGAColors'' and ''CSSColors'' are used if there is an exact match. }
     143function StrToBGRA(str: string; const DefaultColor: TBGRAPixel): TBGRAPixel;
     144{* Converts a string into a ''TBGRAPixel'' value. If the value is not fully defined, missing channels (expressed with '?')
     145   are filled with fallbackValues. You can check if there was an error with the provided boolean.
     146   Color names from ''VGAColors'' and ''CSSColors'' are used if there is an exact match. }
     147function PartialStrToBGRA(str: string; const fallbackValues: TBGRAPixel; out error: boolean): TBGRAPixel;
     148{* Converts a string into a ''TBGRAPixel'' value into ''parsedValue''. ''parsedValue'' is not changed if
     149   some channels are missing (expressed with '?'). You can check if there was an error with the provided boolean.
     150   Color names from ''VGAColors'' and ''CSSColors'' are used if there is an exact match. }
     151procedure TryStrToBGRA(str: string; var parsedValue: TBGRAPixel; out missingValues: boolean; out error: boolean);
    181152{$ENDIF}
    182 {$IFDEF INCLUDE_COLOR_LIST}
    183 {$UNDEF INCLUDE_COLOR_LIST}
     153
     154{$IFDEF INCLUDE_IMPLEMENTATION}
     155{$UNDEF INCLUDE_IMPLEMENTATION}
     156{ TBGRAColorList }
     157
     158function TBGRAColorList.GetByIndex(Index: integer): TBGRAPixel;
     159begin
     160  if (Index < 0) or (Index >= FNbColors) then
     161    result := BGRAPixelTransparent
     162  else
     163    result := FColors[Index].Color;
     164end;
     165
     166function TBGRAColorList.GetByName(Name: string): TBGRAPixel;
     167var i: integer;
     168begin
     169  i := IndexOf(Name);
     170  if i = -1 then
     171    result := BGRAPixelTransparent
     172  else
     173    result := FColors[i].Color;
     174end;
     175
     176function TBGRAColorList.GetName(Index: integer): string;
     177begin
     178  if (Index < 0) or (Index >= FNbColors) then
     179    result := ''
     180  else
     181    result := FColors[Index].Name;
     182end;
     183
     184procedure TBGRAColorList.Add(Name: string; out Color: TBGRAPixel; red, green,
     185  blue: byte);
     186begin
     187  Color := BGRA(red,green,blue);
     188  Add(Name,Color);
     189end;
     190
     191constructor TBGRAColorList.Create;
     192begin
     193  FNbColors:= 0;
     194  FColors := nil;
     195  FFinished:= false;
     196end;
     197
     198procedure TBGRAColorList.Add(Name: string; const Color: TBGRAPixel);
     199begin
     200  if FFinished then
     201    raise Exception.Create('This list is already finished');
     202  if length(FColors) = FNbColors then
     203    SetLength(FColors, FNbColors*2+1);
     204  FColors[FNbColors].Name := Name;
     205  FColors[FNbColors].Color := Color;
     206  inc(FNbColors);
     207end;
     208
     209procedure TBGRAColorList.Finished;
     210begin
     211  if FFinished then exit;
     212  FFinished := true;
     213  SetLength(FColors, FNbColors);
     214end;
     215
     216function TBGRAColorList.IndexOf(Name: string): integer;
     217var i: integer;
     218begin
     219  for i := 0 to FNbColors-1 do
     220    if CompareText(Name, FColors[i].Name) = 0 then
     221    begin
     222      result := i;
     223      exit;
     224    end;
     225  result := -1;
     226end;
     227
     228function TBGRAColorList.IndexOfColor(const AColor: TBGRAPixel; AMaxDiff: Word = 0): integer;
     229var i: integer;
     230  MinDiff,CurDiff: Word;
     231begin
     232  if AMaxDiff = 0 then
     233  begin
     234    for i := 0 to FNbColors-1 do
     235      if AColor = FColors[i].Color then
     236      begin
     237        result := i;
     238        exit;
     239      end;
     240    result := -1;
     241  end else
     242  begin
     243    MinDiff := AMaxDiff;
     244    result := -1;
     245    for i := 0 to FNbColors-1 do
     246    begin
     247      CurDiff := BGRAWordDiff(AColor,FColors[i].Color);
     248      if CurDiff <= MinDiff then
     249      begin
     250        result := i;
     251        MinDiff := CurDiff;
     252        if MinDiff = 0 then exit;
     253      end;
     254    end;
     255  end;
     256end;
     257
     258{------------------- string conversion ---------------------------------}
     259
     260{ Write a color in hexadecimal format RRGGBBAA or using the name in a color list }
     261function BGRAToStr(c: TBGRAPixel; AColorList: TBGRAColorList = nil; AMaxDiff: Word= 0): string;
     262var idx: integer;
     263begin
     264  if Assigned(AColorList) then
     265  begin
     266    idx := AColorList.IndexOfColor(c, AMaxDiff);
     267    if idx<> -1 then
     268    begin
     269      result := AColorList.Name[idx];
     270      exit;
     271    end;
     272  end;
     273  result := IntToHex(c.red,2)+IntToHex(c.green,2)+IntToHex(c.Blue,2)+IntToHex(c.Alpha,2);
     274end;
     275
     276type
     277    arrayOfString = array of string;
     278
     279function SimpleParseFuncParam(str: string; var flagError: boolean): arrayOfString;
     280var idxOpen,start,cur: integer;
     281begin
     282    result := nil;
     283    idxOpen := pos('(',str);
     284    if idxOpen = 0 then
     285    begin
     286      start := 1;
     287      //find first space
     288      while (start <= length(str)) and (str[start]<>' ') do inc(start);
     289    end else
     290      start := idxOpen+1;
     291    cur := start;
     292    while cur <= length(str) do
     293    begin
     294       if str[cur] in[',',')'] then
     295       begin
     296         setlength(result,length(result)+1);
     297         result[high(result)] := trim(copy(str,start,cur-start));
     298         start := cur+1;
     299         if str[cur] = ')' then exit;
     300       end;
     301       inc(cur);
     302    end;
     303    if idxOpen <> 0 then flagError := true; //should exit on ')'
     304    if start <= length(str) then
     305    begin
     306      setlength(result,length(result)+1);
     307      result[high(result)] := copy(str,start,length(str)-start+1);
     308    end;
     309end;
     310
     311function ParseColorValue(str: string; var flagError: boolean): byte;
     312var pourcent,unclipped,{%H-}errPos: integer;
     313begin
     314  if str = '' then result := 0 else
     315  begin
     316    if str[length(str)]='%' then
     317    begin
     318      val(copy(str,1,length(str)-1),pourcent,errPos);
     319      if errPos <> 0 then flagError := true;
     320      if pourcent < 0 then result := 0 else
     321      if pourcent > 100 then result := 255 else
     322        result := pourcent*255 div 100;
     323    end else
     324    begin
     325      val(str,unclipped,errPos);
     326      if errPos <> 0 then flagError := true;
     327      if unclipped < 0 then result := 0 else
     328      if unclipped > 255 then result := 255 else
     329        result := unclipped;
     330    end;
     331  end;
     332end;
     333
     334//this function returns the parsed value only if it contains no error nor missing values, otherwise
     335//it returns BGRAPixelTransparent
     336function StrToBGRA(str: string): TBGRAPixel;
     337var missingValues, error: boolean;
     338begin
     339  result := BGRABlack;
     340  TryStrToBGRA(str, result, missingValues, error);
     341  if missingValues or error then result := BGRAPixelTransparent;
     342end;
     343
     344//this function changes the content of parsedValue depending on available and parsable information.
     345//set parsedValue to the fallback values before calling this function.
     346//missing values are expressed by empty string or by '?', for example 'rgb(255,?,?,?)' will change only the red value.
     347//note that if alpha is not expressed by the string format, it will be opaque. So 'rgb(255,?,?)' will change the red value and the alpha value.
     348//the last parameter of rgba() is a floating point number where 1 is opaque and 0 is transparent.
     349procedure TryStrToBGRA(str: string; var parsedValue: TBGRAPixel; out missingValues: boolean; out error: boolean);
     350var errPos: integer;
     351    values: array of string;
     352    alphaF: single;
     353    idx: integer;
     354begin
     355  str := Trim(str);
     356  error := false;
     357  if (str = '') or (str = '?') then
     358  begin
     359    missingValues := true;
     360    exit;
     361  end else
     362    missingValues := false;
     363  str := StringReplace(lowerCase(str),'grey','gray',[]);
     364
     365  //VGA color names
     366  idx := VGAColors.IndexOf(str);
     367  if idx <> -1 then
     368  begin
     369    parsedValue := VGAColors[idx];
     370    exit;
     371  end;
     372  if str='transparent' then parsedValue := BGRAPixelTransparent else
     373  begin
     374    //check CSS color
     375    idx := CSSColors.IndexOf(str);
     376    if idx <> -1 then
     377    begin
     378      parsedValue := CSSColors[idx];
     379      exit;
     380    end;
     381
     382    //CSS RGB notation
     383    if (copy(str,1,4)='rgb(') or (copy(str,1,5)='rgba(') or
     384      (copy(str,1,4)='rgb ') or (copy(str,1,5)='rgba ') then
     385    begin
     386      values := SimpleParseFuncParam(str,error);
     387      if (length(values)=3) or (length(values)=4) then
     388      begin
     389        if (values[0] <> '') and (values[0] <> '?') then
     390           parsedValue.red := ParseColorValue(values[0], error)
     391        else
     392           missingValues := true;
     393        if (values[1] <> '') and (values[1] <> '?') then
     394           parsedValue.green := ParseColorValue(values[1], error)
     395        else
     396           missingValues := true;
     397        if (values[2] <> '') and (values[2] <> '?') then
     398           parsedValue.blue := ParseColorValue(values[2], error)
     399        else
     400           missingValues := true;
     401        if length(values)=4 then
     402        begin
     403          if (values[3] <> '') and (values[3] <> '?') then
     404          begin
     405            val(values[3],alphaF,errPos);
     406            if errPos <> 0 then
     407            begin
     408               parsedValue.alpha := 255;
     409               error := true;
     410            end
     411            else
     412            begin
     413              if alphaF < 0 then
     414                parsedValue.alpha := 0 else
     415              if alphaF > 1 then
     416                parsedValue.alpha := 255
     417              else
     418                parsedValue.alpha := round(alphaF*255);
     419            end;
     420          end else
     421            missingValues := true;
     422        end else
     423          parsedValue.alpha := 255;
     424      end else
     425        error := true;
     426      exit;
     427    end;
     428
     429    //remove HTML notation header
     430    if str[1]='#' then delete(str,1,1);
     431
     432    //add alpha if missing (if you want an undefined alpha use '??' or '?')
     433    if length(str)=6 then str += 'FF';
     434    if length(str)=3 then str += 'F';
     435
     436    //hex notation
     437    if length(str)=8 then
     438    begin
     439      if copy(str,1,2) <> '??' then
     440      begin
     441        val('$'+copy(str,1,2),parsedValue.red,errPos);
     442        if errPos <> 0 then error := true;
     443      end else missingValues := true;
     444      if copy(str,3,2) <> '??' then
     445      begin
     446        val('$'+copy(str,3,2),parsedValue.green,errPos);
     447        if errPos <> 0 then error := true;
     448      end else missingValues := true;
     449      if copy(str,5,2) <> '??' then
     450      begin
     451        val('$'+copy(str,5,2),parsedValue.blue,errPos);
     452        if errPos <> 0 then error := true;
     453      end else missingValues := true;
     454      if copy(str,7,2) <> '??' then
     455      begin
     456        val('$'+copy(str,7,2),parsedValue.alpha,errPos);
     457        if errPos <> 0 then
     458        begin
     459          error := true;
     460          parsedValue.alpha := 255;
     461        end;
     462      end else missingValues := true;
     463    end else
     464    if length(str)=4 then
     465    begin
     466      if str[1] <> '?' then
     467      begin
     468        val('$'+str[1],parsedValue.red,errPos);
     469        if errPos <> 0 then error := true;
     470        parsedValue.red *= $11;
     471      end else missingValues := true;
     472      if str[2] <> '?' then
     473      begin
     474        val('$'+str[2],parsedValue.green,errPos);
     475        if errPos <> 0 then error := true;
     476        parsedValue.green *= $11;
     477      end else missingValues := true;
     478      if str[3] <> '?' then
     479      begin
     480        val('$'+str[3],parsedValue.blue,errPos);
     481        if errPos <> 0 then error := true;
     482        parsedValue.blue *= $11;
     483      end else missingValues := true;
     484      if str[4] <> '?' then
     485      begin
     486        val('$'+str[4],parsedValue.alpha,errPos);
     487        if errPos <> 0 then
     488        begin
     489          error := true;
     490          parsedValue.alpha := 255;
     491        end else
     492          parsedValue.alpha *= $11;
     493      end else missingValues := true;
     494    end else
     495      error := true; //string format not recognised
     496  end;
     497
     498end;
     499
     500//this function returns the values that can be read from the string, otherwise
     501//it fills the gaps with the fallback values. The error boolean is True only
     502//if there was invalid values, it is not set to True if there was missing values.
     503function PartialStrToBGRA(str: string; const fallbackValues: TBGRAPixel; out
     504  error: boolean): TBGRAPixel;
     505var missingValues: boolean;
     506begin
     507  result := fallbackValues;
     508  TryStrToBGRA(str, result, missingValues, error);
     509end;
     510
     511{ Read a color, for example in hexadecimal format RRGGBB(AA) or RGB(A). Partial colors are not accepted by this function. }
     512function StrToBGRA(str: string; const DefaultColor: TBGRAPixel): TBGRAPixel;
     513var missingValues, error: boolean;
     514begin
     515  result := BGRABlack;
     516  TryStrToBGRA(str, result, missingValues, error);
     517  if missingValues or error then result := DefaultColor;
     518end;
     519
     520function BlueGreenRedToBGRA(blue,green,red: byte): TBGRAPixel;
     521begin
     522  result := BGRA(red,green,blue);
     523end;
     524
     525{$ENDIF}
     526
     527{$IFDEF INCLUDE_INIT}
     528{$UNDEF INCLUDE_INIT}
     529  BGRAPixelTransparent := BGRA(0,0,0,0);
     530  BGRAWhite := BGRA(255,255,255);
     531  BGRABlack := BGRA(0,0,0);
     532
    184533  VGAColors := TBGRAColorList.Create;
    185   VGAColors.Add('Black',VGABlack);
    186   VGAColors.Add('Gray',VGAGray);
    187   VGAColors.Add('Silver',VGASilver);
    188   VGAColors.Add('White',VGAWhite);
    189   VGAColors.Add('Maroon',VGAMaroon);
    190   VGAColors.Add('Red',VGARed);
    191   VGAColors.Add('Purple',VGAPurple);
    192   VGAColors.Add('Fuchsia',VGAFuchsia);
    193   VGAColors.Add('Green',VGAGreen);
    194   VGAColors.Add('Lime',VGALime);
    195   VGAColors.Add('Olive',VGAOlive);
    196   VGAColors.Add('Yellow',VGAYellow);
    197   VGAColors.Add('Navy',VGANavy);
    198   VGAColors.Add('Blue',VGABlue);
    199   VGAColors.Add('Teal',VGATeal);
    200   VGAColors.Add('Aqua',VGAAqua);
     534  VGAColors.Add('Black',VGABlack,0,0,0);
     535  VGAColors.Add('Gray',VGAGray,128,128,128);
     536  VGAColors.Add('Silver',VGASilver,192,192,192);
     537  VGAColors.Add('White',VGAWhite,255,255,255);
     538  VGAColors.Add('Maroon',VGAMaroon,128,0,0);
     539  VGAColors.Add('Red',VGARed,255,0,0);
     540  VGAColors.Add('Purple',VGAPurple,128,0,128);
     541  VGAColors.Add('Fuchsia',VGAFuchsia,255,0,255);
     542  VGAColors.Add('Green',VGAGreen,0,128,0);
     543  VGAColors.Add('Lime',VGALime,0,255,0);
     544  VGAColors.Add('Olive',VGAOlive,128,128,0);
     545  VGAColors.Add('Yellow',VGAYellow,255,255,0);
     546  VGAColors.Add('Navy',VGANavy,0,0,128);
     547  VGAColors.Add('Blue',VGABlue,0,0,255);
     548  VGAColors.Add('Teal',VGATeal,0,128,128);
     549  VGAColors.Add('Aqua',VGAAqua,0,255,255);
    201550  VGAColors.Finished;
     551
     552  //Red colors
     553  CSSIndianRed:= BlueGreenRedToBGRA(92, 92, 205);
     554  CSSLightCoral:= BlueGreenRedToBGRA(128, 128, 240);
     555  CSSSalmon:= BlueGreenRedToBGRA(114, 128, 250);
     556  CSSDarkSalmon:= BlueGreenRedToBGRA(122, 150, 233);
     557  CSSRed:= BlueGreenRedToBGRA(0, 0, 255);
     558  CSSCrimson:= BlueGreenRedToBGRA(60, 20, 220);
     559  CSSFireBrick:= BlueGreenRedToBGRA(34, 34, 178);
     560  CSSDarkRed:= BlueGreenRedToBGRA(0, 0, 139);
     561
     562  //Pink colors
     563  CSSPink:= BlueGreenRedToBGRA(203, 192, 255);
     564  CSSLightPink:= BlueGreenRedToBGRA(193, 182, 255);
     565  CSSHotPink:= BlueGreenRedToBGRA(180, 105, 255);
     566  CSSDeepPink:= BlueGreenRedToBGRA(147, 20, 255);
     567  CSSMediumVioletRed:= BlueGreenRedToBGRA(133, 21, 199);
     568  CSSPaleVioletRed:= BlueGreenRedToBGRA(147, 112, 219);
     569
     570  //Orange colors
     571  CSSLightSalmon:= BlueGreenRedToBGRA(122, 160, 255);
     572  CSSCoral:= BlueGreenRedToBGRA(80, 127, 255);
     573  CSSTomato:= BlueGreenRedToBGRA(71, 99, 255);
     574  CSSOrangeRed:= BlueGreenRedToBGRA(0, 69, 255);
     575  CSSDarkOrange:= BlueGreenRedToBGRA(0, 140, 255);
     576  CSSOrange:= BlueGreenRedToBGRA(0, 165, 255);
     577
     578  //Yellow colors
     579  CSSGold:= BlueGreenRedToBGRA(0, 215, 255);
     580  CSSYellow:= BlueGreenRedToBGRA(0, 255, 255);
     581  CSSLightYellow:= BlueGreenRedToBGRA(224, 255, 255);
     582  CSSLemonChiffon:= BlueGreenRedToBGRA(205, 250, 255);
     583  CSSLightGoldenrodYellow:= BlueGreenRedToBGRA(210, 250, 250);
     584  CSSPapayaWhip:= BlueGreenRedToBGRA(213, 239, 255);
     585  CSSMoccasin:= BlueGreenRedToBGRA(181, 228, 255);
     586  CSSPeachPuff:= BlueGreenRedToBGRA(185, 218, 255);
     587  CSSPaleGoldenrod:= BlueGreenRedToBGRA(170, 232, 238);
     588  CSSKhaki:= BlueGreenRedToBGRA(140, 230, 240);
     589  CSSDarkKhaki:= BlueGreenRedToBGRA(107, 183, 189);
     590
     591  //Purple colors
     592  CSSLavender:= BlueGreenRedToBGRA(250, 230, 230);
     593  CSSThistle:= BlueGreenRedToBGRA(216, 191, 216);
     594  CSSPlum:= BlueGreenRedToBGRA(221, 160, 221);
     595  CSSViolet:= BlueGreenRedToBGRA(238, 130, 238);
     596  CSSOrchid:= BlueGreenRedToBGRA(214, 112, 218);
     597  CSSFuchsia:= BlueGreenRedToBGRA(255, 0, 255);
     598  CSSMagenta:= BlueGreenRedToBGRA(255, 0, 255);
     599  CSSMediumOrchid:= BlueGreenRedToBGRA(211, 85, 186);
     600  CSSMediumPurple:= BlueGreenRedToBGRA(219, 112, 147);
     601  CSSBlueViolet:= BlueGreenRedToBGRA(226, 43, 138);
     602  CSSDarkViolet:= BlueGreenRedToBGRA(211, 0, 148);
     603  CSSDarkOrchid:= BlueGreenRedToBGRA(204, 50, 153);
     604  CSSDarkMagenta:= BlueGreenRedToBGRA(139, 0, 139);
     605  CSSPurple:= BlueGreenRedToBGRA(128, 0, 128);
     606  CSSIndigo:= BlueGreenRedToBGRA(130, 0, 75);
     607  CSSDarkSlateBlue:= BlueGreenRedToBGRA(139, 61, 72);
     608  CSSSlateBlue:= BlueGreenRedToBGRA(205, 90, 106);
     609  CSSMediumSlateBlue:= BlueGreenRedToBGRA(238, 104, 123);
     610
     611  //Green colors
     612  CSSGreenYellow:= BlueGreenRedToBGRA(47, 255, 173);
     613  CSSChartreuse:= BlueGreenRedToBGRA(0, 255, 127);
     614  CSSLawnGreen:= BlueGreenRedToBGRA(0, 252, 124);
     615  CSSLime:= BlueGreenRedToBGRA(0, 255, 0);
     616  CSSLimeGreen:= BlueGreenRedToBGRA(50, 205, 50);
     617  CSSPaleGreen:= BlueGreenRedToBGRA(152, 251, 152);
     618  CSSLightGreen:= BlueGreenRedToBGRA(144, 238, 144);
     619  CSSMediumSpringGreen:= BlueGreenRedToBGRA(154, 250, 0);
     620  CSSSpringGreen:= BlueGreenRedToBGRA(127, 255, 0);
     621  CSSMediumSeaGreen:= BlueGreenRedToBGRA(113, 179, 60);
     622  CSSSeaGreen:= BlueGreenRedToBGRA(87, 139, 46);
     623  CSSForestGreen:= BlueGreenRedToBGRA(34, 139, 34);
     624  CSSGreen:= BlueGreenRedToBGRA(0, 128, 0);
     625  CSSDarkGreen:= BlueGreenRedToBGRA(0, 100, 0);
     626  CSSYellowGreen:= BlueGreenRedToBGRA(50, 205, 154);
     627  CSSOliveDrab:= BlueGreenRedToBGRA(35, 142, 107);
     628  CSSOlive:= BlueGreenRedToBGRA(0, 128, 128);
     629  CSSDarkOliveGreen:= BlueGreenRedToBGRA(47, 107, 85);
     630  CSSMediumAquamarine:= BlueGreenRedToBGRA(170, 205, 102);
     631  CSSDarkSeaGreen:= BlueGreenRedToBGRA(143, 188, 143);
     632  CSSLightSeaGreen:= BlueGreenRedToBGRA(170, 178, 32);
     633  CSSDarkCyan:= BlueGreenRedToBGRA(139, 139, 0);
     634  CSSTeal:= BlueGreenRedToBGRA(128, 128, 0);
     635
     636  //Blue/Cyan colors
     637  CSSAqua:= BlueGreenRedToBGRA(255, 255, 0);
     638  CSSCyan:= BlueGreenRedToBGRA(255, 255, 0);
     639  CSSLightCyan:= BlueGreenRedToBGRA(255, 255, 224);
     640  CSSPaleTurquoise:= BlueGreenRedToBGRA(238, 238, 175);
     641  CSSAquamarine:= BlueGreenRedToBGRA(212, 255, 127);
     642  CSSTurquoise:= BlueGreenRedToBGRA(208, 224, 64);
     643  CSSMediumTurquoise:= BlueGreenRedToBGRA(204, 209, 72);
     644  CSSDarkTurquoise:= BlueGreenRedToBGRA(209, 206, 0);
     645  CSSCadetBlue:= BlueGreenRedToBGRA(160, 158, 95);
     646  CSSSteelBlue:= BlueGreenRedToBGRA(180, 130, 70);
     647  CSSLightSteelBlue:= BlueGreenRedToBGRA(222, 196, 176);
     648  CSSPowderBlue:= BlueGreenRedToBGRA(230, 224, 176);
     649  CSSLightBlue:= BlueGreenRedToBGRA(230, 216, 173);
     650  CSSSkyBlue:= BlueGreenRedToBGRA(235, 206, 135);
     651  CSSLightSkyBlue:= BlueGreenRedToBGRA(250, 206, 135);
     652  CSSDeepSkyBlue:= BlueGreenRedToBGRA(255, 191, 0);
     653  CSSDodgerBlue:= BlueGreenRedToBGRA(255, 144, 30);
     654  CSSCornflowerBlue:= BlueGreenRedToBGRA(237, 149, 100);
     655  CSSRoyalBlue:= BlueGreenRedToBGRA(255, 105, 65);
     656  CSSBlue:= BlueGreenRedToBGRA(255, 0, 0);
     657  CSSMediumBlue:= BlueGreenRedToBGRA(205, 0, 0);
     658  CSSDarkBlue:= BlueGreenRedToBGRA(139, 0, 0);
     659  CSSNavy:= BlueGreenRedToBGRA(128, 0, 0);
     660  CSSMidnightBlue:= BlueGreenRedToBGRA(112, 25, 25);
     661
     662  //Brown colors
     663  CSSCornsilk:= BlueGreenRedToBGRA(220, 248, 255);
     664  CSSBlanchedAlmond:= BlueGreenRedToBGRA(205, 235, 255);
     665  CSSBisque:= BlueGreenRedToBGRA(196, 228, 255);
     666  CSSNavajoWhite:= BlueGreenRedToBGRA(173, 222, 255);
     667  CSSWheat:= BlueGreenRedToBGRA(179, 222, 245);
     668  CSSBurlyWood:= BlueGreenRedToBGRA(135, 184, 222);
     669  CSSTan:= BlueGreenRedToBGRA(140, 180, 210);
     670  CSSRosyBrown:= BlueGreenRedToBGRA(143, 143, 188);
     671  CSSSandyBrown:= BlueGreenRedToBGRA(96, 164, 244);
     672  CSSGoldenrod:= BlueGreenRedToBGRA(32, 165, 218);
     673  CSSDarkGoldenrod:= BlueGreenRedToBGRA(11, 134, 184);
     674  CSSPeru:= BlueGreenRedToBGRA(63, 133, 205);
     675  CSSChocolate:= BlueGreenRedToBGRA(30, 105, 210);
     676  CSSSaddleBrown:= BlueGreenRedToBGRA(19, 69, 139);
     677  CSSSienna:= BlueGreenRedToBGRA(45, 82, 160);
     678  CSSBrown:= BlueGreenRedToBGRA(42, 42, 165);
     679  CSSMaroon:= BlueGreenRedToBGRA(0, 0, 128);
     680
     681  //White colors
     682  CSSWhite:= BlueGreenRedToBGRA(255, 255, 255);
     683  CSSSnow:= BlueGreenRedToBGRA(250, 250, 255);
     684  CSSHoneydew:= BlueGreenRedToBGRA(240, 255, 250);
     685  CSSMintCream:= BlueGreenRedToBGRA(250, 255, 245);
     686  CSSAzure:= BlueGreenRedToBGRA(255, 255, 240);
     687  CSSAliceBlue:= BlueGreenRedToBGRA(255, 248, 240);
     688  CSSGhostWhite:= BlueGreenRedToBGRA(255, 248, 248);
     689  CSSWhiteSmoke:= BlueGreenRedToBGRA(245, 245, 245);
     690  CSSSeashell:= BlueGreenRedToBGRA(255, 245, 238);
     691  CSSBeige:= BlueGreenRedToBGRA(220, 245, 245);
     692  CSSOldLace:= BlueGreenRedToBGRA(230, 245, 253);
     693  CSSFloralWhite:= BlueGreenRedToBGRA(240, 250, 255);
     694  CSSIvory:= BlueGreenRedToBGRA(240, 255, 255);
     695  CSSAntiqueWhite:= BlueGreenRedToBGRA(215, 235, 250);
     696  CSSLinen:= BlueGreenRedToBGRA(230, 240, 250);
     697  CSSLavenderBlush:= BlueGreenRedToBGRA(245, 240, 255);
     698  CSSMistyRose:= BlueGreenRedToBGRA(255, 228, 255);
     699
     700  //Gray colors
     701  CSSGainsboro:= BlueGreenRedToBGRA(220, 220, 220);
     702  CSSLightGray:= BlueGreenRedToBGRA(211, 211, 211);
     703  CSSSilver:= BlueGreenRedToBGRA(192, 192, 192);
     704  CSSDarkGray:= BlueGreenRedToBGRA(169, 169, 169);
     705  CSSGray:= BlueGreenRedToBGRA(128, 128, 128);
     706  CSSDimGray:= BlueGreenRedToBGRA(105, 105, 105);
     707  CSSLightSlateGray:= BlueGreenRedToBGRA(153, 136, 119);
     708  CSSSlateGray:= BlueGreenRedToBGRA(144, 128, 112);
     709  CSSDarkSlateGray:= BlueGreenRedToBGRA(79, 79, 47);
     710  CSSBlack:= BlueGreenRedToBGRA(0, 0, 0);
    202711
    203712  CSSColors := TBGRAColorList.Create;
     
    345854{$ENDIF}
    346855
     856{$IFDEF INCLUDE_FINAL}
     857{$UNDEF INCLUDE_FINAL}
     858  CSSColors.Free;
     859  VGAColors.Free;
     860{$ENDIF}
Note: See TracChangeset for help on using the changeset viewer.