Skip to content

pantoken / plugins/pantoken/colors/src / darken

Mahi: darken()

darken(color, percent?): string

Beta

Whakakāhorehia e percent ngā tohu māmā HSL — ko te whakaata CSS-anake o ui-color-utils darken (ka whakaiti a tinycolor i te māmā HSL). Ka whakamahi i te tūāhua tae whaitake kia tiakina te tae me te kohi.

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 %).

Ngā Tawhā

color

string

Te tae tūāpapa.

percent?

number = 10

Ngā tohu māmā hei tango (taunoa 10, e rite ana ki te taunoa o tinycolor).

Whakahokia

string

He kīanga tae whaitake hsl(from …).

Tauira

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