"Yves Allaire" wrote in message
news:7328AD64EAFB6182E81EF88E9626A01B@in.WebX.maYIadrTaRb...
> Crude... allright, but can you tell me where you got this, I spent
> uncalculable hours to get colors from other aplications to match those of
> AutoCAD.
>
Here is some Delphi code that uses the values taken
from DRV\acad.ctb (from R14). If I recall correctly,
the colors are not totally accurate.
unit AcColor;
interface
Uses Windows, Graphics;
Function ACIToColor(ACI: Integer): TColor;
const acrgb : Array[0..255, 0..2] of Byte = (
(0, 0, 0),
(255, 0, 0),
(255, 255, 0),
(0, 255, 0),
(0, 255, 255),
(0, 0, 255),
(255, 0, 255),
(255, 255, 255),
(162, 162, 162),
(239, 239, 239),
(255, 0, 0),
(255, 191, 191),
(237, 0, 0),
(237, 161, 161),
(216, 0, 0),
(216, 130, 130),
(193, 0, 0),
(193, 98, 98),
(164, 0, 0),
(164, 82, 82),
(255, 63, 0),
(255, 207, 191),
(237, 59, 0),
(237, 180, 161),
(216, 54, 0),
(216, 151, 130),
(193, 48, 0),
(193, 121, 98),
(164, 41, 0),
(164, 102, 82),
(255, 127, 0),
(255, 223, 191),
(237, 118, 0),
(237, 199, 161),
(216, 108, 0),
(216, 173, 130),
(193, 96, 0),
(193, 145, 98),
(164, 82, 0),
(164, 123, 82),
(255, 191, 0),
(255, 239, 191),
(237, 177, 0),
(237, 218, 161),
(216, 162, 0),
(216, 195, 130),
(193, 144, 0),
(193, 169, 98),
(164, 123, 0),
(164, 143, 82),
(255, 255, 0),
(255, 255, 191),
(237, 237, 0),
(237, 237, 161),
(216, 216, 0),
(216, 216, 130),
(193, 193, 0),
(193, 193, 98),
(164, 164, 0),
(164, 164, 82),
(191, 255, 0),
(239, 255, 191),
(177, 237, 0),
(218, 237, 161),
(162, 216, 0),
(195, 216, 130),
(144, 193, 0),
(169, 193, 98),
(123, 164, 0),
(143, 164, 82),
(127, 255, 0),
(223, 255, 191),
(118, 237, 0),
(199, 237, 161),
(108, 216, 0),
(173, 216, 130),
(96, 193, 0),
(145, 193, 98),
(82, 164, 0),
(123, 164, 82),
(63, 255, 0),
(207, 255, 191),
(59, 237, 0),
(180, 237, 161),
(54, 216, 0),
(151, 216, 130),
(48, 193, 0),
(121, 193, 98),
(41, 164, 0),
(102, 164, 82),
(0, 255, 0),
(191, 255, 191),
(0, 237, 0),
(161, 237, 161),
(0, 216, 0),
(130, 216, 130),
(0, 193, 0),
(98, 193, 98),
(0, 164, 0),
(82, 164, 82),
(0, 255, 63),
(191, 255, 207),
(0, 237, 59),
(161, 237, 180),
(0, 216, 54),
(130, 216, 151),
(0, 193, 48),
(98, 193, 121),
(0, 164, 41),
(82, 164, 102),
(0, 255, 127),
(191, 255, 223),
(0, 237, 118),
(161, 237, 199),
(0, 216, 108),
(130, 216, 173),
(0, 193, 96),
(98, 193, 145),
(0, 164, 82),
(82, 164, 123),
(0, 255, 191),
(191, 255, 239),
(0, 237, 177),
(161, 237, 218),
(0, 216, 162),
(130, 216, 195),
(0, 193, 144),
(98, 193, 169),
(0, 164, 123),
(82, 164, 143),
(0, 255, 255),
(191, 255, 255),
(0, 237, 237),
(161, 237, 237),
(0, 216, 216),
(130, 216, 216),
(0, 193, 193),
(98, 193, 193),
(0, 164, 164),
(82, 164, 164),
(0, 191, 255),
(191, 239, 255),
(0, 177, 237),
(161, 218, 237),
(0, 162, 216),
(130, 195, 216),
(0, 144, 193),
(98, 169, 193),
(0, 123, 164),
(82, 143, 164),
(0, 127, 255),
(191, 223, 255),
(0, 118, 237),
(161, 199, 237),
(0, 108, 216),
(130, 173, 216),
(0, 96, 193),
(98, 145, 193),
(0, 82, 164),
(82, 123, 164),
(0, 63, 255),
(191, 207, 255),
(0, 59, 237),
(161, 180, 237),
(0, 54, 216),
(130, 151, 216),
(0, 48, 193),
(98, 121, 193),
(0, 41, 164),
(82, 102, 164),
(0, 0, 255),
(191, 191, 255),
(0, 0, 237),
(161, 161, 237),
(0, 0, 216),
(130, 130, 216),
(0, 0, 193),
(98, 98, 193),
(0, 0, 164),
(82, 82, 164),
(63, 0, 255),
(207, 191, 255),
(59, 0, 237),
(180, 161, 237),
(54, 0, 216),
(151, 130, 216),
(48, 0, 193),
(121, 98, 193),
(41, 0, 164),
(102, 82, 164),
(127, 0, 255),
(223, 191, 255),
(118, 0, 237),
(199, 161, 237),
(108, 0, 216),
(173, 130, 216),
(96, 0, 193),
(145, 98, 193),
(82, 0, 164),
(123, 82, 164),
(191, 0, 255),
(239, 191, 255),
(177, 0, 237),
(218, 161, 237),
(162, 0, 216),
(195, 130, 216),
(144, 0, 193),
(169, 98, 193),
(123, 0, 164),
(143, 82, 164),
(255, 0, 255),
(255, 191, 255),
(237, 0, 237),
(237, 161, 237),
(216, 0, 216),
(216, 130, 216),
(193, 0, 193),
(193, 98, 193),
(164, 0, 164),
(164, 82, 164),
(255, 0, 191),
(255, 191, 239),
(237, 0, 177),
(237, 161, 218),
(216, 0, 162),
(216, 130, 195),
(193, 0, 144),
(193, 98, 169),
(164, 0, 123),
(164, 82, 143),
(255, 0, 127),
(255, 191, 223),
(237, 0, 118),
(237, 161, 199),
(216, 0, 108),
(216, 130, 173),
(193, 0, 96),
(193, 98, 145),
(164, 0, 82),
(164, 82, 123),
(255, 0, 63),
(255, 191, 207),
(237, 0, 59),
(237, 161, 180),
(216, 0, 54),
(216, 130, 151),
(193, 0, 48),
(193, 98, 121),
(164, 0, 41),
(164, 82, 102),
(93, 93, 93),
(162, 162, 162),
(210, 210, 210),
(239, 239, 239),
(252, 252, 252),
(255, 255, 255)
);
var
AcColors : Array [0..255] of TColor;
i : integer;
implementation
Function ACIToColor(ACI: Integer): TColor;
begin
If ACI < 256 then
Result := AcColors[ACI]
else
Result := clNone;
end;
// Set to white for dark background or black for light background
Procedure SetColor7(r, g, b: byte);
begin
AcColors[7] := TColor(Rgb(r, g, b));
end;
Procedure SetLightBackground;
begin
AcColors[7] := clBlack;
end;
Procedure SetDarkBackground;
begin
AcColors[7] := clWhite;
end;
initialization
begin
For i := 0 to 255 do
AcColors := TColor(rgb(acrgb[i, 0], acrgb[i,1], acrgb[i,2]));
end;
end.