mirror of
https://github.com/imfing/hextra.git
synced 2025-07-07 13:27:17 -04:00
Add comment
This commit is contained in:
@ -3,13 +3,8 @@ const colors = require('tailwindcss/colors')
|
|||||||
const makePrimaryColor =
|
const makePrimaryColor =
|
||||||
l =>
|
l =>
|
||||||
({ opacityValue }) => {
|
({ opacityValue }) => {
|
||||||
// the `l` we get is the lightness value we want adjust. 0% is black, 100% is white, 50% is the midpoint
|
// we convert the passed in lightness value to a multiplier relative to 50% (full color)
|
||||||
// So we need to convert it to a percentage that is relative to 50% lightness
|
let finalLightness = 1 + ((l - 50) / 100);
|
||||||
// e.g if we get 45 that means we want to make the color 5% darker
|
|
||||||
// if we get 55 that means we want to make the color 5% lighter
|
|
||||||
// etc.
|
|
||||||
let finalLightness = Math.round((1 + ((l - 50) / 100)) * 1000) / 1000;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
`hsl(var(--primary-hue) var(--primary-saturation) calc(var(--primary-lightness) * ${finalLightness})` +
|
`hsl(var(--primary-hue) var(--primary-saturation) calc(var(--primary-lightness) * ${finalLightness})` +
|
||||||
(opacityValue ? ` / ${opacityValue})` : ')')
|
(opacityValue ? ` / ${opacityValue})` : ')')
|
||||||
|
Reference in New Issue
Block a user