diff --git a/docs/ui/src/js/createOutputParameters.js b/docs/ui/src/js/createOutputParameters.js index f68e8dc5..1474d316 100644 --- a/docs/ui/src/js/createOutputParameters.js +++ b/docs/ui/src/js/createOutputParameters.js @@ -59,13 +59,13 @@ function createJSOutput() { let paramOutputString = `${joinedDeclarations} -let ${themeName.replace(/\s/g, '')} = new Leo.Theme({ +let ${themeName.replace(/[^a-zA-Z0-9_$]/g, '_')} = new Leo.Theme({ colors: [${colorNames.map((n) => camelCase(n))}], backgroundColor: ${camelCase(_theme.backgroundColor.name)}, lightness: ${_theme.lightness}, contrast: ${_theme.contrast}, saturation: ${_theme.saturation}, - output: "${_theme.output}" + output: "${_theme.output}", formula: "${_theme.formula}" });`; @@ -115,9 +115,9 @@ function createTokensOutput() { let backgroundColor = _theme.contrastColors[0].background; let backgroundColorObj = { - value: backgroundColor, - type: 'color', - description: `UI background color. All color contrasts evaluated and generated against this color.` + $value: backgroundColor, + $type: 'color', + $description: `UI background color. All color contrasts evaluated and generated against this color.` }; themeObj['Background'] = backgroundColorObj; @@ -125,6 +125,10 @@ function createTokensOutput() { let largeText = _theme.formula === 'wcag3' ? 60 : 3; let smallText = _theme.formula === 'wcag3' ? 75 : 4.5; + let formulaString = _theme.formula === 'wcag2' ? 'WCAG 2.x (relative luminance)' : 'WCAG 3 (APCA)'; + let largeText = _theme.formula === 'wcag3' ? 60 : 3; + let smallText = _theme.formula === 'wcag3' ? 75 : 4.5; + for (let i = 1; i < contrastColors.length; i++) { let thisColor = contrastColors[i]; for (let j = 0; j < thisColor.values.length; j++) { @@ -132,9 +136,9 @@ function createTokensOutput() { let descriptionText = color.contrast < largeText ? textLowContrast : color.contrast >= largeText && color.contrast < smallText ? textLarge : textSmall; let colorObj = { - value: color.value, - type: 'color', - description: `${descriptionText} ${formulaString} contrast is ${color.contrast}:1 against background ${backgroundColor}` + $value: color.value, + $type: 'color', + $description: `${descriptionText} ${formulaString} contrast is ${color.contrast}:1 against background ${backgroundColor}` }; themeObj[color.name] = colorObj; } diff --git a/packages/contrast-colors/lib/utils.js b/packages/contrast-colors/lib/utils.js index b5f6fad1..2048f33a 100644 --- a/packages/contrast-colors/lib/utils.js +++ b/packages/contrast-colors/lib/utils.js @@ -352,9 +352,6 @@ function convertColorValue(color, format, object = false) { if (letter === 'l' || letter === 'j') { rnd += '%'; } - if (letter === 'h') { - rnd += 'deg'; - } } } else if (space !== 'hsluv') { if (letter === 's' || letter === 'l' || letter === 'v') { @@ -363,8 +360,6 @@ function convertColorValue(color, format, object = false) { rnd = round(ch * 100); rnd += '%'; } - } else if (letter === 'h' && !object) { - rnd += 'deg'; } } return rnd; diff --git a/packages/contrast-colors/test/backgroundColor.test.js b/packages/contrast-colors/test/backgroundColor.test.js index 08c1cd26..880ecc0e 100644 --- a/packages/contrast-colors/test/backgroundColor.test.js +++ b/packages/contrast-colors/test/backgroundColor.test.js @@ -687,107 +687,107 @@ test('should generate 101 grayscale colors with HSL output (updated)', (t) => { }).backgroundColorScale; t.deepEqual(colors, [ - 'hsl(0deg, 0%, 0%)', - 'hsl(0deg, 0%, 1%)', - 'hsl(0deg, 0%, 2%)', - 'hsl(0deg, 0%, 4%)', - 'hsl(0deg, 0%, 5%)', - 'hsl(0deg, 0%, 6%)', - 'hsl(0deg, 0%, 7%)', - 'hsl(0deg, 0%, 8%)', - 'hsl(0deg, 0%, 9%)', - 'hsl(0deg, 0%, 10%)', - 'hsl(0deg, 0%, 11%)', - 'hsl(0deg, 0%, 11%)', - 'hsl(0deg, 0%, 12%)', - 'hsl(0deg, 0%, 13%)', - 'hsl(0deg, 0%, 14%)', - 'hsl(0deg, 0%, 15%)', - 'hsl(0deg, 0%, 15%)', - 'hsl(0deg, 0%, 16%)', - 'hsl(0deg, 0%, 17%)', - 'hsl(0deg, 0%, 18%)', - 'hsl(0deg, 0%, 19%)', - 'hsl(0deg, 0%, 20%)', - 'hsl(0deg, 0%, 20%)', - 'hsl(0deg, 0%, 21%)', - 'hsl(0deg, 0%, 22%)', - 'hsl(0deg, 0%, 23%)', - 'hsl(0deg, 0%, 24%)', - 'hsl(0deg, 0%, 25%)', - 'hsl(0deg, 0%, 25%)', - 'hsl(0deg, 0%, 27%)', - 'hsl(0deg, 0%, 27%)', - 'hsl(0deg, 0%, 28%)', - 'hsl(0deg, 0%, 29%)', - 'hsl(0deg, 0%, 30%)', - 'hsl(0deg, 0%, 31%)', - 'hsl(0deg, 0%, 32%)', - 'hsl(0deg, 0%, 33%)', - 'hsl(0deg, 0%, 34%)', - 'hsl(0deg, 0%, 35%)', - 'hsl(0deg, 0%, 36%)', - 'hsl(0deg, 0%, 37%)', - 'hsl(0deg, 0%, 38%)', - 'hsl(0deg, 0%, 38%)', - 'hsl(0deg, 0%, 40%)', - 'hsl(0deg, 0%, 40%)', - 'hsl(0deg, 0%, 42%)', - 'hsl(0deg, 0%, 42%)', - 'hsl(0deg, 0%, 44%)', - 'hsl(0deg, 0%, 44%)', - 'hsl(0deg, 0%, 45%)', - 'hsl(0deg, 0%, 46%)', - 'hsl(0deg, 0%, 47%)', - 'hsl(0deg, 0%, 48%)', - 'hsl(0deg, 0%, 49%)', - 'hsl(0deg, 0%, 50%)', - 'hsl(0deg, 0%, 51%)', - 'hsl(0deg, 0%, 52%)', - 'hsl(0deg, 0%, 53%)', - 'hsl(0deg, 0%, 55%)', - 'hsl(0deg, 0%, 55%)', - 'hsl(0deg, 0%, 56%)', - 'hsl(0deg, 0%, 57%)', - 'hsl(0deg, 0%, 58%)', - 'hsl(0deg, 0%, 60%)', - 'hsl(0deg, 0%, 60%)', - 'hsl(0deg, 0%, 62%)', - 'hsl(0deg, 0%, 63%)', - 'hsl(0deg, 0%, 64%)', - 'hsl(0deg, 0%, 65%)', - 'hsl(0deg, 0%, 66%)', - 'hsl(0deg, 0%, 67%)', - 'hsl(0deg, 0%, 68%)', - 'hsl(0deg, 0%, 69%)', - 'hsl(0deg, 0%, 70%)', - 'hsl(0deg, 0%, 71%)', - 'hsl(0deg, 0%, 72%)', - 'hsl(0deg, 0%, 73%)', - 'hsl(0deg, 0%, 74%)', - 'hsl(0deg, 0%, 75%)', - 'hsl(0deg, 0%, 76%)', - 'hsl(0deg, 0%, 77%)', - 'hsl(0deg, 0%, 78%)', - 'hsl(0deg, 0%, 80%)', - 'hsl(0deg, 0%, 81%)', - 'hsl(0deg, 0%, 82%)', - 'hsl(0deg, 0%, 83%)', - 'hsl(0deg, 0%, 84%)', - 'hsl(0deg, 0%, 85%)', - 'hsl(0deg, 0%, 86%)', - 'hsl(0deg, 0%, 87%)', - 'hsl(0deg, 0%, 88%)', - 'hsl(0deg, 0%, 89%)', - 'hsl(0deg, 0%, 91%)', - 'hsl(0deg, 0%, 92%)', - 'hsl(0deg, 0%, 93%)', - 'hsl(0deg, 0%, 94%)', - 'hsl(0deg, 0%, 95%)', - 'hsl(0deg, 0%, 96%)', - 'hsl(0deg, 0%, 97%)', - 'hsl(0deg, 0%, 98%)', - 'hsl(0deg, 0%, 100%)' + 'hsl(0, 0%, 0%)', + 'hsl(0, 0%, 1%)', + 'hsl(0, 0%, 2%)', + 'hsl(0, 0%, 4%)', + 'hsl(0, 0%, 5%)', + 'hsl(0, 0%, 6%)', + 'hsl(0, 0%, 7%)', + 'hsl(0, 0%, 8%)', + 'hsl(0, 0%, 9%)', + 'hsl(0, 0%, 10%)', + 'hsl(0, 0%, 11%)', + 'hsl(0, 0%, 11%)', + 'hsl(0, 0%, 12%)', + 'hsl(0, 0%, 13%)', + 'hsl(0, 0%, 14%)', + 'hsl(0, 0%, 15%)', + 'hsl(0, 0%, 15%)', + 'hsl(0, 0%, 16%)', + 'hsl(0, 0%, 17%)', + 'hsl(0, 0%, 18%)', + 'hsl(0, 0%, 19%)', + 'hsl(0, 0%, 20%)', + 'hsl(0, 0%, 20%)', + 'hsl(0, 0%, 21%)', + 'hsl(0, 0%, 22%)', + 'hsl(0, 0%, 23%)', + 'hsl(0, 0%, 24%)', + 'hsl(0, 0%, 25%)', + 'hsl(0, 0%, 25%)', + 'hsl(0, 0%, 27%)', + 'hsl(0, 0%, 27%)', + 'hsl(0, 0%, 28%)', + 'hsl(0, 0%, 29%)', + 'hsl(0, 0%, 30%)', + 'hsl(0, 0%, 31%)', + 'hsl(0, 0%, 32%)', + 'hsl(0, 0%, 33%)', + 'hsl(0, 0%, 34%)', + 'hsl(0, 0%, 35%)', + 'hsl(0, 0%, 36%)', + 'hsl(0, 0%, 37%)', + 'hsl(0, 0%, 38%)', + 'hsl(0, 0%, 38%)', + 'hsl(0, 0%, 40%)', + 'hsl(0, 0%, 40%)', + 'hsl(0, 0%, 42%)', + 'hsl(0, 0%, 42%)', + 'hsl(0, 0%, 44%)', + 'hsl(0, 0%, 44%)', + 'hsl(0, 0%, 45%)', + 'hsl(0, 0%, 46%)', + 'hsl(0, 0%, 47%)', + 'hsl(0, 0%, 48%)', + 'hsl(0, 0%, 49%)', + 'hsl(0, 0%, 50%)', + 'hsl(0, 0%, 51%)', + 'hsl(0, 0%, 52%)', + 'hsl(0, 0%, 53%)', + 'hsl(0, 0%, 55%)', + 'hsl(0, 0%, 55%)', + 'hsl(0, 0%, 56%)', + 'hsl(0, 0%, 57%)', + 'hsl(0, 0%, 58%)', + 'hsl(0, 0%, 60%)', + 'hsl(0, 0%, 60%)', + 'hsl(0, 0%, 62%)', + 'hsl(0, 0%, 63%)', + 'hsl(0, 0%, 64%)', + 'hsl(0, 0%, 65%)', + 'hsl(0, 0%, 66%)', + 'hsl(0, 0%, 67%)', + 'hsl(0, 0%, 68%)', + 'hsl(0, 0%, 69%)', + 'hsl(0, 0%, 70%)', + 'hsl(0, 0%, 71%)', + 'hsl(0, 0%, 72%)', + 'hsl(0, 0%, 73%)', + 'hsl(0, 0%, 74%)', + 'hsl(0, 0%, 75%)', + 'hsl(0, 0%, 76%)', + 'hsl(0, 0%, 77%)', + 'hsl(0, 0%, 78%)', + 'hsl(0, 0%, 80%)', + 'hsl(0, 0%, 81%)', + 'hsl(0, 0%, 82%)', + 'hsl(0, 0%, 83%)', + 'hsl(0, 0%, 84%)', + 'hsl(0, 0%, 85%)', + 'hsl(0, 0%, 86%)', + 'hsl(0, 0%, 87%)', + 'hsl(0, 0%, 88%)', + 'hsl(0, 0%, 89%)', + 'hsl(0, 0%, 91%)', + 'hsl(0, 0%, 92%)', + 'hsl(0, 0%, 93%)', + 'hsl(0, 0%, 94%)', + 'hsl(0, 0%, 95%)', + 'hsl(0, 0%, 96%)', + 'hsl(0, 0%, 97%)', + 'hsl(0, 0%, 98%)', + 'hsl(0, 0%, 100%)' ]); }); test('should generate 101 grayscale colors with HSL output', (t) => { @@ -796,107 +796,107 @@ test('should generate 101 grayscale colors with HSL output', (t) => { const colors = color.backgroundColorScale; t.deepEqual(colors, [ - 'hsl(0deg, 0%, 0%)', - 'hsl(0deg, 0%, 1%)', - 'hsl(0deg, 0%, 2%)', - 'hsl(0deg, 0%, 4%)', - 'hsl(0deg, 0%, 5%)', - 'hsl(0deg, 0%, 6%)', - 'hsl(0deg, 0%, 7%)', - 'hsl(0deg, 0%, 8%)', - 'hsl(0deg, 0%, 9%)', - 'hsl(0deg, 0%, 10%)', - 'hsl(0deg, 0%, 11%)', - 'hsl(0deg, 0%, 11%)', - 'hsl(0deg, 0%, 12%)', - 'hsl(0deg, 0%, 13%)', - 'hsl(0deg, 0%, 14%)', - 'hsl(0deg, 0%, 15%)', - 'hsl(0deg, 0%, 15%)', - 'hsl(0deg, 0%, 16%)', - 'hsl(0deg, 0%, 17%)', - 'hsl(0deg, 0%, 18%)', - 'hsl(0deg, 0%, 19%)', - 'hsl(0deg, 0%, 20%)', - 'hsl(0deg, 0%, 20%)', - 'hsl(0deg, 0%, 21%)', - 'hsl(0deg, 0%, 22%)', - 'hsl(0deg, 0%, 23%)', - 'hsl(0deg, 0%, 24%)', - 'hsl(0deg, 0%, 25%)', - 'hsl(0deg, 0%, 25%)', - 'hsl(0deg, 0%, 27%)', - 'hsl(0deg, 0%, 27%)', - 'hsl(0deg, 0%, 28%)', - 'hsl(0deg, 0%, 29%)', - 'hsl(0deg, 0%, 30%)', - 'hsl(0deg, 0%, 31%)', - 'hsl(0deg, 0%, 32%)', - 'hsl(0deg, 0%, 33%)', - 'hsl(0deg, 0%, 34%)', - 'hsl(0deg, 0%, 35%)', - 'hsl(0deg, 0%, 36%)', - 'hsl(0deg, 0%, 37%)', - 'hsl(0deg, 0%, 38%)', - 'hsl(0deg, 0%, 38%)', - 'hsl(0deg, 0%, 40%)', - 'hsl(0deg, 0%, 40%)', - 'hsl(0deg, 0%, 42%)', - 'hsl(0deg, 0%, 42%)', - 'hsl(0deg, 0%, 44%)', - 'hsl(0deg, 0%, 44%)', - 'hsl(0deg, 0%, 45%)', - 'hsl(0deg, 0%, 46%)', - 'hsl(0deg, 0%, 47%)', - 'hsl(0deg, 0%, 48%)', - 'hsl(0deg, 0%, 49%)', - 'hsl(0deg, 0%, 50%)', - 'hsl(0deg, 0%, 51%)', - 'hsl(0deg, 0%, 52%)', - 'hsl(0deg, 0%, 53%)', - 'hsl(0deg, 0%, 55%)', - 'hsl(0deg, 0%, 55%)', - 'hsl(0deg, 0%, 56%)', - 'hsl(0deg, 0%, 57%)', - 'hsl(0deg, 0%, 58%)', - 'hsl(0deg, 0%, 60%)', - 'hsl(0deg, 0%, 60%)', - 'hsl(0deg, 0%, 62%)', - 'hsl(0deg, 0%, 63%)', - 'hsl(0deg, 0%, 64%)', - 'hsl(0deg, 0%, 65%)', - 'hsl(0deg, 0%, 66%)', - 'hsl(0deg, 0%, 67%)', - 'hsl(0deg, 0%, 68%)', - 'hsl(0deg, 0%, 69%)', - 'hsl(0deg, 0%, 70%)', - 'hsl(0deg, 0%, 71%)', - 'hsl(0deg, 0%, 72%)', - 'hsl(0deg, 0%, 73%)', - 'hsl(0deg, 0%, 74%)', - 'hsl(0deg, 0%, 75%)', - 'hsl(0deg, 0%, 76%)', - 'hsl(0deg, 0%, 77%)', - 'hsl(0deg, 0%, 78%)', - 'hsl(0deg, 0%, 80%)', - 'hsl(0deg, 0%, 81%)', - 'hsl(0deg, 0%, 82%)', - 'hsl(0deg, 0%, 83%)', - 'hsl(0deg, 0%, 84%)', - 'hsl(0deg, 0%, 85%)', - 'hsl(0deg, 0%, 86%)', - 'hsl(0deg, 0%, 87%)', - 'hsl(0deg, 0%, 88%)', - 'hsl(0deg, 0%, 89%)', - 'hsl(0deg, 0%, 91%)', - 'hsl(0deg, 0%, 92%)', - 'hsl(0deg, 0%, 93%)', - 'hsl(0deg, 0%, 94%)', - 'hsl(0deg, 0%, 95%)', - 'hsl(0deg, 0%, 96%)', - 'hsl(0deg, 0%, 97%)', - 'hsl(0deg, 0%, 98%)', - 'hsl(0deg, 0%, 100%)' + 'hsl(0, 0%, 0%)', + 'hsl(0, 0%, 1%)', + 'hsl(0, 0%, 2%)', + 'hsl(0, 0%, 4%)', + 'hsl(0, 0%, 5%)', + 'hsl(0, 0%, 6%)', + 'hsl(0, 0%, 7%)', + 'hsl(0, 0%, 8%)', + 'hsl(0, 0%, 9%)', + 'hsl(0, 0%, 10%)', + 'hsl(0, 0%, 11%)', + 'hsl(0, 0%, 11%)', + 'hsl(0, 0%, 12%)', + 'hsl(0, 0%, 13%)', + 'hsl(0, 0%, 14%)', + 'hsl(0, 0%, 15%)', + 'hsl(0, 0%, 15%)', + 'hsl(0, 0%, 16%)', + 'hsl(0, 0%, 17%)', + 'hsl(0, 0%, 18%)', + 'hsl(0, 0%, 19%)', + 'hsl(0, 0%, 20%)', + 'hsl(0, 0%, 20%)', + 'hsl(0, 0%, 21%)', + 'hsl(0, 0%, 22%)', + 'hsl(0, 0%, 23%)', + 'hsl(0, 0%, 24%)', + 'hsl(0, 0%, 25%)', + 'hsl(0, 0%, 25%)', + 'hsl(0, 0%, 27%)', + 'hsl(0, 0%, 27%)', + 'hsl(0, 0%, 28%)', + 'hsl(0, 0%, 29%)', + 'hsl(0, 0%, 30%)', + 'hsl(0, 0%, 31%)', + 'hsl(0, 0%, 32%)', + 'hsl(0, 0%, 33%)', + 'hsl(0, 0%, 34%)', + 'hsl(0, 0%, 35%)', + 'hsl(0, 0%, 36%)', + 'hsl(0, 0%, 37%)', + 'hsl(0, 0%, 38%)', + 'hsl(0, 0%, 38%)', + 'hsl(0, 0%, 40%)', + 'hsl(0, 0%, 40%)', + 'hsl(0, 0%, 42%)', + 'hsl(0, 0%, 42%)', + 'hsl(0, 0%, 44%)', + 'hsl(0, 0%, 44%)', + 'hsl(0, 0%, 45%)', + 'hsl(0, 0%, 46%)', + 'hsl(0, 0%, 47%)', + 'hsl(0, 0%, 48%)', + 'hsl(0, 0%, 49%)', + 'hsl(0, 0%, 50%)', + 'hsl(0, 0%, 51%)', + 'hsl(0, 0%, 52%)', + 'hsl(0, 0%, 53%)', + 'hsl(0, 0%, 55%)', + 'hsl(0, 0%, 55%)', + 'hsl(0, 0%, 56%)', + 'hsl(0, 0%, 57%)', + 'hsl(0, 0%, 58%)', + 'hsl(0, 0%, 60%)', + 'hsl(0, 0%, 60%)', + 'hsl(0, 0%, 62%)', + 'hsl(0, 0%, 63%)', + 'hsl(0, 0%, 64%)', + 'hsl(0, 0%, 65%)', + 'hsl(0, 0%, 66%)', + 'hsl(0, 0%, 67%)', + 'hsl(0, 0%, 68%)', + 'hsl(0, 0%, 69%)', + 'hsl(0, 0%, 70%)', + 'hsl(0, 0%, 71%)', + 'hsl(0, 0%, 72%)', + 'hsl(0, 0%, 73%)', + 'hsl(0, 0%, 74%)', + 'hsl(0, 0%, 75%)', + 'hsl(0, 0%, 76%)', + 'hsl(0, 0%, 77%)', + 'hsl(0, 0%, 78%)', + 'hsl(0, 0%, 80%)', + 'hsl(0, 0%, 81%)', + 'hsl(0, 0%, 82%)', + 'hsl(0, 0%, 83%)', + 'hsl(0, 0%, 84%)', + 'hsl(0, 0%, 85%)', + 'hsl(0, 0%, 86%)', + 'hsl(0, 0%, 87%)', + 'hsl(0, 0%, 88%)', + 'hsl(0, 0%, 89%)', + 'hsl(0, 0%, 91%)', + 'hsl(0, 0%, 92%)', + 'hsl(0, 0%, 93%)', + 'hsl(0, 0%, 94%)', + 'hsl(0, 0%, 95%)', + 'hsl(0, 0%, 96%)', + 'hsl(0, 0%, 97%)', + 'hsl(0, 0%, 98%)', + 'hsl(0, 0%, 100%)' ]); }); @@ -908,107 +908,107 @@ test('should generate 101 grayscale colors with HSV output', (t) => { }).backgroundColorScale; t.deepEqual(colors, [ - 'hsv(0deg, 0%, 0%)', - 'hsv(0deg, 0%, 1%)', - 'hsv(0deg, 0%, 2%)', - 'hsv(0deg, 0%, 4%)', - 'hsv(0deg, 0%, 5%)', - 'hsv(0deg, 0%, 6%)', - 'hsv(0deg, 0%, 7%)', - 'hsv(0deg, 0%, 8%)', - 'hsv(0deg, 0%, 9%)', - 'hsv(0deg, 0%, 10%)', - 'hsv(0deg, 0%, 11%)', - 'hsv(0deg, 0%, 11%)', - 'hsv(0deg, 0%, 12%)', - 'hsv(0deg, 0%, 13%)', - 'hsv(0deg, 0%, 14%)', - 'hsv(0deg, 0%, 15%)', - 'hsv(0deg, 0%, 15%)', - 'hsv(0deg, 0%, 16%)', - 'hsv(0deg, 0%, 17%)', - 'hsv(0deg, 0%, 18%)', - 'hsv(0deg, 0%, 19%)', - 'hsv(0deg, 0%, 20%)', - 'hsv(0deg, 0%, 20%)', - 'hsv(0deg, 0%, 21%)', - 'hsv(0deg, 0%, 22%)', - 'hsv(0deg, 0%, 23%)', - 'hsv(0deg, 0%, 24%)', - 'hsv(0deg, 0%, 25%)', - 'hsv(0deg, 0%, 25%)', - 'hsv(0deg, 0%, 27%)', - 'hsv(0deg, 0%, 27%)', - 'hsv(0deg, 0%, 28%)', - 'hsv(0deg, 0%, 29%)', - 'hsv(0deg, 0%, 30%)', - 'hsv(0deg, 0%, 31%)', - 'hsv(0deg, 0%, 32%)', - 'hsv(0deg, 0%, 33%)', - 'hsv(0deg, 0%, 34%)', - 'hsv(0deg, 0%, 35%)', - 'hsv(0deg, 0%, 36%)', - 'hsv(0deg, 0%, 37%)', - 'hsv(0deg, 0%, 38%)', - 'hsv(0deg, 0%, 38%)', - 'hsv(0deg, 0%, 40%)', - 'hsv(0deg, 0%, 40%)', - 'hsv(0deg, 0%, 42%)', - 'hsv(0deg, 0%, 42%)', - 'hsv(0deg, 0%, 44%)', - 'hsv(0deg, 0%, 44%)', - 'hsv(0deg, 0%, 45%)', - 'hsv(0deg, 0%, 46%)', - 'hsv(0deg, 0%, 47%)', - 'hsv(0deg, 0%, 48%)', - 'hsv(0deg, 0%, 49%)', - 'hsv(0deg, 0%, 50%)', - 'hsv(0deg, 0%, 51%)', - 'hsv(0deg, 0%, 52%)', - 'hsv(0deg, 0%, 53%)', - 'hsv(0deg, 0%, 55%)', - 'hsv(0deg, 0%, 55%)', - 'hsv(0deg, 0%, 56%)', - 'hsv(0deg, 0%, 57%)', - 'hsv(0deg, 0%, 58%)', - 'hsv(0deg, 0%, 60%)', - 'hsv(0deg, 0%, 60%)', - 'hsv(0deg, 0%, 62%)', - 'hsv(0deg, 0%, 63%)', - 'hsv(0deg, 0%, 64%)', - 'hsv(0deg, 0%, 65%)', - 'hsv(0deg, 0%, 66%)', - 'hsv(0deg, 0%, 67%)', - 'hsv(0deg, 0%, 68%)', - 'hsv(0deg, 0%, 69%)', - 'hsv(0deg, 0%, 70%)', - 'hsv(0deg, 0%, 71%)', - 'hsv(0deg, 0%, 72%)', - 'hsv(0deg, 0%, 73%)', - 'hsv(0deg, 0%, 74%)', - 'hsv(0deg, 0%, 75%)', - 'hsv(0deg, 0%, 76%)', - 'hsv(0deg, 0%, 77%)', - 'hsv(0deg, 0%, 78%)', - 'hsv(0deg, 0%, 80%)', - 'hsv(0deg, 0%, 81%)', - 'hsv(0deg, 0%, 82%)', - 'hsv(0deg, 0%, 83%)', - 'hsv(0deg, 0%, 84%)', - 'hsv(0deg, 0%, 85%)', - 'hsv(0deg, 0%, 86%)', - 'hsv(0deg, 0%, 87%)', - 'hsv(0deg, 0%, 88%)', - 'hsv(0deg, 0%, 89%)', - 'hsv(0deg, 0%, 91%)', - 'hsv(0deg, 0%, 92%)', - 'hsv(0deg, 0%, 93%)', - 'hsv(0deg, 0%, 94%)', - 'hsv(0deg, 0%, 95%)', - 'hsv(0deg, 0%, 96%)', - 'hsv(0deg, 0%, 97%)', - 'hsv(0deg, 0%, 98%)', - 'hsv(0deg, 0%, 100%)' + 'hsv(0, 0%, 0%)', + 'hsv(0, 0%, 1%)', + 'hsv(0, 0%, 2%)', + 'hsv(0, 0%, 4%)', + 'hsv(0, 0%, 5%)', + 'hsv(0, 0%, 6%)', + 'hsv(0, 0%, 7%)', + 'hsv(0, 0%, 8%)', + 'hsv(0, 0%, 9%)', + 'hsv(0, 0%, 10%)', + 'hsv(0, 0%, 11%)', + 'hsv(0, 0%, 11%)', + 'hsv(0, 0%, 12%)', + 'hsv(0, 0%, 13%)', + 'hsv(0, 0%, 14%)', + 'hsv(0, 0%, 15%)', + 'hsv(0, 0%, 15%)', + 'hsv(0, 0%, 16%)', + 'hsv(0, 0%, 17%)', + 'hsv(0, 0%, 18%)', + 'hsv(0, 0%, 19%)', + 'hsv(0, 0%, 20%)', + 'hsv(0, 0%, 20%)', + 'hsv(0, 0%, 21%)', + 'hsv(0, 0%, 22%)', + 'hsv(0, 0%, 23%)', + 'hsv(0, 0%, 24%)', + 'hsv(0, 0%, 25%)', + 'hsv(0, 0%, 25%)', + 'hsv(0, 0%, 27%)', + 'hsv(0, 0%, 27%)', + 'hsv(0, 0%, 28%)', + 'hsv(0, 0%, 29%)', + 'hsv(0, 0%, 30%)', + 'hsv(0, 0%, 31%)', + 'hsv(0, 0%, 32%)', + 'hsv(0, 0%, 33%)', + 'hsv(0, 0%, 34%)', + 'hsv(0, 0%, 35%)', + 'hsv(0, 0%, 36%)', + 'hsv(0, 0%, 37%)', + 'hsv(0, 0%, 38%)', + 'hsv(0, 0%, 38%)', + 'hsv(0, 0%, 40%)', + 'hsv(0, 0%, 40%)', + 'hsv(0, 0%, 42%)', + 'hsv(0, 0%, 42%)', + 'hsv(0, 0%, 44%)', + 'hsv(0, 0%, 44%)', + 'hsv(0, 0%, 45%)', + 'hsv(0, 0%, 46%)', + 'hsv(0, 0%, 47%)', + 'hsv(0, 0%, 48%)', + 'hsv(0, 0%, 49%)', + 'hsv(0, 0%, 50%)', + 'hsv(0, 0%, 51%)', + 'hsv(0, 0%, 52%)', + 'hsv(0, 0%, 53%)', + 'hsv(0, 0%, 55%)', + 'hsv(0, 0%, 55%)', + 'hsv(0, 0%, 56%)', + 'hsv(0, 0%, 57%)', + 'hsv(0, 0%, 58%)', + 'hsv(0, 0%, 60%)', + 'hsv(0, 0%, 60%)', + 'hsv(0, 0%, 62%)', + 'hsv(0, 0%, 63%)', + 'hsv(0, 0%, 64%)', + 'hsv(0, 0%, 65%)', + 'hsv(0, 0%, 66%)', + 'hsv(0, 0%, 67%)', + 'hsv(0, 0%, 68%)', + 'hsv(0, 0%, 69%)', + 'hsv(0, 0%, 70%)', + 'hsv(0, 0%, 71%)', + 'hsv(0, 0%, 72%)', + 'hsv(0, 0%, 73%)', + 'hsv(0, 0%, 74%)', + 'hsv(0, 0%, 75%)', + 'hsv(0, 0%, 76%)', + 'hsv(0, 0%, 77%)', + 'hsv(0, 0%, 78%)', + 'hsv(0, 0%, 80%)', + 'hsv(0, 0%, 81%)', + 'hsv(0, 0%, 82%)', + 'hsv(0, 0%, 83%)', + 'hsv(0, 0%, 84%)', + 'hsv(0, 0%, 85%)', + 'hsv(0, 0%, 86%)', + 'hsv(0, 0%, 87%)', + 'hsv(0, 0%, 88%)', + 'hsv(0, 0%, 89%)', + 'hsv(0, 0%, 91%)', + 'hsv(0, 0%, 92%)', + 'hsv(0, 0%, 93%)', + 'hsv(0, 0%, 94%)', + 'hsv(0, 0%, 95%)', + 'hsv(0, 0%, 96%)', + 'hsv(0, 0%, 97%)', + 'hsv(0, 0%, 98%)', + 'hsv(0, 0%, 100%)' ]); }); test('should generate 101 grayscale colors with HSV output (updated)', (t) => { @@ -1017,107 +1017,107 @@ test('should generate 101 grayscale colors with HSV output (updated)', (t) => { const colors = color.backgroundColorScale; t.deepEqual(colors, [ - 'hsv(0deg, 0%, 0%)', - 'hsv(0deg, 0%, 1%)', - 'hsv(0deg, 0%, 2%)', - 'hsv(0deg, 0%, 4%)', - 'hsv(0deg, 0%, 5%)', - 'hsv(0deg, 0%, 6%)', - 'hsv(0deg, 0%, 7%)', - 'hsv(0deg, 0%, 8%)', - 'hsv(0deg, 0%, 9%)', - 'hsv(0deg, 0%, 10%)', - 'hsv(0deg, 0%, 11%)', - 'hsv(0deg, 0%, 11%)', - 'hsv(0deg, 0%, 12%)', - 'hsv(0deg, 0%, 13%)', - 'hsv(0deg, 0%, 14%)', - 'hsv(0deg, 0%, 15%)', - 'hsv(0deg, 0%, 15%)', - 'hsv(0deg, 0%, 16%)', - 'hsv(0deg, 0%, 17%)', - 'hsv(0deg, 0%, 18%)', - 'hsv(0deg, 0%, 19%)', - 'hsv(0deg, 0%, 20%)', - 'hsv(0deg, 0%, 20%)', - 'hsv(0deg, 0%, 21%)', - 'hsv(0deg, 0%, 22%)', - 'hsv(0deg, 0%, 23%)', - 'hsv(0deg, 0%, 24%)', - 'hsv(0deg, 0%, 25%)', - 'hsv(0deg, 0%, 25%)', - 'hsv(0deg, 0%, 27%)', - 'hsv(0deg, 0%, 27%)', - 'hsv(0deg, 0%, 28%)', - 'hsv(0deg, 0%, 29%)', - 'hsv(0deg, 0%, 30%)', - 'hsv(0deg, 0%, 31%)', - 'hsv(0deg, 0%, 32%)', - 'hsv(0deg, 0%, 33%)', - 'hsv(0deg, 0%, 34%)', - 'hsv(0deg, 0%, 35%)', - 'hsv(0deg, 0%, 36%)', - 'hsv(0deg, 0%, 37%)', - 'hsv(0deg, 0%, 38%)', - 'hsv(0deg, 0%, 38%)', - 'hsv(0deg, 0%, 40%)', - 'hsv(0deg, 0%, 40%)', - 'hsv(0deg, 0%, 42%)', - 'hsv(0deg, 0%, 42%)', - 'hsv(0deg, 0%, 44%)', - 'hsv(0deg, 0%, 44%)', - 'hsv(0deg, 0%, 45%)', - 'hsv(0deg, 0%, 46%)', - 'hsv(0deg, 0%, 47%)', - 'hsv(0deg, 0%, 48%)', - 'hsv(0deg, 0%, 49%)', - 'hsv(0deg, 0%, 50%)', - 'hsv(0deg, 0%, 51%)', - 'hsv(0deg, 0%, 52%)', - 'hsv(0deg, 0%, 53%)', - 'hsv(0deg, 0%, 55%)', - 'hsv(0deg, 0%, 55%)', - 'hsv(0deg, 0%, 56%)', - 'hsv(0deg, 0%, 57%)', - 'hsv(0deg, 0%, 58%)', - 'hsv(0deg, 0%, 60%)', - 'hsv(0deg, 0%, 60%)', - 'hsv(0deg, 0%, 62%)', - 'hsv(0deg, 0%, 63%)', - 'hsv(0deg, 0%, 64%)', - 'hsv(0deg, 0%, 65%)', - 'hsv(0deg, 0%, 66%)', - 'hsv(0deg, 0%, 67%)', - 'hsv(0deg, 0%, 68%)', - 'hsv(0deg, 0%, 69%)', - 'hsv(0deg, 0%, 70%)', - 'hsv(0deg, 0%, 71%)', - 'hsv(0deg, 0%, 72%)', - 'hsv(0deg, 0%, 73%)', - 'hsv(0deg, 0%, 74%)', - 'hsv(0deg, 0%, 75%)', - 'hsv(0deg, 0%, 76%)', - 'hsv(0deg, 0%, 77%)', - 'hsv(0deg, 0%, 78%)', - 'hsv(0deg, 0%, 80%)', - 'hsv(0deg, 0%, 81%)', - 'hsv(0deg, 0%, 82%)', - 'hsv(0deg, 0%, 83%)', - 'hsv(0deg, 0%, 84%)', - 'hsv(0deg, 0%, 85%)', - 'hsv(0deg, 0%, 86%)', - 'hsv(0deg, 0%, 87%)', - 'hsv(0deg, 0%, 88%)', - 'hsv(0deg, 0%, 89%)', - 'hsv(0deg, 0%, 91%)', - 'hsv(0deg, 0%, 92%)', - 'hsv(0deg, 0%, 93%)', - 'hsv(0deg, 0%, 94%)', - 'hsv(0deg, 0%, 95%)', - 'hsv(0deg, 0%, 96%)', - 'hsv(0deg, 0%, 97%)', - 'hsv(0deg, 0%, 98%)', - 'hsv(0deg, 0%, 100%)' + 'hsv(0, 0%, 0%)', + 'hsv(0, 0%, 1%)', + 'hsv(0, 0%, 2%)', + 'hsv(0, 0%, 4%)', + 'hsv(0, 0%, 5%)', + 'hsv(0, 0%, 6%)', + 'hsv(0, 0%, 7%)', + 'hsv(0, 0%, 8%)', + 'hsv(0, 0%, 9%)', + 'hsv(0, 0%, 10%)', + 'hsv(0, 0%, 11%)', + 'hsv(0, 0%, 11%)', + 'hsv(0, 0%, 12%)', + 'hsv(0, 0%, 13%)', + 'hsv(0, 0%, 14%)', + 'hsv(0, 0%, 15%)', + 'hsv(0, 0%, 15%)', + 'hsv(0, 0%, 16%)', + 'hsv(0, 0%, 17%)', + 'hsv(0, 0%, 18%)', + 'hsv(0, 0%, 19%)', + 'hsv(0, 0%, 20%)', + 'hsv(0, 0%, 20%)', + 'hsv(0, 0%, 21%)', + 'hsv(0, 0%, 22%)', + 'hsv(0, 0%, 23%)', + 'hsv(0, 0%, 24%)', + 'hsv(0, 0%, 25%)', + 'hsv(0, 0%, 25%)', + 'hsv(0, 0%, 27%)', + 'hsv(0, 0%, 27%)', + 'hsv(0, 0%, 28%)', + 'hsv(0, 0%, 29%)', + 'hsv(0, 0%, 30%)', + 'hsv(0, 0%, 31%)', + 'hsv(0, 0%, 32%)', + 'hsv(0, 0%, 33%)', + 'hsv(0, 0%, 34%)', + 'hsv(0, 0%, 35%)', + 'hsv(0, 0%, 36%)', + 'hsv(0, 0%, 37%)', + 'hsv(0, 0%, 38%)', + 'hsv(0, 0%, 38%)', + 'hsv(0, 0%, 40%)', + 'hsv(0, 0%, 40%)', + 'hsv(0, 0%, 42%)', + 'hsv(0, 0%, 42%)', + 'hsv(0, 0%, 44%)', + 'hsv(0, 0%, 44%)', + 'hsv(0, 0%, 45%)', + 'hsv(0, 0%, 46%)', + 'hsv(0, 0%, 47%)', + 'hsv(0, 0%, 48%)', + 'hsv(0, 0%, 49%)', + 'hsv(0, 0%, 50%)', + 'hsv(0, 0%, 51%)', + 'hsv(0, 0%, 52%)', + 'hsv(0, 0%, 53%)', + 'hsv(0, 0%, 55%)', + 'hsv(0, 0%, 55%)', + 'hsv(0, 0%, 56%)', + 'hsv(0, 0%, 57%)', + 'hsv(0, 0%, 58%)', + 'hsv(0, 0%, 60%)', + 'hsv(0, 0%, 60%)', + 'hsv(0, 0%, 62%)', + 'hsv(0, 0%, 63%)', + 'hsv(0, 0%, 64%)', + 'hsv(0, 0%, 65%)', + 'hsv(0, 0%, 66%)', + 'hsv(0, 0%, 67%)', + 'hsv(0, 0%, 68%)', + 'hsv(0, 0%, 69%)', + 'hsv(0, 0%, 70%)', + 'hsv(0, 0%, 71%)', + 'hsv(0, 0%, 72%)', + 'hsv(0, 0%, 73%)', + 'hsv(0, 0%, 74%)', + 'hsv(0, 0%, 75%)', + 'hsv(0, 0%, 76%)', + 'hsv(0, 0%, 77%)', + 'hsv(0, 0%, 78%)', + 'hsv(0, 0%, 80%)', + 'hsv(0, 0%, 81%)', + 'hsv(0, 0%, 82%)', + 'hsv(0, 0%, 83%)', + 'hsv(0, 0%, 84%)', + 'hsv(0, 0%, 85%)', + 'hsv(0, 0%, 86%)', + 'hsv(0, 0%, 87%)', + 'hsv(0, 0%, 88%)', + 'hsv(0, 0%, 89%)', + 'hsv(0, 0%, 91%)', + 'hsv(0, 0%, 92%)', + 'hsv(0, 0%, 93%)', + 'hsv(0, 0%, 94%)', + 'hsv(0, 0%, 95%)', + 'hsv(0, 0%, 96%)', + 'hsv(0, 0%, 97%)', + 'hsv(0, 0%, 98%)', + 'hsv(0, 0%, 100%)' ]); }); @@ -1350,107 +1350,107 @@ test('should generate 101 grayscale colors with LCH output', (t) => { }).backgroundColorScale; t.deepEqual(colors, [ - 'lch(0%, 0, 0deg)', - 'lch(1%, 0, 0deg)', - 'lch(2%, 0, 0deg)', - 'lch(3%, 0, 0deg)', - 'lch(4%, 0, 0deg)', - 'lch(5%, 0, 0deg)', - 'lch(6%, 0, 0deg)', - 'lch(7%, 0, 0deg)', - 'lch(8%, 0, 0deg)', - 'lch(9%, 0, 0deg)', - 'lch(10%, 0, 0deg)', - 'lch(11%, 0, 0deg)', - 'lch(12%, 0, 0deg)', - 'lch(13%, 0, 0deg)', - 'lch(14%, 0, 0deg)', - 'lch(15%, 0, 0deg)', - 'lch(16%, 0, 0deg)', - 'lch(17%, 0, 0deg)', - 'lch(18%, 0, 0deg)', - 'lch(19%, 0, 0deg)', - 'lch(20%, 0, 0deg)', - 'lch(21%, 0, 0deg)', - 'lch(22%, 0, 0deg)', - 'lch(23%, 0, 0deg)', - 'lch(24%, 0, 0deg)', - 'lch(25%, 0, 0deg)', - 'lch(26%, 0, 0deg)', - 'lch(27%, 0, 0deg)', - 'lch(28%, 0, 0deg)', - 'lch(29%, 0, 0deg)', - 'lch(30%, 0, 0deg)', - 'lch(31%, 0, 0deg)', - 'lch(32%, 0, 0deg)', - 'lch(33%, 0, 0deg)', - 'lch(34%, 0, 0deg)', - 'lch(35%, 0, 0deg)', - 'lch(36%, 0, 0deg)', - 'lch(37%, 0, 0deg)', - 'lch(38%, 0, 0deg)', - 'lch(39%, 0, 0deg)', - 'lch(40%, 0, 0deg)', - 'lch(41%, 0, 0deg)', - 'lch(42%, 0, 0deg)', - 'lch(43%, 0, 0deg)', - 'lch(44%, 0, 0deg)', - 'lch(45%, 0, 0deg)', - 'lch(46%, 0, 0deg)', - 'lch(47%, 0, 0deg)', - 'lch(48%, 0, 0deg)', - 'lch(49%, 0, 0deg)', - 'lch(50%, 0, 0deg)', - 'lch(51%, 0, 0deg)', - 'lch(52%, 0, 0deg)', - 'lch(53%, 0, 0deg)', - 'lch(54%, 0, 0deg)', - 'lch(55%, 0, 0deg)', - 'lch(56%, 0, 0deg)', - 'lch(57%, 0, 0deg)', - 'lch(58%, 0, 0deg)', - 'lch(59%, 0, 0deg)', - 'lch(60%, 0, 0deg)', - 'lch(61%, 0, 0deg)', - 'lch(62%, 0, 0deg)', - 'lch(63%, 0, 0deg)', - 'lch(64%, 0, 0deg)', - 'lch(65%, 0, 0deg)', - 'lch(66%, 0, 0deg)', - 'lch(67%, 0, 0deg)', - 'lch(68%, 0, 0deg)', - 'lch(69%, 0, 0deg)', - 'lch(70%, 0, 0deg)', - 'lch(71%, 0, 0deg)', - 'lch(72%, 0, 0deg)', - 'lch(73%, 0, 0deg)', - 'lch(74%, 0, 0deg)', - 'lch(75%, 0, 0deg)', - 'lch(76%, 0, 0deg)', - 'lch(77%, 0, 0deg)', - 'lch(78%, 0, 0deg)', - 'lch(79%, 0, 0deg)', - 'lch(80%, 0, 0deg)', - 'lch(81%, 0, 0deg)', - 'lch(82%, 0, 0deg)', - 'lch(83%, 0, 0deg)', - 'lch(84%, 0, 0deg)', - 'lch(85%, 0, 0deg)', - 'lch(86%, 0, 0deg)', - 'lch(87%, 0, 0deg)', - 'lch(88%, 0, 0deg)', - 'lch(89%, 0, 0deg)', - 'lch(90%, 0, 0deg)', - 'lch(91%, 0, 0deg)', - 'lch(92%, 0, 0deg)', - 'lch(93%, 0, 0deg)', - 'lch(94%, 0, 0deg)', - 'lch(95%, 0, 0deg)', - 'lch(96%, 0, 0deg)', - 'lch(97%, 0, 0deg)', - 'lch(98%, 0, 0deg)', - 'lch(99%, 0, 0deg)', - 'lch(100%, 0, 0deg)' + 'lch(0%, 0, 0)', + 'lch(1%, 0, 0)', + 'lch(2%, 0, 0)', + 'lch(3%, 0, 0)', + 'lch(4%, 0, 0)', + 'lch(5%, 0, 0)', + 'lch(6%, 0, 0)', + 'lch(7%, 0, 0)', + 'lch(8%, 0, 0)', + 'lch(9%, 0, 0)', + 'lch(10%, 0, 0)', + 'lch(11%, 0, 0)', + 'lch(12%, 0, 0)', + 'lch(13%, 0, 0)', + 'lch(14%, 0, 0)', + 'lch(15%, 0, 0)', + 'lch(16%, 0, 0)', + 'lch(17%, 0, 0)', + 'lch(18%, 0, 0)', + 'lch(19%, 0, 0)', + 'lch(20%, 0, 0)', + 'lch(21%, 0, 0)', + 'lch(22%, 0, 0)', + 'lch(23%, 0, 0)', + 'lch(24%, 0, 0)', + 'lch(25%, 0, 0)', + 'lch(26%, 0, 0)', + 'lch(27%, 0, 0)', + 'lch(28%, 0, 0)', + 'lch(29%, 0, 0)', + 'lch(30%, 0, 0)', + 'lch(31%, 0, 0)', + 'lch(32%, 0, 0)', + 'lch(33%, 0, 0)', + 'lch(34%, 0, 0)', + 'lch(35%, 0, 0)', + 'lch(36%, 0, 0)', + 'lch(37%, 0, 0)', + 'lch(38%, 0, 0)', + 'lch(39%, 0, 0)', + 'lch(40%, 0, 0)', + 'lch(41%, 0, 0)', + 'lch(42%, 0, 0)', + 'lch(43%, 0, 0)', + 'lch(44%, 0, 0)', + 'lch(45%, 0, 0)', + 'lch(46%, 0, 0)', + 'lch(47%, 0, 0)', + 'lch(48%, 0, 0)', + 'lch(49%, 0, 0)', + 'lch(50%, 0, 0)', + 'lch(51%, 0, 0)', + 'lch(52%, 0, 0)', + 'lch(53%, 0, 0)', + 'lch(54%, 0, 0)', + 'lch(55%, 0, 0)', + 'lch(56%, 0, 0)', + 'lch(57%, 0, 0)', + 'lch(58%, 0, 0)', + 'lch(59%, 0, 0)', + 'lch(60%, 0, 0)', + 'lch(61%, 0, 0)', + 'lch(62%, 0, 0)', + 'lch(63%, 0, 0)', + 'lch(64%, 0, 0)', + 'lch(65%, 0, 0)', + 'lch(66%, 0, 0)', + 'lch(67%, 0, 0)', + 'lch(68%, 0, 0)', + 'lch(69%, 0, 0)', + 'lch(70%, 0, 0)', + 'lch(71%, 0, 0)', + 'lch(72%, 0, 0)', + 'lch(73%, 0, 0)', + 'lch(74%, 0, 0)', + 'lch(75%, 0, 0)', + 'lch(76%, 0, 0)', + 'lch(77%, 0, 0)', + 'lch(78%, 0, 0)', + 'lch(79%, 0, 0)', + 'lch(80%, 0, 0)', + 'lch(81%, 0, 0)', + 'lch(82%, 0, 0)', + 'lch(83%, 0, 0)', + 'lch(84%, 0, 0)', + 'lch(85%, 0, 0)', + 'lch(86%, 0, 0)', + 'lch(87%, 0, 0)', + 'lch(88%, 0, 0)', + 'lch(89%, 0, 0)', + 'lch(90%, 0, 0)', + 'lch(91%, 0, 0)', + 'lch(92%, 0, 0)', + 'lch(93%, 0, 0)', + 'lch(94%, 0, 0)', + 'lch(95%, 0, 0)', + 'lch(96%, 0, 0)', + 'lch(97%, 0, 0)', + 'lch(98%, 0, 0)', + 'lch(99%, 0, 0)', + 'lch(100%, 0, 0)' ]); }); test('should generate 101 grayscale colors with LCH output (updated)', (t) => { @@ -1459,106 +1459,106 @@ test('should generate 101 grayscale colors with LCH output (updated)', (t) => { const colors = color.backgroundColorScale; t.deepEqual(colors, [ - 'lch(0%, 0, 0deg)', - 'lch(1%, 0, 0deg)', - 'lch(2%, 0, 0deg)', - 'lch(3%, 0, 0deg)', - 'lch(4%, 0, 0deg)', - 'lch(5%, 0, 0deg)', - 'lch(6%, 0, 0deg)', - 'lch(7%, 0, 0deg)', - 'lch(8%, 0, 0deg)', - 'lch(9%, 0, 0deg)', - 'lch(10%, 0, 0deg)', - 'lch(11%, 0, 0deg)', - 'lch(12%, 0, 0deg)', - 'lch(13%, 0, 0deg)', - 'lch(14%, 0, 0deg)', - 'lch(15%, 0, 0deg)', - 'lch(16%, 0, 0deg)', - 'lch(17%, 0, 0deg)', - 'lch(18%, 0, 0deg)', - 'lch(19%, 0, 0deg)', - 'lch(20%, 0, 0deg)', - 'lch(21%, 0, 0deg)', - 'lch(22%, 0, 0deg)', - 'lch(23%, 0, 0deg)', - 'lch(24%, 0, 0deg)', - 'lch(25%, 0, 0deg)', - 'lch(26%, 0, 0deg)', - 'lch(27%, 0, 0deg)', - 'lch(28%, 0, 0deg)', - 'lch(29%, 0, 0deg)', - 'lch(30%, 0, 0deg)', - 'lch(31%, 0, 0deg)', - 'lch(32%, 0, 0deg)', - 'lch(33%, 0, 0deg)', - 'lch(34%, 0, 0deg)', - 'lch(35%, 0, 0deg)', - 'lch(36%, 0, 0deg)', - 'lch(37%, 0, 0deg)', - 'lch(38%, 0, 0deg)', - 'lch(39%, 0, 0deg)', - 'lch(40%, 0, 0deg)', - 'lch(41%, 0, 0deg)', - 'lch(42%, 0, 0deg)', - 'lch(43%, 0, 0deg)', - 'lch(44%, 0, 0deg)', - 'lch(45%, 0, 0deg)', - 'lch(46%, 0, 0deg)', - 'lch(47%, 0, 0deg)', - 'lch(48%, 0, 0deg)', - 'lch(49%, 0, 0deg)', - 'lch(50%, 0, 0deg)', - 'lch(51%, 0, 0deg)', - 'lch(52%, 0, 0deg)', - 'lch(53%, 0, 0deg)', - 'lch(54%, 0, 0deg)', - 'lch(55%, 0, 0deg)', - 'lch(56%, 0, 0deg)', - 'lch(57%, 0, 0deg)', - 'lch(58%, 0, 0deg)', - 'lch(59%, 0, 0deg)', - 'lch(60%, 0, 0deg)', - 'lch(61%, 0, 0deg)', - 'lch(62%, 0, 0deg)', - 'lch(63%, 0, 0deg)', - 'lch(64%, 0, 0deg)', - 'lch(65%, 0, 0deg)', - 'lch(66%, 0, 0deg)', - 'lch(67%, 0, 0deg)', - 'lch(68%, 0, 0deg)', - 'lch(69%, 0, 0deg)', - 'lch(70%, 0, 0deg)', - 'lch(71%, 0, 0deg)', - 'lch(72%, 0, 0deg)', - 'lch(73%, 0, 0deg)', - 'lch(74%, 0, 0deg)', - 'lch(75%, 0, 0deg)', - 'lch(76%, 0, 0deg)', - 'lch(77%, 0, 0deg)', - 'lch(78%, 0, 0deg)', - 'lch(79%, 0, 0deg)', - 'lch(80%, 0, 0deg)', - 'lch(81%, 0, 0deg)', - 'lch(82%, 0, 0deg)', - 'lch(83%, 0, 0deg)', - 'lch(84%, 0, 0deg)', - 'lch(85%, 0, 0deg)', - 'lch(86%, 0, 0deg)', - 'lch(87%, 0, 0deg)', - 'lch(88%, 0, 0deg)', - 'lch(89%, 0, 0deg)', - 'lch(90%, 0, 0deg)', - 'lch(91%, 0, 0deg)', - 'lch(92%, 0, 0deg)', - 'lch(93%, 0, 0deg)', - 'lch(94%, 0, 0deg)', - 'lch(95%, 0, 0deg)', - 'lch(96%, 0, 0deg)', - 'lch(97%, 0, 0deg)', - 'lch(98%, 0, 0deg)', - 'lch(99%, 0, 0deg)', - 'lch(100%, 0, 0deg)' + 'lch(0%, 0, 0)', + 'lch(1%, 0, 0)', + 'lch(2%, 0, 0)', + 'lch(3%, 0, 0)', + 'lch(4%, 0, 0)', + 'lch(5%, 0, 0)', + 'lch(6%, 0, 0)', + 'lch(7%, 0, 0)', + 'lch(8%, 0, 0)', + 'lch(9%, 0, 0)', + 'lch(10%, 0, 0)', + 'lch(11%, 0, 0)', + 'lch(12%, 0, 0)', + 'lch(13%, 0, 0)', + 'lch(14%, 0, 0)', + 'lch(15%, 0, 0)', + 'lch(16%, 0, 0)', + 'lch(17%, 0, 0)', + 'lch(18%, 0, 0)', + 'lch(19%, 0, 0)', + 'lch(20%, 0, 0)', + 'lch(21%, 0, 0)', + 'lch(22%, 0, 0)', + 'lch(23%, 0, 0)', + 'lch(24%, 0, 0)', + 'lch(25%, 0, 0)', + 'lch(26%, 0, 0)', + 'lch(27%, 0, 0)', + 'lch(28%, 0, 0)', + 'lch(29%, 0, 0)', + 'lch(30%, 0, 0)', + 'lch(31%, 0, 0)', + 'lch(32%, 0, 0)', + 'lch(33%, 0, 0)', + 'lch(34%, 0, 0)', + 'lch(35%, 0, 0)', + 'lch(36%, 0, 0)', + 'lch(37%, 0, 0)', + 'lch(38%, 0, 0)', + 'lch(39%, 0, 0)', + 'lch(40%, 0, 0)', + 'lch(41%, 0, 0)', + 'lch(42%, 0, 0)', + 'lch(43%, 0, 0)', + 'lch(44%, 0, 0)', + 'lch(45%, 0, 0)', + 'lch(46%, 0, 0)', + 'lch(47%, 0, 0)', + 'lch(48%, 0, 0)', + 'lch(49%, 0, 0)', + 'lch(50%, 0, 0)', + 'lch(51%, 0, 0)', + 'lch(52%, 0, 0)', + 'lch(53%, 0, 0)', + 'lch(54%, 0, 0)', + 'lch(55%, 0, 0)', + 'lch(56%, 0, 0)', + 'lch(57%, 0, 0)', + 'lch(58%, 0, 0)', + 'lch(59%, 0, 0)', + 'lch(60%, 0, 0)', + 'lch(61%, 0, 0)', + 'lch(62%, 0, 0)', + 'lch(63%, 0, 0)', + 'lch(64%, 0, 0)', + 'lch(65%, 0, 0)', + 'lch(66%, 0, 0)', + 'lch(67%, 0, 0)', + 'lch(68%, 0, 0)', + 'lch(69%, 0, 0)', + 'lch(70%, 0, 0)', + 'lch(71%, 0, 0)', + 'lch(72%, 0, 0)', + 'lch(73%, 0, 0)', + 'lch(74%, 0, 0)', + 'lch(75%, 0, 0)', + 'lch(76%, 0, 0)', + 'lch(77%, 0, 0)', + 'lch(78%, 0, 0)', + 'lch(79%, 0, 0)', + 'lch(80%, 0, 0)', + 'lch(81%, 0, 0)', + 'lch(82%, 0, 0)', + 'lch(83%, 0, 0)', + 'lch(84%, 0, 0)', + 'lch(85%, 0, 0)', + 'lch(86%, 0, 0)', + 'lch(87%, 0, 0)', + 'lch(88%, 0, 0)', + 'lch(89%, 0, 0)', + 'lch(90%, 0, 0)', + 'lch(91%, 0, 0)', + 'lch(92%, 0, 0)', + 'lch(93%, 0, 0)', + 'lch(94%, 0, 0)', + 'lch(95%, 0, 0)', + 'lch(96%, 0, 0)', + 'lch(97%, 0, 0)', + 'lch(98%, 0, 0)', + 'lch(99%, 0, 0)', + 'lch(100%, 0, 0)' ]); }); diff --git a/packages/contrast-colors/test/convertColorValue.test.js b/packages/contrast-colors/test/convertColorValue.test.js index d84f3da8..fbb14cd3 100644 --- a/packages/contrast-colors/test/convertColorValue.test.js +++ b/packages/contrast-colors/test/convertColorValue.test.js @@ -19,7 +19,7 @@ test('should return color object for HSL color', (t) => { test('should return string format for HSL color', (t) => { let result = convertColorValue('#2c66f1', 'HSL'); - t.is(result, 'hsl(222deg, 88%, 56%)'); + t.is(result, 'hsl(222, 88%, 56%)'); }); test('should return color object for RGB color', (t) => { @@ -49,7 +49,7 @@ test('should return color object for HSV color', (t) => { test('should return string format for HSV color', (t) => { let result = convertColorValue('#2c66f1', 'HSV'); - t.is(result, 'hsv(222deg, 82%, 95%)'); + t.is(result, 'hsv(222, 82%, 95%)'); }); test('should return color object for HSLuv color', (t) => { @@ -79,7 +79,7 @@ test('should return color object for LCH color', (t) => { test('should return string format for LCH color', (t) => { let result = convertColorValue('#2c66f1', 'LCH'); - t.is(result, 'lch(47%, 81, 293deg)'); + t.is(result, 'lch(47%, 81, 293)'); }); test('should return color object for CAM02 color', (t) => { @@ -99,7 +99,7 @@ test('should return color object for CAM02 (polar) color', (t) => { test('should return string format for CAM02 (polar) color', (t) => { let result = convertColorValue('#2c66f1', 'CAM02p'); - t.is(result, 'jch(36%, 75, 258deg)'); + t.is(result, 'jch(36%, 75, 258)'); }); test('should throw error for missing output format', (t) => { diff --git a/packages/contrast-colors/test/theme.test.js b/packages/contrast-colors/test/theme.test.js index b39dfd05..ed961ab4 100644 --- a/packages/contrast-colors/test/theme.test.js +++ b/packages/contrast-colors/test/theme.test.js @@ -157,40 +157,40 @@ test('should generate theme for three colors in LCH format', (t) => { const themeColors = theme.contrastColors; t.deepEqual(themeColors, [ - {background: 'lch(90%, 0, 0deg)'}, + {background: 'lch(90%, 0, 0)'}, { name: 'gray', values: [ - {name: 'gray100', contrast: 1, value: 'lch(90%, 0, 0deg)'}, - {name: 'gray200', contrast: 1.2, value: 'lch(83%, 0, 0deg)'}, - {name: 'gray300', contrast: 1.4, value: 'lch(77%, 0, 0deg)'}, - {name: 'gray400', contrast: 2, value: 'lch(66%, 0, 0deg)'}, - {name: 'gray500', contrast: 3, value: 'lch(54%, 0, 0deg)'}, - {name: 'gray600', contrast: 4.5, value: 'lch(42%, 0, 0deg)'}, - {name: 'gray700', contrast: 6, value: 'lch(34%, 0, 0deg)'}, - {name: 'gray800', contrast: 8, value: 'lch(27%, 0, 0deg)'}, - {name: 'gray900', contrast: 12, value: 'lch(14%, 0, 0deg)'}, - {name: 'gray1000', contrast: 21, value: 'lch(0%, 0, 0deg)'} + {name: 'gray100', contrast: 1, value: 'lch(90%, 0, 0)'}, + {name: 'gray200', contrast: 1.2, value: 'lch(83%, 0, 0)'}, + {name: 'gray300', contrast: 1.4, value: 'lch(77%, 0, 0)'}, + {name: 'gray400', contrast: 2, value: 'lch(66%, 0, 0)'}, + {name: 'gray500', contrast: 3, value: 'lch(54%, 0, 0)'}, + {name: 'gray600', contrast: 4.5, value: 'lch(42%, 0, 0)'}, + {name: 'gray700', contrast: 6, value: 'lch(34%, 0, 0)'}, + {name: 'gray800', contrast: 8, value: 'lch(27%, 0, 0)'}, + {name: 'gray900', contrast: 12, value: 'lch(14%, 0, 0)'}, + {name: 'gray1000', contrast: 21, value: 'lch(0%, 0, 0)'} ] }, { name: 'blue', values: [ - {name: 'blue100', contrast: 2, value: 'lch(66%, 66, 307deg)'}, - {name: 'blue200', contrast: 3, value: 'lch(54%, 90, 306deg)'}, - {name: 'blue300', contrast: 4.5, value: 'lch(42%, 113, 306deg)'}, - {name: 'blue400', contrast: 8, value: 'lch(27%, 111, 306deg)'}, - {name: 'blue500', contrast: 12, value: 'lch(14%, 57, 306deg)'} + {name: 'blue100', contrast: 2, value: 'lch(66%, 66, 307)'}, + {name: 'blue200', contrast: 3, value: 'lch(54%, 90, 306)'}, + {name: 'blue300', contrast: 4.5, value: 'lch(42%, 113, 306)'}, + {name: 'blue400', contrast: 8, value: 'lch(27%, 111, 306)'}, + {name: 'blue500', contrast: 12, value: 'lch(14%, 57, 306)'} ] }, { name: 'red', values: [ - {name: 'red100', contrast: 2, value: 'lch(66%, 59, 26deg)'}, - {name: 'red200', contrast: 3, value: 'lch(54%, 101, 39deg)'}, - {name: 'red300', contrast: 4.5, value: 'lch(43%, 88, 40deg)'}, - {name: 'red400', contrast: 8, value: 'lch(27%, 63, 39deg)'}, - {name: 'red500', contrast: 12, value: 'lch(14%, 40, 32deg)'} + {name: 'red100', contrast: 2, value: 'lch(66%, 59, 26)'}, + {name: 'red200', contrast: 3, value: 'lch(54%, 101, 39)'}, + {name: 'red300', contrast: 4.5, value: 'lch(43%, 88, 40)'}, + {name: 'red400', contrast: 8, value: 'lch(27%, 63, 39)'}, + {name: 'red500', contrast: 12, value: 'lch(14%, 40, 32)'} ] } ]); @@ -1181,7 +1181,7 @@ test('should generate 2 colors in HSL format', (t) => { }); const themeColors = theme.contrastColorValues; - t.deepEqual(themeColors, ['hsl(215deg, 69%, 60%)', 'hsl(222deg, 87%, 55%)']); + t.deepEqual(themeColors, ['hsl(215, 69%, 60%)', 'hsl(222, 87%, 55%)']); }); test('should generate 2 colors in HSV format', (t) => { const color = new Color({ @@ -1197,7 +1197,7 @@ test('should generate 2 colors in HSV format', (t) => { }); const themeColors = theme.contrastColorValues; - t.deepEqual(themeColors, ['hsv(215deg, 63%, 88%)', 'hsv(222deg, 82%, 94%)']); + t.deepEqual(themeColors, ['hsv(215, 63%, 88%)', 'hsv(222, 82%, 94%)']); }); test('should generate 2 colors in LAB format', (t) => { const color = new Color({ @@ -1230,7 +1230,7 @@ test('should generate 2 colors in LCH format', (t) => { const themeColors = theme.contrastColorValues; - t.deepEqual(themeColors, ['lch(59%, 47, 277deg)', 'lch(47%, 81, 293deg)']); + t.deepEqual(themeColors, ['lch(59%, 47, 277)', 'lch(47%, 81, 293)']); }); // Add color to theme diff --git a/packages/contrast-colors/test/themeSetters.test.js b/packages/contrast-colors/test/themeSetters.test.js index 21e94c10..f2b04ea0 100644 --- a/packages/contrast-colors/test/themeSetters.test.js +++ b/packages/contrast-colors/test/themeSetters.test.js @@ -59,7 +59,7 @@ test('should set theme output to HSL', (t) => { }); theme.output = 'HSL'; const themeColors = theme.contrastColorValues; - t.deepEqual(themeColors, ['hsl(215deg, 69%, 60%)', 'hsl(222deg, 87%, 55%)']); + t.deepEqual(themeColors, ['hsl(215, 69%, 60%)', 'hsl(222, 87%, 55%)']); }); test('should set theme output to HSV', (t) => { const color = new Color({ @@ -75,7 +75,7 @@ test('should set theme output to HSV', (t) => { }); theme.output = 'HSV'; const themeColors = theme.contrastColorValues; - t.deepEqual(themeColors, ['hsv(215deg, 63%, 88%)', 'hsv(222deg, 82%, 94%)']); + t.deepEqual(themeColors, ['hsv(215, 63%, 88%)', 'hsv(222, 82%, 94%)']); }); test('should set theme output to LAB', (t) => { const color = new Color({ @@ -107,7 +107,7 @@ test('should set theme output to LCH', (t) => { }); theme.output = 'LCH'; const themeColors = theme.contrastColorValues; - t.deepEqual(themeColors, ['lch(59%, 47, 277deg)', 'lch(47%, 81, 293deg)']); + t.deepEqual(themeColors, ['lch(59%, 47, 277)', 'lch(47%, 81, 293)']); }); // Saturation