Optionalshade: Tailwind | "all"The hue family to return.
Optionalvalue: ScaleValuesThe tone value of the shade. Values are in incrementals of 100. For example numeric (100) and its string equivalent ('100') are valid.
import { colors } from "@skchr/color";
// We pass in red as the target hue.
// It returns a function that can be called with an optional value parameter
console.log(colors('red'));
// [
'#fef2f2', '#fee2e2',
'#fecaca', '#fca5a5',
'#f87171', '#ef4444',
'#dc2626', '#b91c1c',
'#991b1b', '#7f1d1d'
]
console.log(colors('red','900'));
// '#7f1d1d'
Returns TailwindCSS color value(s) from the default palette.
The function behaves as follows:
shadeandvalueparameters, it returns that color as a hex string. For example'blue'and'500'would return the equivalent ofblue-500.'all'parameter as theshade, it returns an array of colors from'050'to'900'for everyshade.shadeis'all'and thevalueis specified, it returns an array of colors at the specifiedvaluefor eachshade.To specify
'050'as a number you just pass50. Values are all valid as string or number for example'100'and100.