micro-optimize colorConverter.parse
#hex, named colors: 15x faster rgb() and other functions: 1.6x faster
This commit is contained in:
parent
0128489bbb
commit
540e2af62c
|
@ -1,32 +1,23 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const colorConverter = (() => {
|
const colorConverter = (NAMED_COLORS => {
|
||||||
|
|
||||||
const RXS_NUM = /\s*([+-]?(?:\d+\.?\d*|\d*\.\d+))(?:e[+-]?\d+)?/.source;
|
// All groups in RXS_NUM must use ?: in order to enable \1 in RX_COLOR.rgb
|
||||||
const RXS_NUM_ANGLE = `${RXS_NUM}(deg|g?rad|turn)?`;
|
const RXS_NUM = /\s*[+-]?(\.\d+|\d+(\.\d*)?)(e[+-]?\d+)?/.source.replace(/\(/g, '(?:');
|
||||||
|
const RXS_ANGLE = '(?:deg|g?rad|turn)?';
|
||||||
|
const expandRe = re => RegExp(re.source.replace(/N/g, RXS_NUM).replace(/A/g, RXS_ANGLE), 'iy');
|
||||||
const RX_COLOR = {
|
const RX_COLOR = {
|
||||||
hex: /#([a-f\d]{3}(?:[a-f\d](?:[a-f\d]{2}){0,2})?)\b/iy,
|
hex: /#([a-f\d]{3}(?:[a-f\d](?:[a-f\d]{2}){0,2})?)\b/iy,
|
||||||
|
|
||||||
hsl: new RegExp([
|
|
||||||
// num_or_angle, pct, pct [ , num_or_pct]?
|
// num_or_angle, pct, pct [ , num_or_pct]?
|
||||||
`^(${RXS_NUM_ANGLE})\\s*,(${RXS_NUM}%\\s*(,|$)){2}(${RXS_NUM}%?)?\\s*$`,
|
|
||||||
// num_or_angle pct pct [ / num_or_pct]?
|
// num_or_angle pct pct [ / num_or_pct]?
|
||||||
`^(${RXS_NUM_ANGLE})\\s+(${RXS_NUM}%\\s*(\\s|$)){2}(/${RXS_NUM}%?)?\\s*$`,
|
hsl: expandRe(/^NA(\s*(,N%\s*){2}(,N%?\s*)?|(\s+N%){2}\s*(\/N%?\s*)?)$/),
|
||||||
].join('|'), 'iy'),
|
// num_or_angle|none pct|none pct|none [ / num_or_pct|none ]?
|
||||||
|
hwb: expandRe(/^(NA|none)(\s+(N%|none)){2}\s*(\/(N%?|none)\s*)?$/),
|
||||||
hwb: new RegExp(
|
|
||||||
// num|angle|none pct|none pct|none [ / num|pct|none ]?
|
|
||||||
`^(${RXS_NUM_ANGLE}|none)(\\s+(${RXS_NUM}%|none)){2}(\\s+|$)(/${RXS_NUM}%?|none)?\\s*$`,
|
|
||||||
'iy'),
|
|
||||||
|
|
||||||
rgb: new RegExp([
|
|
||||||
// num, num, num [ , num_or_pct]?
|
// num, num, num [ , num_or_pct]?
|
||||||
// pct, pct, pct [ , num_or_pct]?
|
// pct, pct, pct [ , num_or_pct]?
|
||||||
`^((${RXS_NUM}\\s*(,|$)){3}|(${RXS_NUM}%\\s*(,|$)){3})(${RXS_NUM}%?)?\\s*$`,
|
|
||||||
// num num num [ / num_or_pct]?
|
// num num num [ / num_or_pct]?
|
||||||
// pct pct pct [ / num_or_pct]?
|
// pct pct pct [ / num_or_pct]?
|
||||||
`^((${RXS_NUM}\\s*(\\s|$)){3}|(${RXS_NUM}%\\s*(\\s|$)){3})(/${RXS_NUM}%?)?\\s*$`,
|
rgb: expandRe(/^N(%?)(\s*,N\1\s*,N\1\s*(,N%?\s*)?|\s+N\1\s+N\1\s*(\/N%?\s*)?)$/),
|
||||||
].join('|'), 'iy'),
|
|
||||||
};
|
};
|
||||||
const ANGLE_TO_DEG = {
|
const ANGLE_TO_DEG = {
|
||||||
grad: 360 / 400,
|
grad: 360 / 400,
|
||||||
|
@ -51,6 +42,7 @@ const colorConverter = (() => {
|
||||||
'v' in c ? 'hsv' :
|
'v' in c ? 'hsv' :
|
||||||
'l' in c ? 'hsl' :
|
'l' in c ? 'hsl' :
|
||||||
undefined;
|
undefined;
|
||||||
|
let HEX;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
parse,
|
parse,
|
||||||
|
@ -64,8 +56,8 @@ const colorConverter = (() => {
|
||||||
snapToInt,
|
snapToInt,
|
||||||
testAt,
|
testAt,
|
||||||
ALPHA_DIGITS: 3,
|
ALPHA_DIGITS: 3,
|
||||||
|
NAMED_COLORS,
|
||||||
RX_COLOR,
|
RX_COLOR,
|
||||||
// NAMED_COLORS is added below
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function format(color = '', type = color.type, {hexUppercase, usoMode, round} = {}) {
|
function format(color = '', type = color.type, {hexUppercase, usoMode, round} = {}) {
|
||||||
|
@ -95,45 +87,57 @@ const colorConverter = (() => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function parse(str) {
|
function parse(s) {
|
||||||
if (typeof str !== 'string') return;
|
if (typeof s !== 'string' || !(s = s.trim())) {
|
||||||
str = str.trim().toLowerCase();
|
return;
|
||||||
if (!str) return;
|
} else if (s[0] === '#') {
|
||||||
|
return parseHex(s);
|
||||||
if (str[0] !== '#' && !str.includes('(')) {
|
} else if (s.endsWith(')') && (s = s.match(/^(hwb|(hsl|rgb)a?)\(\s*([^)]+)/i))) {
|
||||||
// eslint-disable-next-line no-use-before-define
|
return parseFunc((s[2] || s[1]).toLowerCase(), s[3]);
|
||||||
str = colorConverter.NAMED_COLORS.get(str);
|
} else {
|
||||||
if (!str) return;
|
return colorConverter.NAMED_COLORS.get(s.toLowerCase());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str[0] === '#') {
|
function initHexMap() {
|
||||||
if (!testAt(RX_COLOR.hex, 0, str)) {
|
HEX = Array(256).fill(-0xFFFF); // ensuring a PACKED_SMI array
|
||||||
|
for (let i = 48; i < 58; i++) HEX[i] = i - 48; // 0123456789
|
||||||
|
for (let i = 65; i < 71; i++) HEX[i] = i - 65 + 10; // ABCDEF
|
||||||
|
for (let i = 97; i < 103; i++) HEX[i] = i - 97 + 10; // abcdef
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseHex(str) {
|
||||||
|
if (!HEX) initHexMap();
|
||||||
|
let r, g, b, a;
|
||||||
|
const len = str.length;
|
||||||
|
if (len === 4 || len === 5
|
||||||
|
? (r = HEX[str.charCodeAt(1)] * 0x11) >= 0 &&
|
||||||
|
(g = HEX[str.charCodeAt(2)] * 0x11) >= 0 &&
|
||||||
|
(b = HEX[str.charCodeAt(3)] * 0x11) >= 0 &&
|
||||||
|
(len < 5 || (a = HEX[str.charCodeAt(4)] * 0x11 / 255) >= 0)
|
||||||
|
: (len === 7 || len === 9) &&
|
||||||
|
(r = HEX[str.charCodeAt(1)] * 0x10 + HEX[str.charCodeAt(2)]) >= 0 &&
|
||||||
|
(g = HEX[str.charCodeAt(3)] * 0x10 + HEX[str.charCodeAt(4)]) >= 0 &&
|
||||||
|
(b = HEX[str.charCodeAt(5)] * 0x10 + HEX[str.charCodeAt(6)]) >= 0 &&
|
||||||
|
(len < 9 || (a = (HEX[str.charCodeAt(7)] * 0x10 + HEX[str.charCodeAt(8)]) / 255) >= 0)
|
||||||
|
) {
|
||||||
|
return {type: 'hex', r, g, b, a};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseFunc(type, val) {
|
||||||
|
if (!testAt(RX_COLOR[type], 0, val)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
str = str.slice(1);
|
// Not using destructuring because it's slow
|
||||||
const [r, g, b, a = 255] = str.length <= 4 ?
|
const parts = val.trim().split(/\s*[,/]\s*|\s+/);
|
||||||
str.match(/(.)/g).map(c => parseInt(c + c, 16)) :
|
const n1 = parseFloat(parts[0]);
|
||||||
str.match(/(..)/g).map(c => parseInt(c, 16));
|
const n2 = parseFloat(parts[1]);
|
||||||
return {
|
const n3 = parseFloat(parts[2]);
|
||||||
type: 'hex',
|
const nA = parseFloat(parts[3]);
|
||||||
r,
|
const a = isNaN(nA) ? undefined : constrain(0, 1, parts[3].endsWith('%') ? nA / 100 : nA);
|
||||||
g,
|
|
||||||
b,
|
|
||||||
a: a === 255 ? undefined : a / 255,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const [, func, type = func, value] = str.match(/^((rgb|hsl)a?|hwb)\(\s*(.*?)\s*\)|$/);
|
|
||||||
if (!func || !testAt(RX_COLOR[type], 0, value)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const strings = value.split(/\s*[,/]\s*|\s+/);
|
|
||||||
const [s1, /*s2*/, /*s3*/, sA] = strings;
|
|
||||||
const [n1, n2, n3, nA] = strings.map(parseFloat);
|
|
||||||
const a = isNaN(nA) ? 1 : constrain(0, 1, nA / (sA.endsWith('%') ? 100 : 1));
|
|
||||||
|
|
||||||
if (type === 'rgb') {
|
if (type === 'rgb') {
|
||||||
const k = s1.endsWith('%') ? 2.55 : 1;
|
const k = parts[0].endsWith('%') ? 2.55 : 1;
|
||||||
return {
|
return {
|
||||||
type,
|
type,
|
||||||
r: constrain(0, 255, Math.round(n1 * k)),
|
r: constrain(0, 255, Math.round(n1 * k)),
|
||||||
|
@ -142,8 +146,7 @@ const colorConverter = (() => {
|
||||||
a,
|
a,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
const h = constrainHue(n1 * (ANGLE_TO_DEG[parts[0].match(/\D*$/)[0].toLowerCase()] || 1));
|
||||||
const h = constrainHue(n1 * (ANGLE_TO_DEG[s1.match(/\D*$/)[0]] || 1));
|
|
||||||
const n2c = constrain(0, 100, n2 || 0);
|
const n2c = constrain(0, 100, n2 || 0);
|
||||||
const n3c = constrain(0, 100, n3 || 0);
|
const n3c = constrain(0, 100, n3 || 0);
|
||||||
return type === 'hwb'
|
return type === 'hwb'
|
||||||
|
@ -268,157 +271,154 @@ const colorConverter = (() => {
|
||||||
rx.lastIndex = index;
|
rx.lastIndex = index;
|
||||||
return rx.test(text);
|
return rx.test(text);
|
||||||
}
|
}
|
||||||
})();
|
})(new Map([
|
||||||
|
['transparent', {r: 0, g: 0, b: 0, a: 0, type: 'rgb'}],
|
||||||
colorConverter.NAMED_COLORS = new Map([
|
['aliceblue', {r: 240, g: 248, b: 255, type: 'hex'}],
|
||||||
['transparent', 'rgba(0, 0, 0, 0)'],
|
['antiquewhite', {r: 250, g: 235, b: 215, type: 'hex'}],
|
||||||
// CSS4 named colors
|
['aqua', {r: 0, g: 255, b: 255, type: 'hex'}],
|
||||||
['aliceblue', '#f0f8ff'],
|
['aquamarine', {r: 127, g: 255, b: 212, type: 'hex'}],
|
||||||
['antiquewhite', '#faebd7'],
|
['azure', {r: 240, g: 255, b: 255, type: 'hex'}],
|
||||||
['aqua', '#00ffff'],
|
['beige', {r: 245, g: 245, b: 220, type: 'hex'}],
|
||||||
['aquamarine', '#7fffd4'],
|
['bisque', {r: 255, g: 228, b: 196, type: 'hex'}],
|
||||||
['azure', '#f0ffff'],
|
['black', {r: 0, g: 0, b: 0, type: 'hex'}],
|
||||||
['beige', '#f5f5dc'],
|
['blanchedalmond', {r: 255, g: 235, b: 205, type: 'hex'}],
|
||||||
['bisque', '#ffe4c4'],
|
['blue', {r: 0, g: 0, b: 255, type: 'hex'}],
|
||||||
['black', '#000000'],
|
['blueviolet', {r: 138, g: 43, b: 226, type: 'hex'}],
|
||||||
['blanchedalmond', '#ffebcd'],
|
['brown', {r: 165, g: 42, b: 42, type: 'hex'}],
|
||||||
['blue', '#0000ff'],
|
['burlywood', {r: 222, g: 184, b: 135, type: 'hex'}],
|
||||||
['blueviolet', '#8a2be2'],
|
['cadetblue', {r: 95, g: 158, b: 160, type: 'hex'}],
|
||||||
['brown', '#a52a2a'],
|
['chartreuse', {r: 127, g: 255, b: 0, type: 'hex'}],
|
||||||
['burlywood', '#deb887'],
|
['chocolate', {r: 210, g: 105, b: 30, type: 'hex'}],
|
||||||
['cadetblue', '#5f9ea0'],
|
['coral', {r: 255, g: 127, b: 80, type: 'hex'}],
|
||||||
['chartreuse', '#7fff00'],
|
['cornflowerblue', {r: 100, g: 149, b: 237, type: 'hex'}],
|
||||||
['chocolate', '#d2691e'],
|
['cornsilk', {r: 255, g: 248, b: 220, type: 'hex'}],
|
||||||
['coral', '#ff7f50'],
|
['crimson', {r: 220, g: 20, b: 60, type: 'hex'}],
|
||||||
['cornflowerblue', '#6495ed'],
|
['cyan', {r: 0, g: 255, b: 255, type: 'hex'}],
|
||||||
['cornsilk', '#fff8dc'],
|
['darkblue', {r: 0, g: 0, b: 139, type: 'hex'}],
|
||||||
['crimson', '#dc143c'],
|
['darkcyan', {r: 0, g: 139, b: 139, type: 'hex'}],
|
||||||
['cyan', '#00ffff'],
|
['darkgoldenrod', {r: 184, g: 134, b: 11, type: 'hex'}],
|
||||||
['darkblue', '#00008b'],
|
['darkgray', {r: 169, g: 169, b: 169, type: 'hex'}],
|
||||||
['darkcyan', '#008b8b'],
|
['darkgrey', {r: 169, g: 169, b: 169, type: 'hex'}],
|
||||||
['darkgoldenrod', '#b8860b'],
|
['darkgreen', {r: 0, g: 100, b: 0, type: 'hex'}],
|
||||||
['darkgray', '#a9a9a9'],
|
['darkkhaki', {r: 189, g: 183, b: 107, type: 'hex'}],
|
||||||
['darkgrey', '#a9a9a9'],
|
['darkmagenta', {r: 139, g: 0, b: 139, type: 'hex'}],
|
||||||
['darkgreen', '#006400'],
|
['darkolivegreen', {r: 85, g: 107, b: 47, type: 'hex'}],
|
||||||
['darkkhaki', '#bdb76b'],
|
['darkorange', {r: 255, g: 140, b: 0, type: 'hex'}],
|
||||||
['darkmagenta', '#8b008b'],
|
['darkorchid', {r: 153, g: 50, b: 204, type: 'hex'}],
|
||||||
['darkolivegreen', '#556b2f'],
|
['darkred', {r: 139, g: 0, b: 0, type: 'hex'}],
|
||||||
['darkorange', '#ff8c00'],
|
['darksalmon', {r: 233, g: 150, b: 122, type: 'hex'}],
|
||||||
['darkorchid', '#9932cc'],
|
['darkseagreen', {r: 143, g: 188, b: 143, type: 'hex'}],
|
||||||
['darkred', '#8b0000'],
|
['darkslateblue', {r: 72, g: 61, b: 139, type: 'hex'}],
|
||||||
['darksalmon', '#e9967a'],
|
['darkslategray', {r: 47, g: 79, b: 79, type: 'hex'}],
|
||||||
['darkseagreen', '#8fbc8f'],
|
['darkslategrey', {r: 47, g: 79, b: 79, type: 'hex'}],
|
||||||
['darkslateblue', '#483d8b'],
|
['darkturquoise', {r: 0, g: 206, b: 209, type: 'hex'}],
|
||||||
['darkslategray', '#2f4f4f'],
|
['darkviolet', {r: 148, g: 0, b: 211, type: 'hex'}],
|
||||||
['darkslategrey', '#2f4f4f'],
|
['deeppink', {r: 255, g: 20, b: 147, type: 'hex'}],
|
||||||
['darkturquoise', '#00ced1'],
|
['deepskyblue', {r: 0, g: 191, b: 255, type: 'hex'}],
|
||||||
['darkviolet', '#9400d3'],
|
['dimgray', {r: 105, g: 105, b: 105, type: 'hex'}],
|
||||||
['deeppink', '#ff1493'],
|
['dimgrey', {r: 105, g: 105, b: 105, type: 'hex'}],
|
||||||
['deepskyblue', '#00bfff'],
|
['dodgerblue', {r: 30, g: 144, b: 255, type: 'hex'}],
|
||||||
['dimgray', '#696969'],
|
['firebrick', {r: 178, g: 34, b: 34, type: 'hex'}],
|
||||||
['dimgrey', '#696969'],
|
['floralwhite', {r: 255, g: 250, b: 240, type: 'hex'}],
|
||||||
['dodgerblue', '#1e90ff'],
|
['forestgreen', {r: 34, g: 139, b: 34, type: 'hex'}],
|
||||||
['firebrick', '#b22222'],
|
['fuchsia', {r: 255, g: 0, b: 255, type: 'hex'}],
|
||||||
['floralwhite', '#fffaf0'],
|
['gainsboro', {r: 220, g: 220, b: 220, type: 'hex'}],
|
||||||
['forestgreen', '#228b22'],
|
['ghostwhite', {r: 248, g: 248, b: 255, type: 'hex'}],
|
||||||
['fuchsia', '#ff00ff'],
|
['gold', {r: 255, g: 215, b: 0, type: 'hex'}],
|
||||||
['gainsboro', '#dcdcdc'],
|
['goldenrod', {r: 218, g: 165, b: 32, type: 'hex'}],
|
||||||
['ghostwhite', '#f8f8ff'],
|
['gray', {r: 128, g: 128, b: 128, type: 'hex'}],
|
||||||
['gold', '#ffd700'],
|
['grey', {r: 128, g: 128, b: 128, type: 'hex'}],
|
||||||
['goldenrod', '#daa520'],
|
['green', {r: 0, g: 128, b: 0, type: 'hex'}],
|
||||||
['gray', '#808080'],
|
['greenyellow', {r: 173, g: 255, b: 47, type: 'hex'}],
|
||||||
['grey', '#808080'],
|
['honeydew', {r: 240, g: 255, b: 240, type: 'hex'}],
|
||||||
['green', '#008000'],
|
['hotpink', {r: 255, g: 105, b: 180, type: 'hex'}],
|
||||||
['greenyellow', '#adff2f'],
|
['indianred', {r: 205, g: 92, b: 92, type: 'hex'}],
|
||||||
['honeydew', '#f0fff0'],
|
['indigo', {r: 75, g: 0, b: 130, type: 'hex'}],
|
||||||
['hotpink', '#ff69b4'],
|
['ivory', {r: 255, g: 255, b: 240, type: 'hex'}],
|
||||||
['indianred', '#cd5c5c'],
|
['khaki', {r: 240, g: 230, b: 140, type: 'hex'}],
|
||||||
['indigo', '#4b0082'],
|
['lavender', {r: 230, g: 230, b: 250, type: 'hex'}],
|
||||||
['ivory', '#fffff0'],
|
['lavenderblush', {r: 255, g: 240, b: 245, type: 'hex'}],
|
||||||
['khaki', '#f0e68c'],
|
['lawngreen', {r: 124, g: 252, b: 0, type: 'hex'}],
|
||||||
['lavender', '#e6e6fa'],
|
['lemonchiffon', {r: 255, g: 250, b: 205, type: 'hex'}],
|
||||||
['lavenderblush', '#fff0f5'],
|
['lightblue', {r: 173, g: 216, b: 230, type: 'hex'}],
|
||||||
['lawngreen', '#7cfc00'],
|
['lightcoral', {r: 240, g: 128, b: 128, type: 'hex'}],
|
||||||
['lemonchiffon', '#fffacd'],
|
['lightcyan', {r: 224, g: 255, b: 255, type: 'hex'}],
|
||||||
['lightblue', '#add8e6'],
|
['lightgoldenrodyellow', {r: 250, g: 250, b: 210, type: 'hex'}],
|
||||||
['lightcoral', '#f08080'],
|
['lightgray', {r: 211, g: 211, b: 211, type: 'hex'}],
|
||||||
['lightcyan', '#e0ffff'],
|
['lightgrey', {r: 211, g: 211, b: 211, type: 'hex'}],
|
||||||
['lightgoldenrodyellow', '#fafad2'],
|
['lightgreen', {r: 144, g: 238, b: 144, type: 'hex'}],
|
||||||
['lightgray', '#d3d3d3'],
|
['lightpink', {r: 255, g: 182, b: 193, type: 'hex'}],
|
||||||
['lightgrey', '#d3d3d3'],
|
['lightsalmon', {r: 255, g: 160, b: 122, type: 'hex'}],
|
||||||
['lightgreen', '#90ee90'],
|
['lightseagreen', {r: 32, g: 178, b: 170, type: 'hex'}],
|
||||||
['lightpink', '#ffb6c1'],
|
['lightskyblue', {r: 135, g: 206, b: 250, type: 'hex'}],
|
||||||
['lightsalmon', '#ffa07a'],
|
['lightslategray', {r: 119, g: 136, b: 153, type: 'hex'}],
|
||||||
['lightseagreen', '#20b2aa'],
|
['lightslategrey', {r: 119, g: 136, b: 153, type: 'hex'}],
|
||||||
['lightskyblue', '#87cefa'],
|
['lightsteelblue', {r: 176, g: 196, b: 222, type: 'hex'}],
|
||||||
['lightslategray', '#778899'],
|
['lightyellow', {r: 255, g: 255, b: 224, type: 'hex'}],
|
||||||
['lightslategrey', '#778899'],
|
['lime', {r: 0, g: 255, b: 0, type: 'hex'}],
|
||||||
['lightsteelblue', '#b0c4de'],
|
['limegreen', {r: 50, g: 205, b: 50, type: 'hex'}],
|
||||||
['lightyellow', '#ffffe0'],
|
['linen', {r: 250, g: 240, b: 230, type: 'hex'}],
|
||||||
['lime', '#00ff00'],
|
['magenta', {r: 255, g: 0, b: 255, type: 'hex'}],
|
||||||
['limegreen', '#32cd32'],
|
['maroon', {r: 128, g: 0, b: 0, type: 'hex'}],
|
||||||
['linen', '#faf0e6'],
|
['mediumaquamarine', {r: 102, g: 205, b: 170, type: 'hex'}],
|
||||||
['magenta', '#ff00ff'],
|
['mediumblue', {r: 0, g: 0, b: 205, type: 'hex'}],
|
||||||
['maroon', '#800000'],
|
['mediumorchid', {r: 186, g: 85, b: 211, type: 'hex'}],
|
||||||
['mediumaquamarine', '#66cdaa'],
|
['mediumpurple', {r: 147, g: 112, b: 219, type: 'hex'}],
|
||||||
['mediumblue', '#0000cd'],
|
['mediumseagreen', {r: 60, g: 179, b: 113, type: 'hex'}],
|
||||||
['mediumorchid', '#ba55d3'],
|
['mediumslateblue', {r: 123, g: 104, b: 238, type: 'hex'}],
|
||||||
['mediumpurple', '#9370db'],
|
['mediumspringgreen', {r: 0, g: 250, b: 154, type: 'hex'}],
|
||||||
['mediumseagreen', '#3cb371'],
|
['mediumturquoise', {r: 72, g: 209, b: 204, type: 'hex'}],
|
||||||
['mediumslateblue', '#7b68ee'],
|
['mediumvioletred', {r: 199, g: 21, b: 133, type: 'hex'}],
|
||||||
['mediumspringgreen', '#00fa9a'],
|
['midnightblue', {r: 25, g: 25, b: 112, type: 'hex'}],
|
||||||
['mediumturquoise', '#48d1cc'],
|
['mintcream', {r: 245, g: 255, b: 250, type: 'hex'}],
|
||||||
['mediumvioletred', '#c71585'],
|
['mistyrose', {r: 255, g: 228, b: 225, type: 'hex'}],
|
||||||
['midnightblue', '#191970'],
|
['moccasin', {r: 255, g: 228, b: 181, type: 'hex'}],
|
||||||
['mintcream', '#f5fffa'],
|
['navajowhite', {r: 255, g: 222, b: 173, type: 'hex'}],
|
||||||
['mistyrose', '#ffe4e1'],
|
['navy', {r: 0, g: 0, b: 128, type: 'hex'}],
|
||||||
['moccasin', '#ffe4b5'],
|
['oldlace', {r: 253, g: 245, b: 230, type: 'hex'}],
|
||||||
['navajowhite', '#ffdead'],
|
['olive', {r: 128, g: 128, b: 0, type: 'hex'}],
|
||||||
['navy', '#000080'],
|
['olivedrab', {r: 107, g: 142, b: 35, type: 'hex'}],
|
||||||
['oldlace', '#fdf5e6'],
|
['orange', {r: 255, g: 165, b: 0, type: 'hex'}],
|
||||||
['olive', '#808000'],
|
['orangered', {r: 255, g: 69, b: 0, type: 'hex'}],
|
||||||
['olivedrab', '#6b8e23'],
|
['orchid', {r: 218, g: 112, b: 214, type: 'hex'}],
|
||||||
['orange', '#ffa500'],
|
['palegoldenrod', {r: 238, g: 232, b: 170, type: 'hex'}],
|
||||||
['orangered', '#ff4500'],
|
['palegreen', {r: 152, g: 251, b: 152, type: 'hex'}],
|
||||||
['orchid', '#da70d6'],
|
['paleturquoise', {r: 175, g: 238, b: 238, type: 'hex'}],
|
||||||
['palegoldenrod', '#eee8aa'],
|
['palevioletred', {r: 219, g: 112, b: 147, type: 'hex'}],
|
||||||
['palegreen', '#98fb98'],
|
['papayawhip', {r: 255, g: 239, b: 213, type: 'hex'}],
|
||||||
['paleturquoise', '#afeeee'],
|
['peachpuff', {r: 255, g: 218, b: 185, type: 'hex'}],
|
||||||
['palevioletred', '#db7093'],
|
['peru', {r: 205, g: 133, b: 63, type: 'hex'}],
|
||||||
['papayawhip', '#ffefd5'],
|
['pink', {r: 255, g: 192, b: 203, type: 'hex'}],
|
||||||
['peachpuff', '#ffdab9'],
|
['plum', {r: 221, g: 160, b: 221, type: 'hex'}],
|
||||||
['peru', '#cd853f'],
|
['powderblue', {r: 176, g: 224, b: 230, type: 'hex'}],
|
||||||
['pink', '#ffc0cb'],
|
['purple', {r: 128, g: 0, b: 128, type: 'hex'}],
|
||||||
['plum', '#dda0dd'],
|
['rebeccapurple', {r: 102, g: 51, b: 153, type: 'hex'}],
|
||||||
['powderblue', '#b0e0e6'],
|
['red', {r: 255, g: 0, b: 0, type: 'hex'}],
|
||||||
['purple', '#800080'],
|
['rosybrown', {r: 188, g: 143, b: 143, type: 'hex'}],
|
||||||
['rebeccapurple', '#663399'],
|
['royalblue', {r: 65, g: 105, b: 225, type: 'hex'}],
|
||||||
['red', '#ff0000'],
|
['saddlebrown', {r: 139, g: 69, b: 19, type: 'hex'}],
|
||||||
['rosybrown', '#bc8f8f'],
|
['salmon', {r: 250, g: 128, b: 114, type: 'hex'}],
|
||||||
['royalblue', '#4169e1'],
|
['sandybrown', {r: 244, g: 164, b: 96, type: 'hex'}],
|
||||||
['saddlebrown', '#8b4513'],
|
['seagreen', {r: 46, g: 139, b: 87, type: 'hex'}],
|
||||||
['salmon', '#fa8072'],
|
['seashell', {r: 255, g: 245, b: 238, type: 'hex'}],
|
||||||
['sandybrown', '#f4a460'],
|
['sienna', {r: 160, g: 82, b: 45, type: 'hex'}],
|
||||||
['seagreen', '#2e8b57'],
|
['silver', {r: 192, g: 192, b: 192, type: 'hex'}],
|
||||||
['seashell', '#fff5ee'],
|
['skyblue', {r: 135, g: 206, b: 235, type: 'hex'}],
|
||||||
['sienna', '#a0522d'],
|
['slateblue', {r: 106, g: 90, b: 205, type: 'hex'}],
|
||||||
['silver', '#c0c0c0'],
|
['slategray', {r: 112, g: 128, b: 144, type: 'hex'}],
|
||||||
['skyblue', '#87ceeb'],
|
['slategrey', {r: 112, g: 128, b: 144, type: 'hex'}],
|
||||||
['slateblue', '#6a5acd'],
|
['snow', {r: 255, g: 250, b: 250, type: 'hex'}],
|
||||||
['slategray', '#708090'],
|
['springgreen', {r: 0, g: 255, b: 127, type: 'hex'}],
|
||||||
['slategrey', '#708090'],
|
['steelblue', {r: 70, g: 130, b: 180, type: 'hex'}],
|
||||||
['snow', '#fffafa'],
|
['tan', {r: 210, g: 180, b: 140, type: 'hex'}],
|
||||||
['springgreen', '#00ff7f'],
|
['teal', {r: 0, g: 128, b: 128, type: 'hex'}],
|
||||||
['steelblue', '#4682b4'],
|
['thistle', {r: 216, g: 191, b: 216, type: 'hex'}],
|
||||||
['tan', '#d2b48c'],
|
['tomato', {r: 255, g: 99, b: 71, type: 'hex'}],
|
||||||
['teal', '#008080'],
|
['turquoise', {r: 64, g: 224, b: 208, type: 'hex'}],
|
||||||
['thistle', '#d8bfd8'],
|
['violet', {r: 238, g: 130, b: 238, type: 'hex'}],
|
||||||
['tomato', '#ff6347'],
|
['wheat', {r: 245, g: 222, b: 179, type: 'hex'}],
|
||||||
['turquoise', '#40e0d0'],
|
['white', {r: 255, g: 255, b: 255, type: 'hex'}],
|
||||||
['violet', '#ee82ee'],
|
['whitesmoke', {r: 245, g: 245, b: 245, type: 'hex'}],
|
||||||
['wheat', '#f5deb3'],
|
['yellow', {r: 255, g: 255, b: 0, type: 'hex'}],
|
||||||
['white', '#ffffff'],
|
['yellowgreen', {r: 154, g: 205, b: 50, type: 'hex'}],
|
||||||
['whitesmoke', '#f5f5f5'],
|
]));
|
||||||
['yellow', '#ffff00'],
|
|
||||||
['yellowgreen', '#9acd32'],
|
|
||||||
]);
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user