antd-color-editor
Version:
An open-source color editor for designing color system
43 lines (41 loc) • 1.68 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/utils/genScaleTestList.ts
var genScaleTestList_exports = {};
__export(genScaleTestList_exports, {
default: () => genScaleTestList_default
});
module.exports = __toCommonJS(genScaleTestList_exports);
var genScaleTestList = (scales, color) => {
const lightColor = color[0];
const darkColor = color[1] || color[0];
const colorLength = scales.light.length - 1;
const colorsTest = [
[lightColor, "#fff"],
[scales.light[colorLength], scales.light[0]],
colorLength >= 4 && [scales.light[colorLength - 1], scales.light[1]],
[scales.light[colorLength], lightColor],
// dark
[darkColor, "#000"],
[scales.dark[colorLength], scales.dark[0]],
scales.dark.length >= 4 && [scales.dark[colorLength - 1], scales.dark[1]],
[scales.dark[colorLength], darkColor]
].filter(Boolean);
return colorsTest;
};
var genScaleTestList_default = genScaleTestList;