Skip to content

pantoken-root / plugins/pantoken/colors/src / darken

Fungsi: darken() ​

darken(color, percent?): string

Beta

Gelapkan sebanyak percent mata kecerahan HSL — cermin berasaskan CSS bagi ui-color-utils darken (tinycolor mengurangkan kecerahan HSL). Menggunakan sintaks warna relatif supaya rona dan ketepuan dikekalkan.

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

Parameter ​

color ​

string

Warna asas.

percent? ​

number = 10

Mata kecerahan yang akan ditolak (lalai 10, sepadan dengan lalai tinycolor).

Mengembalikan ​

string

Satu ungkapan warna-relatif hsl(from …).

Contoh ​

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