Skip to content

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

फंक्शन: darken() ​

darken(color, percent?): string

बीटा

HSL-लाइटनेस के percent अंक तक गहरा करें — ui-color-utils darken का केवल CSS मिरर (tinycolor HSL लाइटनेस घटाता है)। सापेक्ष रंग सिंटैक्स का उपयोग करता है ताकि ह्यू और संतृप्ति संरक्षित रहें।

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