
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
tailwind-hsluv
Advanced tools
This package is made to experiment with the HSLuv/HPLuv color space which should be better for UI design. It's technically just a helper function which using the hsluv library to generate the color variants for TailwindCSS.
NEW: From 0.1.4 this package is usable as Tailwind CSS plugin.
Steve Schoger made a beautiful color palette in Tailwind CSS, but:
The difference between HSL and HSLuv/HPLuv/CIELUV color spaces is the lightness value based on the human eye instead of how the monitor mixing the colors. With HSLuv we can generate the color variations based on the perceived lightness.
You can read about these here:
The HSLuv library made by Alexei Boronine
The Color name list came from the Name that color library
npm i tailwind-hsluv
# or
yarn add tailwind-hsluv
The generateColors function accepts colors as string or array:
"#RRGGBB" or "#CCC""Eastern Blue" or "Seaweed", etc. (1)[255, 0, 0](1) The color name lookup is case-insensitive. You can find the color names in the source or you can pick one via the Name that color website.
// tailwind.config.js
const { hsluv } = require('tailwind-hsluv');
module.exports = {
// ...your other config...
plugins: [
hsluv({
superred: '#ff0000', // 6 digit hex color
grayscale: '#ccc', // / 3 digit hex color
blue: [ 0, 0, 255 ], // rgb array
green: 'green', // simple named color
mypurple: 'Jacksons Purple' // specific named color
}, {
step: 50, // default 100
hpluv: false, // use the HPLuv color space, default: false
}),
// ...your other plugins...
]
};
generateColors(colorMap, options): generates the colors for TailwindCSS.
Options:
| name | default | description |
|---|---|---|
| step | 100 | steps between the lightness values |
| hpluv | false | use the HPLuv color space (less saturated) |
Full example:
// tailwind.config.js
const { generateColors } = require('tailwind-hsluv');
module.exports = {
theme: {
extend: {
colors: generateColors({
superred: '#ff0000', // 6 digit hex color
grayscale: '#ccc', /// 3 digit hex color
blue: [0, 0, 255], // rgb array
green: 'green', // simple named color
mypurple: 'Jacksons Purple' // specific named color
}, {
step: 100, // steps between lightness variants, default: 100
hpluv: false // use the HPLuv color space, default: false
})
}
}
};
It will generate an object which usable for tailwind config, like this:
{
"red": {
"100": "#FFDADA",
"200": "#FFB3B3",
"300": "#FF8888",
"400": "#FF5353",
"500": "#EF0000",
"600": "#C00000",
"700": "#930000",
"800": "#690000",
"900": "#410000",
"default": "#FF0000"
},
"blue": {
// ...
},
// another colors...
}
The "text" texts are colored with grayscale hsl(0, 0%, 10%-90%) and each of the boxes have a background color lightness variant from 100 to 900.
If the text lightness is closer to the background color lightness you less likely can see the difference between them.

See CHANGELOG.md (since 0.1.4), and CHANGELOG-old.md (before 0.1.4)
Copyright © 2020 Kövesdi György
Licensed under the MIT License.
FAQs
HSLuv/HPLuv color space for TailwindCSS
We found that tailwind-hsluv demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.