- make options optional
This commit is contained in:
parent
4007bd3352
commit
64d7dc61ee
@ -7,22 +7,22 @@ const countDecimals = (value) => {
|
|||||||
|
|
||||||
const generateColorShades = (
|
const generateColorShades = (
|
||||||
colors: { [key: string]: string },
|
colors: { [key: string]: string },
|
||||||
options: {
|
options?: {
|
||||||
keyList?: string[];
|
keyList?: string[];
|
||||||
opacities?: number[];
|
opacities?: number[];
|
||||||
outputType: "obj" | "cssVars";
|
outputType: "obj" | "cssVars";
|
||||||
}
|
}
|
||||||
) => {
|
) => {
|
||||||
const colorKeys = options.keyList
|
const colorKeys = options?.keyList
|
||||||
? Object.keys(colors)
|
? Object.keys(colors).filter((key) => options.keyList?.includes(key))
|
||||||
: Object.keys(colors).filter((key) => options.keyList?.includes(key));
|
: Object.keys(colors);
|
||||||
|
|
||||||
const generatedColorShadesArr: object[] = [];
|
const generatedColorShadesArr: object[] = [];
|
||||||
|
|
||||||
colorKeys.forEach((key) => {
|
colorKeys.forEach((key) => {
|
||||||
const colorString = colors[key];
|
const colorString = colors[key];
|
||||||
|
|
||||||
const opacities = options.opacities
|
const opacities = options?.opacities
|
||||||
? options.opacities
|
? options.opacities
|
||||||
: [0.1, 0.25, 0.5, 0.75];
|
: [0.1, 0.25, 0.5, 0.75];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user