0 Members and 1 Guest are viewing this topic.
function RandomColor: longint;var Ran, i: byte; Cchr: array [1..6] of char; CharColor: string;begin for i := 1 to 6 do begin Ran := Random(1, 15); case Ran of 1: begin Cchr[i] := '1'; end; 2: begin Cchr[i] := '2'; end; 3: begin Cchr[i] := '3'; end; 4: begin Cchr[i] := '4'; end; 5: begin Cchr[i] := '5'; end; 6: begin Cchr[i] := '6'; end; 7: begin Cchr[i] := '7'; end; 8: begin Cchr[i] := '8'; end; 9: begin Cchr[i] := '9'; end; 10: begin Cchr[i] := 'A'; end; 11: begin Cchr[i] := 'B'; end; 12: begin Cchr[i] := 'C'; end; 13: begin Cchr[i] := 'D'; end; 14: begin Cchr[i] := 'E'; end; 15: begin Cchr[i] := 'F'; end; end; end; CharColor := Cchr[1]+Cchr[2]+Cchr[3]+Cchr[4]+Cchr[5]+Cchr[6]; Result := strtoint('$'+CharColor);end;
function CRandom():longint;begin result:=rgb(random(0,256),random(0,256),random(0,256));end;
And then convert it to a hexidecimal, that's the whole point of this, to make a random hexidecimal.
Mind explaining why would one rather complicate things and generate a random hex color instead of simply using As de Espada's method, if the ultimate purpose of it was to get an opaque color?
Quote from: Toumaz on July 23, 2008, 02:03:23 amMind explaining why would one rather complicate things and generate a random hex color instead of simply using As de Espada's method, if the ultimate purpose of it was to get an opaque color?for WriteConsole's Hex color, I would use As de Espada's for DrawText or something that uses RGB.