Увеличить-уменьшить яркость цвета

15:39
function Darker(Color: TColor; Percent: Byte): TColor;
var r, g, b: Byte;
begin Color := ColorToRGB(Color);
r := GetRValue(Color);
g := GetGValue(Color);
b := GetBValue(Color);
r := r - muldiv(r, Percent, 100);
//процент% уменьшения яркости
g := g - muldiv(g, Percent, 100);
b := b - muldiv(b, Percent, 100);
result := RGB(r, g, b);
end;
 
function Lighter(Color: TColor; Percent: Byte): TColor;
var r, g, b: Byte;
begin
Color := ColorToRGB(Color);
r := GetRValue(Color);
g := GetGValue(Color);
b := GetBValue(Color);
r := r + muldiv(255 - r, Percent, 100);
//процент% увеличения яркости
g := g + muldiv(255 - g, Percent, 100);
b := b + muldiv(255 - b, Percent, 100);
result := RGB(r, g, b);
end;