mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
fix: Color.darken fix
This commit is contained in:
@ -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)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user