完成世界书、骰子、apiconfig页面处理
This commit is contained in:
66
frontend/node_modules/khroma/test/color/hex.js
generated
vendored
Normal file
66
frontend/node_modules/khroma/test/color/hex.js
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
|
||||
/* IMPORT */
|
||||
|
||||
import {describe} from 'fava';
|
||||
import Color from '../../dist/color/index.js';
|
||||
|
||||
/* MAIN */
|
||||
|
||||
describe ( 'Hex', it => {
|
||||
|
||||
it ( 'parses hex colors', t => {
|
||||
|
||||
const tests = [
|
||||
/* RGB */
|
||||
['#000', '#000000'],
|
||||
['#fff', '#ffffff'],
|
||||
['#a2b', '#aa22bb'],
|
||||
['#a2B', '#aa22bb'],
|
||||
/* RGBA */
|
||||
['#0000', '#00000000'],
|
||||
['#fffF', '#ffffff'],
|
||||
['#fff8', '#ffffff88'],
|
||||
['#a2bf', '#aa22bb'],
|
||||
['#a2Bf', '#aa22bb'],
|
||||
/* RRGGBB */
|
||||
['#000000', '#000000'],
|
||||
['#FFFFFF', '#ffffff'],
|
||||
['#ffffff', '#ffffff'],
|
||||
['#ae12b4', '#ae12b4'],
|
||||
['#Ae12B4', '#ae12b4'],
|
||||
/* RRGGBBAA */
|
||||
['#000000ff', '#000000'],
|
||||
['#00000000', '#00000000'],
|
||||
['#ffffffa8', '#ffffffa8'],
|
||||
['#ffffffA8', '#ffffffa8']
|
||||
];
|
||||
|
||||
tests.forEach ( ([ input, output ]) => {
|
||||
t.is ( Color.format.hex.stringify ( Color.parse ( input ) ), output );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
it ( 'throws with unsupported colors', t => {
|
||||
|
||||
const colors = [
|
||||
'#',
|
||||
'#0',
|
||||
'#00',
|
||||
'#ggg',
|
||||
'#zzz',
|
||||
'fff',
|
||||
'#0 0 0',
|
||||
'# 000',
|
||||
'#aabbc',
|
||||
'#aabbccd',
|
||||
'#aabbccdde'
|
||||
];
|
||||
|
||||
colors.forEach ( color => {
|
||||
t.throws ( () => Color.parse ( color ), /unsupported/i );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
73
frontend/node_modules/khroma/test/color/rgb.js
generated
vendored
Normal file
73
frontend/node_modules/khroma/test/color/rgb.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
|
||||
/* IMPORT */
|
||||
|
||||
import {describe} from 'fava';
|
||||
import Color from '../../dist/color/index.js';
|
||||
|
||||
/* MAIN */
|
||||
|
||||
describe ( 'RGB', it => {
|
||||
|
||||
it ( 'parses RGB colors', t => {
|
||||
|
||||
const tests = [
|
||||
/* DECIAML 0~255 */
|
||||
['rgb(1, 20, 255)', 'rgb(1, 20, 255)'],
|
||||
['rgb(1.99, 20.5, 255)', 'rgb(1.99, 20.5, 255)'],
|
||||
['rgb(300, 255, -100)', 'rgb(255, 255, 0)'],
|
||||
/* PERCENTAGE 0~100 */
|
||||
['rgb(10%, 20%, 30%)', 'rgb(25.5, 51, 76.5)'],
|
||||
['rgb(10.5%, 20.7%, 30%)', 'rgb(26.775, 52.785, 76.5)'],
|
||||
['rgb(100% 200% -30%)', 'rgb(255, 255, 0)'],
|
||||
/* WITH COMMAS AND WEIRD SPACES */
|
||||
['rgb( 1 , 20 , 255 )', 'rgb(1, 20, 255)'],
|
||||
['rgb(1,20,255)', 'rgb(1, 20, 255)'],
|
||||
['rgb( 1,20,255 )', 'rgb(1, 20, 255)'],
|
||||
/* WITHOUT COMMAS */
|
||||
['rgb(10% 20% 30%)', 'rgb(25.5, 51, 76.5)'],
|
||||
['rgb(1 20 255)', 'rgb(1, 20, 255)'],
|
||||
['rgb( 1 20 255 )', 'rgb(1, 20, 255)'],
|
||||
/* MIXED UNITS */
|
||||
['rgb(10% 20 30%)', 'rgb(25.5, 20, 76.5)'],
|
||||
['rgb(1 25.5 25.5)', 'rgb(1, 25.5, 25.5)'],
|
||||
/* WEIRD CASING */
|
||||
['RGB(1, 20, 255)', 'rgb(1, 20, 255)'],
|
||||
['rGb(1, 20, 255)', 'rgb(1, 20, 255)']
|
||||
];
|
||||
|
||||
tests.forEach ( ([ input, output ]) => {
|
||||
t.is ( Color.format.rgb.stringify ( Color.parse ( input ) ), output );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
it ( 'throws with unsupported colors', t => {
|
||||
|
||||
const colors = [
|
||||
'rgb()',
|
||||
'rgb(1, 2, 3, 4, 5)',
|
||||
'rgb(1/2/3)',
|
||||
'rgb(1,, 20, 255)',
|
||||
'rgb(1%,, 20%, 255%)',
|
||||
'rgb(1%, 255%)',
|
||||
'rgb(1%, 10%%, 255%)',
|
||||
'rgb(1%, %10%, 255%)',
|
||||
'rgb(1)',
|
||||
'rgb(1, 20, 255',
|
||||
'rgb 1, 20, 255',
|
||||
'rgb 1, 20, 255)',
|
||||
'rgb(1, a, 255)',
|
||||
'rgb (1, 2, 255)',
|
||||
'rgb(1,2,3..5)',
|
||||
'rgb(1, 2, 3.4.5)',
|
||||
'rgbQ(1, 2, 255)',
|
||||
'r g b(1, 2, 255)'
|
||||
];
|
||||
|
||||
colors.forEach ( color => {
|
||||
t.throws ( () => Color.parse ( color ), /unsupported/i );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
78
frontend/node_modules/khroma/test/color/rgba.js
generated
vendored
Normal file
78
frontend/node_modules/khroma/test/color/rgba.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
|
||||
/* IMPORT */
|
||||
|
||||
import {describe} from 'fava';
|
||||
import Color from '../../dist/color/index.js';
|
||||
|
||||
/* MAIN */
|
||||
|
||||
describe ( 'RGBA', it => {
|
||||
|
||||
it ( 'parses RGBA colors', t => {
|
||||
|
||||
const tests = [
|
||||
/* FRACTION 0~1 */
|
||||
['rgba(0, 0, 0, 0)', 'rgba(0, 0, 0, 0)'],
|
||||
['rgba(0, 0, 0)', 'rgb(0, 0, 0)'],
|
||||
['rgba(0, 0, 0, 10)', 'rgb(0, 0, 0)'],
|
||||
['rgba(0, 0, 0, -10)', 'rgba(0, 0, 0, 0)'],
|
||||
['rgba(0, 0, 0, 0.5)', 'rgba(0, 0, 0, 0.5)'],
|
||||
['rgba(0, 0, 0, .5)', 'rgba(0, 0, 0, 0.5)'],
|
||||
['rgba(0, 0, 0, 0.5 )', 'rgba(0, 0, 0, 0.5)'],
|
||||
/* PERCENTAGE 0~100 */
|
||||
['rgba(0, 0, 0, 0%)', 'rgba(0, 0, 0, 0)'],
|
||||
['rgba(0, 0, 0, 100%)', 'rgb(0, 0, 0)'],
|
||||
['rgba(0, 0, 0, 110%)', 'rgb(0, 0, 0)'],
|
||||
['rgba(0, 0, 0, -110%)', 'rgba(0, 0, 0, 0)'],
|
||||
['rgba(0, 0, 0, 50%)', 'rgba(0, 0, 0, 0.5)'],
|
||||
['rgba(0, 0, 0, 50.5%)', 'rgba(0, 0, 0, 0.505)'],
|
||||
/* WITH COMMAS AND WEIRD SPACES */
|
||||
['rgba( 1 , 20 , 255, 0.5 )', 'rgba(1, 20, 255, 0.5)'],
|
||||
['rgba(1,20,255,50%)', 'rgba(1, 20, 255, 0.5)'],
|
||||
['rgba( 1,20,255,0.5 )', 'rgba(1, 20, 255, 0.5)'],
|
||||
/* WITH SLASH */
|
||||
['rgba(51 170 51 / 0.4)', 'rgba(51, 170, 51, 0.4)'],
|
||||
['rgba(51 170 51/0.4)', 'rgba(51, 170, 51, 0.4)'],
|
||||
['rgba(51 170 51 / 40%)', 'rgba(51, 170, 51, 0.4)'],
|
||||
['rgba(51, 170, 51 / 40%)', 'rgba(51, 170, 51, 0.4)'],
|
||||
['rgba(51,170,51/40%)', 'rgba(51, 170, 51, 0.4)'],
|
||||
/* SCIENTIFIC NOTATION */
|
||||
['rgba(1e2, .5e1, .5e0, +.25e2%)', 'rgba(100, 5, 0.5, 0.25)'],
|
||||
['rgba(1e2, .5e1, .5e0, +.25e1%)', 'rgba(100, 5, 0.5, 0.025)'],
|
||||
['rgba(1e2, .5e1, .5e0, +.25e0%)', 'rgba(100, 5, 0.5, 0.0025)'],
|
||||
['rgba(1e2, .5e1, .5e0, .25e0)', 'rgba(100, 5, 0.5, 0.25)'],
|
||||
['rgba(1e2, .5e1, .5e0, .25e1)', 'rgb(100, 5, 0.5)'],
|
||||
/* MIXED UNITS */
|
||||
['rgba(1, 10%, .5e0, +.25e2%)', 'rgba(1, 25.5, 0.5, 0.25)'],
|
||||
/* WEIRD CASING */
|
||||
['RGBA(1, 20, 255, 0.5)', 'rgba(1, 20, 255, 0.5)'],
|
||||
['rgbA(1, 20, 255, 0.5)', 'rgba(1, 20, 255, 0.5)']
|
||||
];
|
||||
|
||||
tests.forEach ( ([ input, output ]) => {
|
||||
t.is ( Color.format.rgba.stringify ( Color.parse ( input ) ), output );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
it ( 'throws with unsupported colors', t => {
|
||||
|
||||
const colors = [
|
||||
'rgba()',
|
||||
'rgba(51 170 51 0.4)',
|
||||
'rgba(1, 2, 3, 4, 5)',
|
||||
'rgba(0, 0, 0, 0..5)',
|
||||
'rgba(0, 0, 0, 0.5.)',
|
||||
'rgba(0, 0, 0, 0%%)',
|
||||
'rgba(51 170 51 // 0.4)',
|
||||
'rgba(1ee2, .5e1, .5e0, +.25e2%)',
|
||||
'rgba(1f2, .5e1, .5e0, +.25e2%)'
|
||||
];
|
||||
|
||||
colors.forEach ( color => {
|
||||
t.throws ( () => Color.parse ( color ), /unsupported/i );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
89
frontend/node_modules/khroma/test/methods/adjust.js
generated
vendored
Normal file
89
frontend/node_modules/khroma/test/methods/adjust.js
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
|
||||
/* IMPORT */
|
||||
|
||||
import {describe} from 'fava';
|
||||
import {adjust} from '../../dist/index.js';
|
||||
import Color from '../../dist/color/index.js';
|
||||
|
||||
/* MAIN */
|
||||
|
||||
describe ( 'adjust', it => {
|
||||
|
||||
it ( 'increases or decreases the value of any RGB channel of the color', t => {
|
||||
|
||||
const tests = [
|
||||
[['rgb(0, 0, 0)', { r: 100 }], 'rgb(100, 0, 0)'],
|
||||
[['rgb(0, 0, 0)', { g: 100 }], 'rgb(0, 100, 0)'],
|
||||
[['rgb(0, 0, 0)', { b: 100 }], 'rgb(0, 0, 100)'],
|
||||
[['rgb(0, 0, 0)', { r: 100, g: 100 }], 'rgb(100, 100, 0)'],
|
||||
[['rgb(0, 0, 0)', { r: 100, g: 100, b: 100 }], 'rgb(100, 100, 100)'],
|
||||
[['rgb(255, 255, 255)', { r: -100 }], 'rgb(155, 255, 255)'],
|
||||
[['rgb(255, 255, 255)', { g: -100 }], 'rgb(255, 155, 255)'],
|
||||
[['rgb(255, 255, 255)', { b: -100 }], 'rgb(255, 255, 155)'],
|
||||
[['rgb(200, 0, 0)', { r: 100 }], 'rgb(255, 0, 0)'],
|
||||
[['rgb(100, 0, 0)', { r: -200 }], 'rgb(0, 0, 0)']
|
||||
];
|
||||
|
||||
tests.forEach ( ([ args, output ]) => {
|
||||
t.is ( Color.format.rgb.stringify ( Color.parse ( adjust ( ...args ) ) ), output );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
it ( 'increases or decreases the value of any HSL channel of the color', t => {
|
||||
|
||||
const tests = [
|
||||
[['hsl(0, 50%, 50%)', { h: 100 }], 'hsl(100, 50%, 50%)'],
|
||||
[['hsl(0, 50%, 50%)', { s: 25 }], 'hsl(0, 75%, 50%)'],
|
||||
[['hsl(0, 50%, 50%)', { l: 25 }], 'hsl(0, 50%, 75%)'],
|
||||
[['hsl(0, 50%, 50%)', { h: 100, s: 25 }], 'hsl(100, 75%, 50%)'],
|
||||
[['hsl(0, 50%, 50%)', { h: 100, s: 25, l: 25 }], 'hsl(100, 75%, 75%)'],
|
||||
[['hsl(100, 50%, 50%)', { h: -100 }], 'hsl(0, 50%, 50%)'],
|
||||
[['hsl(0, 50%, 50%)', { s: -25 }], 'hsl(0, 25%, 50%)'],
|
||||
[['hsl(0, 50%, 50%)', { l: -25 }], 'hsl(0, 50%, 25%)'],
|
||||
[['hsl(300, 50%, 50%)', { h: 100 }], 'hsl(40, 50%, 50%)'],
|
||||
[['hsl(0, 50%, 50%)', { h: -100 }], 'hsl(-100, 50%, 50%)'],
|
||||
[['hsl(0, 100%, 50%)', { s: 25 }], 'hsl(0, 100%, 50%)'],
|
||||
[['hsl(0, 0%, 50%)', { s: -25 }], 'hsl(0, 0%, 50%)'],
|
||||
[['hsla(0, 0%, 50%, .5)', { s: -25 }], 'hsla(0, 0%, 50%, 0.5)']
|
||||
];
|
||||
|
||||
tests.forEach ( ([ args, output ]) => {
|
||||
t.is ( Color.format.hsl.stringify ( Color.parse ( adjust ( ...args ) ) ), output );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
it ( 'increases or decreases the value of the alpha channel of the color', t => {
|
||||
|
||||
const tests = [
|
||||
[['rgba(0, 0, 0, 0)', { a: 0.5 }], 'rgba(0, 0, 0, 0.5)'],
|
||||
[['hsla(0, 0%, 0%, 0)', { a: 0.5 }], 'hsla(0, 0%, 0%, 0.5)'],
|
||||
[['rgba(0, 0, 0, 0)', { a: 1 }], '#000000'],
|
||||
[['rgba(0, 0, 0, 1)', { a: -0.5 }], 'rgba(0, 0, 0, 0.5)'],
|
||||
[['rgba(0, 0, 0, 1)', { a: -1 }], 'rgba(0, 0, 0, 0)'],
|
||||
[['rgba(0, 0, 0, 0.5)', { a: 1 }], '#000000'],
|
||||
[['rgba(0, 0, 0, 0.5)', { a: -1 }], 'rgba(0, 0, 0, 0)']
|
||||
];
|
||||
|
||||
tests.forEach ( ([ args, output ]) => {
|
||||
t.is ( adjust ( ...args ), output );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
it ( 'throws when setting RGB and HSL channels at the same time', t => {
|
||||
|
||||
const tests = [
|
||||
['#000', { r: 10, h: 10 }],
|
||||
['#000', { g: 10, l: 10 }],
|
||||
['#000', { b: 10, s: 10 }]
|
||||
];
|
||||
|
||||
tests.forEach ( args => {
|
||||
t.throws ( () => adjust ( ...args ), /cannot.*at the same time/i );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
25
frontend/node_modules/khroma/test/methods/complement.js
generated
vendored
Normal file
25
frontend/node_modules/khroma/test/methods/complement.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
/* IMPORT */
|
||||
|
||||
import {describe} from 'fava';
|
||||
import {complement} from '../../dist/index.js';
|
||||
|
||||
/* MAIN */
|
||||
|
||||
describe ( 'complement', it => {
|
||||
|
||||
it ( 'gets the complement of the color', t => {
|
||||
|
||||
const tests = [
|
||||
['#6b717f', 'hsl(42, 8.547008547%, 45.8823529412%)'],
|
||||
['#d2e1dd', 'hsl(344, 20%, 85.2941176471%)'],
|
||||
['#036', 'hsl(30, 100%, 20%)']
|
||||
];
|
||||
|
||||
tests.forEach ( ([ color, output ]) => {
|
||||
t.is ( complement ( color ), output );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
28
frontend/node_modules/khroma/test/methods/contrast.js
generated
vendored
Normal file
28
frontend/node_modules/khroma/test/methods/contrast.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
/* IMPORT */
|
||||
|
||||
import {describe} from 'fava';
|
||||
import {contrast} from '../../dist/index.js';
|
||||
|
||||
/* MAIN */
|
||||
|
||||
describe ( 'contrast', it => {
|
||||
|
||||
it ( 'gets the contrast ratio between two colors', t => {
|
||||
|
||||
const tests = [
|
||||
['#000000', '#000000', 1],
|
||||
['#ffffff', '#ffffff', 1],
|
||||
['#000000', '#ffffff', 10],
|
||||
['#ffffff', '#000000', 10],
|
||||
['#888888', '#ffffff', 4.0617165366],
|
||||
['#ffffff', '#888888', 4.0617165366]
|
||||
];
|
||||
|
||||
tests.forEach ( ([ color1, color2, output ]) => {
|
||||
t.is ( contrast ( color1, color2 ), output );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
27
frontend/node_modules/khroma/test/methods/darken.js
generated
vendored
Normal file
27
frontend/node_modules/khroma/test/methods/darken.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
/* IMPORT */
|
||||
|
||||
import {describe} from 'fava';
|
||||
import {darken} from '../../dist/index.js';
|
||||
|
||||
/* MAIN */
|
||||
|
||||
describe ( 'darken', it => {
|
||||
|
||||
it ( 'decreases the lightness channel of the color', t => {
|
||||
|
||||
const tests = [
|
||||
[['hsl(0, 0%, 100%)', 0], 'hsl(0, 0%, 100%)'],
|
||||
[['hsl(0, 0%, 100%)', 50], 'hsl(0, 0%, 50%)'],
|
||||
[['hsl(0, 0%, 100%)', 75], 'hsl(0, 0%, 25%)'],
|
||||
[['hsl(0, 0%, 100%)', 100], 'hsl(0, 0%, 0%)'],
|
||||
[['hsl(0, 0%, 50%)', 100], 'hsl(0, 0%, 0%)']
|
||||
];
|
||||
|
||||
tests.forEach ( ([ args, output ]) => {
|
||||
t.is ( darken ( ...args ), output );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
28
frontend/node_modules/khroma/test/methods/desaturate.js
generated
vendored
Normal file
28
frontend/node_modules/khroma/test/methods/desaturate.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
/* IMPORT */
|
||||
|
||||
import {describe} from 'fava';
|
||||
import {desaturate} from '../../dist/index.js';
|
||||
|
||||
/* MAIN */
|
||||
|
||||
describe ( 'desaturate', it => {
|
||||
|
||||
it ( 'decreases the saturation channel of the color', t => {
|
||||
|
||||
const tests = [
|
||||
[['hsl(0, 100%, 50%)', 0], 'hsl(0, 100%, 50%)'],
|
||||
[['hsl(0, 100%, 50%)', 50], 'hsl(0, 50%, 50%)'],
|
||||
[['hsl(0, 100%, 50%)', 75], 'hsl(0, 25%, 50%)'],
|
||||
[['hsl(0, 100%, 50%)', 100], 'hsl(0, 0%, 50%)'],
|
||||
[['hsl(0, 50%, 50%)', 100], 'hsl(0, 0%, 50%)'],
|
||||
[['hsl(0, 0%, 50%)', 100], 'hsl(0, 0%, 50%)']
|
||||
];
|
||||
|
||||
tests.forEach ( ([ args, output ]) => {
|
||||
t.is ( desaturate ( ...args ), output );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
25
frontend/node_modules/khroma/test/methods/grayscale.js
generated
vendored
Normal file
25
frontend/node_modules/khroma/test/methods/grayscale.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
/* IMPORT */
|
||||
|
||||
import {describe} from 'fava';
|
||||
import {grayscale} from '../../dist/index.js';
|
||||
|
||||
/* MAIN */
|
||||
|
||||
describe ( 'grayscale', it => {
|
||||
|
||||
it ( 'gets the grayscale version of the color', t => {
|
||||
|
||||
const tests = [
|
||||
['#6b717f', 'hsl(222, 0%, 45.8823529412%)'],
|
||||
['#d2e1dd', 'hsl(164, 0%, 85.2941176471%)'],
|
||||
['#036', 'hsl(210, 0%, 20%)']
|
||||
];
|
||||
|
||||
tests.forEach ( ([ color, output ]) => {
|
||||
t.is ( grayscale ( color ), output );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
41
frontend/node_modules/khroma/test/methods/hex.js
generated
vendored
Normal file
41
frontend/node_modules/khroma/test/methods/hex.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
/* IMPORT */
|
||||
|
||||
import {describe} from 'fava';
|
||||
import {hex} from '../../dist/index.js';
|
||||
|
||||
/* MAIN */
|
||||
|
||||
describe ( 'hex', it => {
|
||||
|
||||
it ( 'creates a new color given its rgba channels', t => {
|
||||
|
||||
const tests = [
|
||||
[[0, 0, 0, 0], 'rgba(0, 0, 0, 0)'],
|
||||
[[255, 255, 255, 0.5], 'rgba(255, 255, 255, 0.5)'],
|
||||
[[0, 0, 0, 1], '#000000'],
|
||||
[[128, 128, 128, 1], '#808080'],
|
||||
[[-1, -1, -1, -1], 'rgba(0, 0, 0, 0)'],
|
||||
[[1000, 1000, 1000, 1000], '#ffffff']
|
||||
];
|
||||
|
||||
tests.forEach ( ([ args, output ]) => {
|
||||
t.is ( hex ( ...args ), output );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
it ( 'allows ommiting the alpha channel', t => {
|
||||
|
||||
const tests = [
|
||||
[[0, 0, 0], '#000000'],
|
||||
[[255, 255, 255], '#ffffff']
|
||||
];
|
||||
|
||||
tests.forEach ( ([ args, output ]) => {
|
||||
t.is ( hex ( ...args ), output );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
28
frontend/node_modules/khroma/test/methods/is_light.js
generated
vendored
Normal file
28
frontend/node_modules/khroma/test/methods/is_light.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
/* IMPORT */
|
||||
|
||||
import {describe} from 'fava';
|
||||
import {isLight} from '../../dist/index.js';
|
||||
|
||||
/* MAIN */
|
||||
|
||||
describe ( 'isLight', it => {
|
||||
|
||||
it ( 'checks if the provided color is a light color', t => {
|
||||
|
||||
const tests = [
|
||||
['#000000', false],
|
||||
['#8a8a8a', false],
|
||||
['#bbbbbb', false],
|
||||
['#ffcc00', true],
|
||||
['#e0e0e0', true],
|
||||
['#ffffff', true]
|
||||
];
|
||||
|
||||
tests.forEach ( ([ color, output ]) => {
|
||||
t.is ( isLight ( color ), output );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
33
frontend/node_modules/khroma/test/methods/is_transparent.js
generated
vendored
Normal file
33
frontend/node_modules/khroma/test/methods/is_transparent.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
|
||||
/* IMPORT */
|
||||
|
||||
import {describe} from 'fava';
|
||||
import {isTransparent} from '../../dist/index.js';
|
||||
|
||||
/* MAIN */
|
||||
|
||||
describe ( 'isTransparent', it => {
|
||||
|
||||
it ( 'checks if the provided color is a transparent color', t => {
|
||||
|
||||
const tests = [
|
||||
['transparent', true],
|
||||
['#00000000', true],
|
||||
['#ffffff00', true],
|
||||
['black', false],
|
||||
['#00000001', false],
|
||||
['#ffffffff', false],
|
||||
['#8a8a8a', false],
|
||||
['#bbbbbb', false],
|
||||
['#ffcc00', false],
|
||||
['#e0e0e0', false],
|
||||
['#ffffff', false]
|
||||
];
|
||||
|
||||
tests.forEach ( ([ color, output ]) => {
|
||||
t.is ( isTransparent ( color ), output );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
28
frontend/node_modules/khroma/test/methods/lighten.js
generated
vendored
Normal file
28
frontend/node_modules/khroma/test/methods/lighten.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
/* IMPORT */
|
||||
|
||||
import {describe} from 'fava';
|
||||
import {lighten} from '../../dist/index.js';
|
||||
|
||||
/* MAIN */
|
||||
|
||||
describe ( 'lighten', it => {
|
||||
|
||||
it ( 'increases the lightness channel of the color', t => {
|
||||
|
||||
const tests = [
|
||||
[['hsl(0, 0%, 0%)', 0], 'hsl(0, 0%, 0%)'],
|
||||
[['hsl(0, 0%, 0%)', 50], 'hsl(0, 0%, 50%)'],
|
||||
[['hsl(0, 0%, 0%)', 75], 'hsl(0, 0%, 75%)'],
|
||||
[['hsl(0, 0%, 0%)', 100], 'hsl(0, 0%, 100%)'],
|
||||
[['hsl(0, 0%, 50%)', 100], 'hsl(0, 0%, 100%)'],
|
||||
[['hsl(0, 0%, 100%)', 100], 'hsl(0, 0%, 100%)']
|
||||
];
|
||||
|
||||
tests.forEach ( ([ args, output ]) => {
|
||||
t.is ( lighten ( ...args ), output );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
26
frontend/node_modules/khroma/test/methods/mix.js
generated
vendored
Normal file
26
frontend/node_modules/khroma/test/methods/mix.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
/* IMPORT */
|
||||
|
||||
import {describe} from 'fava';
|
||||
import {mix} from '../../dist/index.js';
|
||||
|
||||
/* MAIN */
|
||||
|
||||
describe ( 'mix', it => {
|
||||
|
||||
it ( 'mixes two colors together', t => {
|
||||
|
||||
const tests = [
|
||||
[['#036', '#d2e1dd'], 'rgb(105, 138, 161.5)'],
|
||||
[['#036', '#d2e1dd', 75 ], 'rgb(52.5, 94.5, 131.75)'],
|
||||
[['#036', '#d2e1dd', 25 ], 'rgb(157.5, 181.5, 191.25)'],
|
||||
[['rgba(242, 236, 228, 0.5)', '#6b717f'], 'rgba(140.75, 143.75, 152.25, 0.75)']
|
||||
];
|
||||
|
||||
tests.forEach ( ([ args, output ]) => {
|
||||
t.is ( mix ( ...args ), output );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
25
frontend/node_modules/khroma/test/methods/opacify.js
generated
vendored
Normal file
25
frontend/node_modules/khroma/test/methods/opacify.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
/* IMPORT */
|
||||
|
||||
import {describe} from 'fava';
|
||||
import {opacify} from '../../dist/index.js';
|
||||
|
||||
/* MAIN */
|
||||
|
||||
describe ( 'opacify', it => {
|
||||
|
||||
it ( 'increases the opacity channel of the color', t => {
|
||||
|
||||
const tests = [
|
||||
[['#000000', 1], '#000000'],
|
||||
[['rgba(0, 0, 0, 0.5)', 0.5], '#000000'],
|
||||
[['rgba(0, 0, 0, 0.5)', 0.1], 'rgba(0, 0, 0, 0.6)']
|
||||
];
|
||||
|
||||
tests.forEach ( ([ args, output ]) => {
|
||||
t.is ( opacify ( ...args ), output );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
28
frontend/node_modules/khroma/test/methods/saturate.js
generated
vendored
Normal file
28
frontend/node_modules/khroma/test/methods/saturate.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
/* IMPORT */
|
||||
|
||||
import {describe} from 'fava';
|
||||
import {saturate} from '../../dist/index.js';
|
||||
|
||||
/* MAIN */
|
||||
|
||||
describe ( 'saturate', it => {
|
||||
|
||||
it ( 'increases the saturation channel of the color', t => {
|
||||
|
||||
const tests = [
|
||||
[['hsl(0, 0%, 50%)', 0], 'hsl(0, 0%, 50%)'],
|
||||
[['hsl(0, 0%, 50%)', 50], 'hsl(0, 50%, 50%)'],
|
||||
[['hsl(0, 0%, 50%)', 75], 'hsl(0, 75%, 50%)'],
|
||||
[['hsl(0, 0%, 50%)', 100], 'hsl(0, 100%, 50%)'],
|
||||
[['hsl(0, 50%, 50%)', 100], 'hsl(0, 100%, 50%)'],
|
||||
[['hsl(0, 100%, 50%)', 100], 'hsl(0, 100%, 50%)']
|
||||
];
|
||||
|
||||
tests.forEach ( ([ args, output ]) => {
|
||||
t.is ( saturate ( ...args ), output );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
26
frontend/node_modules/khroma/test/methods/transparentize.js
generated
vendored
Normal file
26
frontend/node_modules/khroma/test/methods/transparentize.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
/* IMPORT */
|
||||
|
||||
import {describe} from 'fava';
|
||||
import {transparentize} from '../../dist/index.js';
|
||||
|
||||
/* MAIN */
|
||||
|
||||
describe ( 'transparentize', it => {
|
||||
|
||||
it ( 'decreases the opacity channel of the color', t => {
|
||||
|
||||
const tests = [
|
||||
[['#000000', 1], 'rgba(0, 0, 0, 0)'],
|
||||
[['rgba(0, 0, 0, 0.5)', 0.5], 'rgba(0, 0, 0, 0)'],
|
||||
[['rgba(0, 0, 0, 0.5)', 1], 'rgba(0, 0, 0, 0)'],
|
||||
[['rgba(0, 0, 0, 0.5)', 0.1], 'rgba(0, 0, 0, 0.4)']
|
||||
];
|
||||
|
||||
tests.forEach ( ([ args, output ]) => {
|
||||
t.is ( transparentize ( ...args ), output );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user