How do I create custom colors?

I do not like the color for the clRed, nor the clMaroon. I want a red that is the same color as this hex value: #AA0000.

This will help a lot to make the form look exactly how I planned it.

Thanks,

Recommended Answers

All 2 Replies

I worked out a solution
create a new winapps,put a panel and a button and an editbox onto the form

unit colors_in_hex;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    Panel1: TPanel;
    GroupBox1: TGroupBox;
    Edit1: TEdit;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var hexnum:String;
    res:Integer;
const
  HexValues='0123456789ABCDEF';
function HexToInt(Hex: string): integer;
var
  i: integer;
begin
  Result := 0;
  case Length(Hex) of
    0: Result := 0;
    1..8: for i:=1 to Length(Hex) do
      Result := 16*Result + Pos(Upcase(Hex[i]), HexValues)-1;
    else for i:=1 to 8 do
      Result := 16*Result + Pos(Upcase(Hex[i]), HexValues)-1;
  end;
end;


begin
  hexnum:=Edit1.Text;
  res:=hextoint(hexnum);
  Panel1.Color:=res;
end;

end.

when you done then write a number to the edit box and press the button

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.