Skip to content

pantoken / plugins/pantoken/colors/src / darken

関数: darken()

darken(color, percent?): string

ベータ

HSLの明度をpercentポイント暗くする — ui-color-utils darken のCSSのみのミラー。 (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))"