TIEColorPalette provides two ways to access the color palette: ◼As an array of TRGB (via Palette) ◼As a stringlist of TColor or RGB values
Colors assumes each line contains one of the following formats: ◼A Delphi const, such as clRed, clBlue, clNone or clTransparent ◼A hex value such as $000000FF (red) or $00FF0000 (blue) ◼R, G and B values separated by a space, e.g. '255 0 0' (red) or '0 0 255' (blue)
Note: You can use 'clTransparent' to specify a transparent/alpha value
// DISPLAY A COLOR SET ColorPalette1.Colors.text := 'clRed' + #13#10 + 'clYellow' + #13#10 + 'clBlue' + #13#10 + 'clWhite' + #13#10 + 'clBlack' + #13#10 + 'clGray';
// ASSIGN A PALETTE FROM A FILE CONTAINING COLOR VALUES var ssFile: TStringList; begin ssFile := TStringList.Create; ssFile.LoadFromFile( 'D:\MyColors.txt' ); IEColorPalette1.Colors := ssFile; ssFile.Free; end;
// ASSIGN A PALETTE FROM A DATABASE THAT CONTAINING A COLOR COLUMN var ss: TStringList; i: integer; begin ss := TStringList.Create; tblColorList.First; While not tblColorList.EOF do begin ss.Add( ColorToString( tblColorListColor.AsInteger )); tblColorList.Next; end; IEColorPalette1.Colors := ss; ss.Free; end;