Skip to content

pantoken / plugins/pantoken/colors/src / darken

פונקציה: darken()

darken(color, percent?): string

בטא

הכהה ב־percent נקודות בהירות HSL — המקבילה ב־CSS בלבד ל־ui-color-utils darken (tinycolor מקטין את בהירות ה־HSL). משתמש בתחביר צבע יחסי כך שהטון והרוויה נשמרים.

In relative hsl(), the l channel resolves to a <number> on the 0–100 scale — the same scale tinycolor's amount uses — so the points are subtracted directly (no %).

פרמטרים

color

string

צבע הבסיס.

percent?

number = 10

נקודות בהירות לחיסור (ברירת מחדל 10, תואם לברירת המחדל של tinycolor).

מחזיר

string

ביטוי צבע יחסי hsl(from …).

דוגמה

ts
darken("var(--brand)", 10); // "hsl(from var(--brand) h s calc(l - 10))"