[Truco Delphi] Intensidad de un Color por Porcentaje ?
Descripcion:
Bloque de codigo que contiene 2 funciones para dar o quitar intensidad por un porcentaje a un Color especificado.
//Color mas Oscuro function Dark(Col: TColor; Percent: Byte): TColor; var R, G, B: Byte; begin R := GetRValue(Col); G := GetGValue(Col); B := GetBValue(Col); R := Round(R*Percent/100); G := Round(G*Percent/100); B := Round(B*Percent/100); Result := RGB(R, G, B); end; //Color mas Claro function Light(Col: TColor; Percent: Byte): TColor; var R, G, B: Byte; begin R := GetRValue(Col); G := GetGValue(Col); B := GetBValue(Col); R := Round(R*Percent/100) + Round(255 - Percent/100*255); G := Round(G*Percent/100) + Round(255 - Percent/100*255); B := Round(B*Percent/100) + Round(255 - Percent/100*255); Result := RGB(R, G, B); end;