Skip to content

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

Fungsi: darken() ​

darken(color, percent?): string

Beta

Pergelapkan sebesar percent poin kecerahan HSL — cermin hanya-CSS dari ui-color-utils darken (tinycolor menurunkan kecerahan HSL). Menggunakan sintaks warna relatif sehingga rona dan saturasi tetap.

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 dasar.

percent? ​

number = 10

Poin kecerahan yang akan dikurangkan (default 10, sesuai dengan default tinycolor).

Mengembalikan ​

string

Sebuah ekspresi relative-color hsl(from …).

Contoh ​

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