fix: Color.darken fix

This commit is contained in:
Martin Guillon
2021-08-22 14:06:20 +02:00
parent 121ea164e4
commit 394209e3f6

View File

@ -363,7 +363,7 @@ export class Color implements definition.Color {
public darken(amount: number) { public darken(amount: number) {
amount = amount === 0 ? 0 : amount || 10; amount = amount === 0 ? 0 : amount || 10;
const hsl = rgbToHsl(this.r / 255, this.g / 255, this.b / 255); const hsl = rgbToHsl(this.r / 255, this.g / 255, this.b / 255);
return Color.fromHSL(this.a, hsl.h * 360, hsl.s * 100, Math.min(100, Math.max(0, hsl.l - amount))); return Color.fromHSL(this.a, hsl.h * 360, hsl.s * 100, Math.min(100, Math.max(0, hsl.l * 100 - amount)));
} }
/** /**