Skip to content

pantoken / plugins/pantoken/colors/src / lighten

函式: lighten()

lighten(color, percent?): string

Beta(測試)

將 HSL 明度提高 percent 點 — ui-color-utils lighten 的僅 CSS 對應實作 (tinycolor 提升 HSL 明度)。使用相對色彩語法以保留色相與飽和度。

參數

color

string

基礎顏色。

percent?

number = 10

要增加的明度點數(預設 10,與 tinycolor 的預設相符)。

回傳

string

一個 hsl(from …) 相對色彩表達式。

範例

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