Skip to content

pantoken / plugins/pantoken/colors/src / darken

함수: darken()

darken(color, percent?): string

베타

HSL 밝기 값을 percent만큼 어둡게 — ui-color-utils darken의 CSS 전용 미러입니다 (tinycolor는 HSL 밝기를 낮춥니다). 색상(색상(hue)과 채도)은 유지되도록 상대 색상 구문을 사용합니다.

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))"