We help you use color.
version | node version |
---|---|
1.0.0+ | 14+ |
# npm
$ npm install --save colors-helper-tools
# yarn
$ yarn add colors-helper-tools
$ npm run test
- you can get random colors with cli
npx cht -h
type Color = {
red: number;
green: number;
blue: number;
};
- hex color string to rgb object
- make number to hex string
- make numbers to hex color string
- get complementary color hex string
- get complementary color object
export enum RandomColorType {
red = 'red',
green = 'green',
blue = 'blue',
all = 'all',
}
- get random color hex string
- give params (red, green, blue) to get concrete random color hex
- get random color object
- give params (red, green, blue) to get concrete random color object
- get random pastel tone color
- return Color type
- get random pastel tone color
- return hex string
- get random neutral tone color
- return Color type
- get random neutral tone color
- return hex string
- Returns a generator function that sequentially intensifies the returned Color object
const fn = getColorByStepRgbGen(50)(); // generator
for (let i = 0; i < 10; i++) {
console.log(fn.next().value); // Color object
}
- Returns a generator function that sequentially intensifies the returned color hex string
const fn = getColorByStepHexGen(50)(); // generator
for (let i = 0; i < 10; i++) {
console.log(fn.next().value); // hex string
}
- You can use getColorByStepRgbGen without understanding generator functions.
const fn = getColorByStepRgb(50); // function
for (let i = 0; i < 10; i++) {
console.log(fn()); // Color object
}
- You can use getColorByStepHexGen without understanding generator functions.
const fn = getColorByStepHex(50); // function
for (let i = 0; i < 10; i++) {
console.log(fn()); // hex string
}
- git push github action config example