Tiny Random Color Generator In JavaScript – randomColor.js
The random colors generated from randomColor.js are attractive and beautiful and can be used to colorize backgrounds, create buttons, or really anything that stands out. It takes the guesswork out of creating a nice color scheme for your next project.
1. Install & import the randomColor.js.
# NPM $ npm i randomcolor
// CommonJS
var randomColor = require('randomcolor');
// CDN
<script src="https://cdn.jsdelivr.net/npm/randomcolor@0.6.2/randomColor.min.js"></script> 2. Generate a random color (hex).
randomColor(); // => #ff0000
3. Specify the number of colors to generate.
randomColor({
count: 20
}); 4. Set the hue of the colors: red, orange, yellow, green, blue, purple, pink, or monochrome.
randomColor({
hue: 'red',
}); 5. Set the luminosity of the colors: bright, light, or dark.
randomColor({
luminosity: 'dark',
}); 6. Set the color format: rgb, rgba, rgbArray, hsl, hsla, hslArray, or hex
randomColor({
format: 'rgba',
}); 7. Set the alpha channel, which specifies the opacity for an RGBA or HSLA color.
randomColor({
alpha: 0.5,
}); 8. Set the seed (seed) that will cause randomColor to return the same color each time.
randomColor({
seed: 3,
}); v0.6.2 (12/03/2025)
The post Tiny Random Color Generator In JavaScript – randomColor.js appeared first on CSS Script.
FORT WAYNE IND. (WOWO) One man is dead following a fiery early-morning crash at Lafayette…
The Hunt For Ben Solo fan campaign is still going, and its latest stunt saw…
Daemons, seasonal powers, and giants are what you can expect this spring anime season. There's…
This website uses cookies.