[pascal]

function ClipByte(X: Integer): Byte;
begin
if X > 255 then
Result := 255
else if X < 0 then
Result := 0
else
Result := X;
end;

var
Color, DarkenedColor: TColor;
ColorInt: Integer;
R, G, B: Byte;
NewR, NewG, NewB: Byte;
DarkenBy: Byte;
begin
DarkenBy := 10;
ColorInt := ColorToRGB(Color);
R := GetRValue(ColorInt);
G := GetGValue(ColorInt);
B := GetBValue(ColorInt);
NewR := ClipByte(R - DarkenBy);
NewG := ClipByte(G - DarkenBy);
NewB := ClipByte(B - DarkenBy);
DarkenedColor := RGB(NewR, NewG, NewB);
end;

[/pascal]