Initial Commit

This commit is contained in:
2026-01-15 21:52:12 +01:00
committed by erik
parent 3ed42cdeb6
commit 5a70f775f1
6702 changed files with 1389544 additions and 0 deletions

31
node_modules/color-parse/.github/workflows/test.js.yml generated vendored Normal file
View File

@@ -0,0 +1,31 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: test
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: npm test

3
node_modules/color-parse/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,3 @@
language: node_js
node_js:
- "stable"

21
node_modules/color-parse/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015 Dmitry Ivanov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

5
node_modules/color-parse/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
export default function parse(color: string): {
space: 'rgb' | 'hsl' | 'hwb' | 'cmyk' | 'lab' | 'lch' | 'oklab' | 'oklch' | string;
values: number[];
alpha: number;
}

154
node_modules/color-parse/index.js generated vendored Normal file
View File

@@ -0,0 +1,154 @@
/**
* @module color-parse
*/
import names from 'color-name'
export default parse
/**
* Base hues
* http://dev.w3.org/csswg/css-color/#typedef-named-hue
*/
//FIXME: use external hue detector
var baseHues = {
red: 0,
orange: 60,
yellow: 120,
green: 180,
blue: 240,
purple: 300
}
/**
* Parse color from the string passed
*
* @return {Object} A space indicator `space`, an array `values` and `alpha`
*/
function parse(cstr) {
var m, parts = [], alpha = 1, space
//numeric case
if (typeof cstr === 'number') {
return { space: 'rgb', values: [cstr >>> 16, (cstr & 0x00ff00) >>> 8, cstr & 0x0000ff], alpha: 1 }
}
if (typeof cstr === 'number') return { space: 'rgb', values: [cstr >>> 16, (cstr & 0x00ff00) >>> 8, cstr & 0x0000ff], alpha: 1 }
cstr = String(cstr).toLowerCase();
//keyword
if (names[cstr]) {
parts = names[cstr].slice()
space = 'rgb'
}
//reserved words
else if (cstr === 'transparent') {
alpha = 0
space = 'rgb'
parts = [0, 0, 0]
}
//hex
else if (cstr[0] === '#') {
var base = cstr.slice(1)
var size = base.length
var isShort = size <= 4
alpha = 1
if (isShort) {
parts = [
parseInt(base[0] + base[0], 16),
parseInt(base[1] + base[1], 16),
parseInt(base[2] + base[2], 16)
]
if (size === 4) {
alpha = parseInt(base[3] + base[3], 16) / 255
}
}
else {
parts = [
parseInt(base[0] + base[1], 16),
parseInt(base[2] + base[3], 16),
parseInt(base[4] + base[5], 16)
]
if (size === 8) {
alpha = parseInt(base[6] + base[7], 16) / 255
}
}
if (!parts[0]) parts[0] = 0
if (!parts[1]) parts[1] = 0
if (!parts[2]) parts[2] = 0
space = 'rgb'
}
// color space
else if (m = /^((?:rgba?|hs[lvb]a?|hwba?|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms|oklch|oklab|color))\s*\(([^\)]*)\)/.exec(cstr)) {
var name = m[1]
space = name.replace(/a$/, '')
var dims = space === 'cmyk' ? 4 : space === 'gray' ? 1 : 3
parts = m[2].trim().split(/\s*[,\/]\s*|\s+/)
// color(srgb-linear x x x) -> srgb-linear(x x x)
if (space === 'color') space = parts.shift()
parts = parts.map(function (x, i) {
//<percentage>
if (x[x.length - 1] === '%') {
x = parseFloat(x) / 100
// alpha -> 0..1
if (i === 3) return x
// rgb -> 0..255
if (space === 'rgb') return x * 255
// hsl, hwb H -> 0..100
if (space[0] === 'h') return x * 100
// lch, lab L -> 0..100
if (space[0] === 'l' && !i) return x * 100
// lab A B -> -125..125
if (space === 'lab') return x * 125
// lch C -> 0..150, H -> 0..360
if (space === 'lch') return i < 2 ? x * 150 : x * 360
// oklch/oklab L -> 0..1
if (space[0] === 'o' && !i) return x
// oklab A B -> -0.4..0.4
if (space === 'oklab') return x * 0.4
// oklch C -> 0..0.4, H -> 0..360
if (space === 'oklch') return i < 2 ? x * 0.4 : x * 360
// color(xxx) -> 0..1
return x
}
//hue
if (space[i] === 'h' || (i === 2 && space[space.length - 1] === 'h')) {
//<base-hue>
if (baseHues[x] !== undefined) return baseHues[x]
//<deg>
if (x.endsWith('deg')) return parseFloat(x)
//<turn>
if (x.endsWith('turn')) return parseFloat(x) * 360
if (x.endsWith('grad')) return parseFloat(x) * 360 / 400
if (x.endsWith('rad')) return parseFloat(x) * 180 / Math.PI
}
if (x === 'none') return 0
return parseFloat(x)
});
alpha = parts.length > dims ? parts.pop() : 1
}
//named channels case
else if (/[0-9](?:\s|\/|,)/.test(cstr)) {
parts = cstr.match(/([0-9]+)/g).map(function (value) {
return parseFloat(value)
})
space = cstr.match(/([a-z])/ig)?.join('')?.toLowerCase() || 'rgb'
}
return {
space,
values: parts,
alpha
}
}

36
node_modules/color-parse/package.json generated vendored Normal file
View File

@@ -0,0 +1,36 @@
{
"name": "color-parse",
"version": "2.0.2",
"description": "Color string parser",
"main": "index.js",
"browser": "index.js",
"module": "./index.js",
"type": "module",
"scripts": {
"test": "node test.js"
},
"repository": {
"type": "git",
"url": "https://github.com/colorjs/color-parse"
},
"keywords": [
"color",
"parse",
"color-parse",
"color-string",
"parse-color",
"css color"
],
"author": "Dmitry Ivanov <df.creative@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/colorjs/color-parse/issues"
},
"homepage": "https://github.com/colorjs/color-parse",
"dependencies": {
"color-name": "^2.0.0"
},
"devDependencies": {
"tape": "^4.7.0"
}
}

60
node_modules/color-parse/readme.md generated vendored Normal file
View File

@@ -0,0 +1,60 @@
# color-parse [![test](https://github.com/colorjs/color-parse/actions/workflows/test.js.yml/badge.svg)](https://github.com/colorjs/color-parse/actions/workflows/test.js.yml) [![size](https://img.shields.io/bundlephobia/minzip/color-parse?label=size)](https://bundlephobia.com/result?p=color-parse) ![stable](https://img.shields.io/badge/stability-stable-green)
Fast and compact color string parser.
`$ npm install color-parse`
```js
var parse = require('color-parse')
parse('hsla(12 10% 50% / .3)')
// { space: 'hsl', values: [12, 10, 50], alpha: 0.3 }
```
## Parsed strings
* [x] Color keywords: `red`, `green` etc., see [color-name](https://ghub.io/color-name)
* [x] `#RGB[A]`
* [x] `#RRGGBB[AA]`
* [x] `rgb[a](R, G, B[, A])`
* [x] `rgb(R G B[ / A])`
* [x] `hsl[a](H, S, L[, A])`, inc. [named hues](http://dev.w3.org/csswg/css-color/#simple-hues)
* [x] `hsl(H S L [ / A])`
* [x] `hwb(H, W, B)`
* [x] `cmyk(C, M, Y, K)`
* [x] `xyz(X, Y, Z)`
* [x] `luv(L, U, V)`
* [x] `luv(L U V[ / A])`
* [x] `lab(L, A, B)`
* [x] `lab(L a b[ / A])` - see [limits](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/lab)
* [x] `lch(L, C, H)`
* [x] `lch(L C H[ / A])` - see [limits](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/lch)
* [x] `oklab(L a b[ / A])` - see [limits](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/oklab)
* [x] `oklch(L C H[ / A])` - see [limits](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/oklch)
* [x] `color(space c1 c2 c3[ / A])`
* [x] `R:10 G:20 B:30`
* [x] `(R10 / G20 / B30)`
* [x] `C100/M80/Y0/K35`
* [x] `[10, 20, 20]` as RGB
* [x] `10,20,20` as RGB
* [x] `0x00ff00`, `0x0000ff` numbers as RGB
## Not parsed
* [x] unknown strings eg. `'yellowblue'`
* [x] not strings: object, arrays etc.
## Related
* [color-space](https://npmjs.org/package/color-space) — collection of color space conversions.
* [color-rgba](https://npmjs.org/package/color-rgba) — convert any color string to rgba array.
* [color-alpha](https://npmjs.org/package/color-alpha) — change alpha component of any color.
## Analogs
* [parse-color](http://npmjs.org/package/parse-color) — parser by @substack. Performs calculations to every possible space, which bloats size.
* [color-parser](http://npmjs.org/package/color-parser) — parser by @tjholowaychuk. Supports limited set of spaces.
* [color-string](http://npmjs.org/package/color-string) — parsing/serializing module by Heather Arthur. Has extensive API for parsing and serializing from any to any space.
[![NPM](https://nodei.co/npm/color-parse.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/color-parse/)

592
node_modules/color-parse/test.js generated vendored Normal file
View File

@@ -0,0 +1,592 @@
import parse from './index.js'
import t from 'tape'
/** parse-color tests */
t('#ffa500', function (t) {
t.deepEqual(parse('#ffa500'), {
space: 'rgb',
values: [255, 165, 0],
alpha: 1
});
t.end()
});
t('#333', function (t) {
t.deepEqual(parse('#333'), {
space: 'rgb',
values: [51, 51, 51],
alpha: 1
});
t.end()
});
t('#f98', function (t) {
t.deepEqual(parse('#f98'), {
space: 'rgb',
values: [255, 153, 136],
alpha: 1
});
t.end()
});
t('lime', function (t) {
t.deepEqual(parse('lime'), {
space: 'rgb',
values: [0, 255, 0],
alpha: 1
});
t.deepEqual(parse('LIME'), {
space: 'rgb',
values: [0, 255, 0],
alpha: 1
});
t.end()
});
t('hsl(210,50,50)', function (t) {
t.deepEqual(parse('hsl(210,50,50)'), {
space: 'hsl',
values: [210, 50, 50],
alpha: 1
});
t.end()
});
t('rgba(153,50,204,60%)', function (t) {
t.deepEqual(parse('rgba(153,50,204,60%)'), {
space: 'rgb',
values: [153, 50, 204],
alpha: 0.6
});
t.end()
});
t('#fef', function (t) {
t.deepEqual(parse('#fef'), {
space: 'rgb',
values: [255, 238, 255],
alpha: 1
});
t.end()
});
t('#fffFEF', function (t) {
t.deepEqual(parse('#fffFEF'), {
space: 'rgb',
values: [255, 255, 239],
alpha: 1
});
t.end()
});
t('rgb(244, 233, 100)', function (t) {
t.deepEqual(parse('rgb(244, 233, 100)'), {
space: 'rgb',
values: [244, 233, 100],
alpha: 1
});
t.end()
});
t('rgb(100%, 30%, 90%)', function (t) {
t.deepEqual(parse('rgb(100%, 30%, 90%)'), {
space: 'rgb',
values: [255, 76.5, 229.5],
alpha: 1
});
t.end()
});
t('transparent', function (t) {
t.deepEqual(parse('transparent'), {
space: 'rgb',
values: [0, 0, 0],
alpha: 0
});
t.end()
});
t('hsl(240, 100%, 50.5%)', function (t) {
t.deepEqual(parse('hsl(240, 100%, 50.5%)'), {
space: 'hsl',
values: [240, 100, 50.5],
alpha: 1
});
t.end()
});
t('hsl(240deg, 100%, 50.5%)', function (t) {
t.deepEqual(parse('hsl(240deg, 100%, 50.5%)'), {
space: 'hsl',
values: [240, 100, 50.5],
alpha: 1
});
t.end()
});
t('hwb(240, 100%, 50.5%)', function (t) {
t.deepEqual(parse('hwb(240, 100%, 50.5%)'), {
space: 'hwb',
values: [240, 100, 50.5],
alpha: 1
});
t.end()
});
t('hwb(240deg, 100%, 50.5%)', function (t) {
t.deepEqual(parse('hwb(240deg, 100%, 50.5%)'), {
space: 'hwb',
values: [240, 100, 50.5],
alpha: 1
});
t.end()
});
t('blue', function (t) {
t.deepEqual(parse('blue'), {
space: 'rgb',
values: [0, 0, 255],
alpha: 1
});
t.deepEqual(parse('BLUE'), {
space: 'rgb',
values: [0, 0, 255],
alpha: 1
});
t.end()
});
t('rgb(244, 233, 100)', function (t) {
t.deepEqual(parse('rgb(244, 233, 100)'), {
space: 'rgb',
values: [244, 233, 100],
alpha: 1
});
t.end()
});
t('rgba(244, 233, 100, 0.5)', function (t) {
t.deepEqual(parse('rgba(244, 233, 100, 0.5)'), {
space: 'rgb',
values: [244, 233, 100],
alpha: 0.5
});
t.end()
});
t('hsla(244, 100%, 100%, 0.6)', function (t) {
t.deepEqual(parse('hsla(244, 100%, 100%, 0.6)'), {
space: 'hsl',
values: [244, 100, 100],
alpha: 0.6
});
t.end()
});
t('hwb(244, 100%, 100%, 0.6)', function (t) {
t.deepEqual(parse('hwb(244, 100%, 100%, 0.6)'), {
space: 'hwb',
values: [244, 100, 100],
alpha: 0.6
});
t.end()
});
t('hwb(244, 100%, 100%)', function (t) {
t.deepEqual(parse('hwb(244, 100%, 100%)'), {
space: 'hwb',
values: [244, 100, 100],
alpha: 1
});
t.end()
});
t('rgba(200, 20, 233, 0.2)', function (t) {
t.deepEqual(parse('rgba(200, 20, 233, 0.2)'), {
space: 'rgb',
values: [200, 20, 233],
alpha: 0.2
});
t.end()
});
t('rgba(200, 20, 233, 0)', function (t) {
t.deepEqual(parse('rgba(200, 20, 233, 0)'), {
space: 'rgb',
values: [200, 20, 233],
alpha: 0
});
t.end()
});
t('rgba(100%, 30%, 90%, 0.2)', function (t) {
t.deepEqual(parse('rgba(100%, 30%, 90%, 0.2)'), {
space: 'rgb',
values: [255, 76.5, 229.5],
alpha: 0.2
});
t.end()
});
t('rgba(200 20 233 / 0.2)', function (t) {
t.deepEqual(parse('rgba(200, 20, 233, 0.2)'), {
space: 'rgb',
values: [200, 20, 233],
alpha: 0.2
});
t.end()
});
t('rgba(200 20 233 / 20%)', function (t) {
t.deepEqual(parse('rgba(200, 20, 233, 0.2)'), {
space: 'rgb',
values: [200, 20, 233],
alpha: 0.2
});
t.end()
});
t('hsla(200, 20%, 33%, 0.2)', function (t) {
t.deepEqual(parse('hsla(200, 20%, 33%, 0.2)'), {
space: 'hsl',
values: [200, 20, 33],
alpha: 0.2
});
t.end()
});
t('hwb(200, 20%, 33%, 0.2)', function (t) {
t.deepEqual(parse('hwb(200, 20%, 33%, 0.2)'), {
space: 'hwb',
values: [200, 20, 33],
alpha: 0.2
});
t.end()
});
t('rgba(200, 20, 233, 0.2)', function (t) {
t.deepEqual(parse('rgba(200, 20, 233, 0.2)'), {
space: 'rgb',
values: [200, 20, 233],
alpha: 0.2
});
t.end()
});
t('rgba(300, 600, 100, 3)', function (t) {
t.deepEqual(parse('rgba(300, 600, 100, 3)'), {
space: 'rgb',
values: [300, 600, 100],
alpha: 3
});
t.end()
});
t('rgba(8000%, 100%, 333%, 88)', function (t) {
t.deepEqual(parse('rgba(8000%, 100%, 333%, 88)'), {
space: 'rgb',
values: [20400, 255, 849.15],
alpha: 88
});
t.end()
});
t('hsla(400, 10%, 200%, 10)', function (t) {
t.deepEqual(parse('hsla(400, 10%, 200%, 10)'), {
space: 'hsl',
values: [400, 10, 200],
alpha: 10
});
t.end()
});
t('hwb(400, 10%, 200%, 10)', function (t) {
t.deepEqual(parse('hwb(400, 10%, 200%, 10)'), {
space: 'hwb',
values: [400, 10, 200],
alpha: 10
});
t.end()
});
t('yellowblue', function (t) {
t.deepEqual(parse('yellowblue'), { space: undefined, values: [], alpha: 1 });
t.deepEqual(parse('YELLOWBLUE'), { space: undefined, values: [], alpha: 1 });
t.end()
});
t('hsla(101.12, 45.2%, 21.0%, 1.0)', function (t) {
t.deepEqual(parse('hsla(101.12, 45.2%, 21.0%, 1.0)'), {
space: 'hsl',
values: [101.12, 45.2, 21.0],
alpha: 1
});
t.end()
});
t('hsla(101.12 45.2% 21.0% / 50%)', function (t) {
t.deepEqual(parse('hsla(101.12 45.2% 21.0% / 50%)'), {
space: 'hsl',
values: [101.12, 45.2, 21.0],
alpha: .5
});
t.end()
});
t('hsl(red, 10%, 10%)', function (t) {
t.deepEqual(parse('hsl(red, 10%, 10%)'), {
space: 'hsl',
values: [0, 10, 10],
alpha: 1
});
t.end()
});
t('hsl(red, 10%, 10%);', function (t) {
t.deepEqual(parse('hsl(red, 10%, 10%);'), {
space: 'hsl',
values: [0, 10, 10],
alpha: 1
});
t.end()
});
t('hsl(10deg, 10%, 10%)', function (t) {
t.deepEqual(parse('hsl(10deg, 10%, 10%)'), {
space: 'hsl',
values: [10, 10, 10],
alpha: 1
});
t.end()
});
t('hsl(1.5turn, 10%, 10%)', function (t) {
t.deepEqual(parse('hsl(1.5turn, 10%, 10%)'), {
space: 'hsl',
values: [540, 10, 10],
alpha: 1
});
t.end()
});
t('lch(5, 5, orange)', function (t) {
t.deepEqual(parse('lch(5, 5, orange)'), {
space: 'lch',
values: [5, 5, 60],
alpha: 1
});
t.end()
});
t('lch(5 5 orange / .5)', function (t) {
t.deepEqual(parse('lch(5 5 orange / .5)'), {
space: 'lch',
values: [5, 5, 60],
alpha: 0.5
});
t.end()
});
t('lab(0.25, 0.25, 0.25)', function (t) {
t.deepEqual(parse('lab(0.25, 0.25, 0.25)'), {
space: 'lab',
values: [0.25, 0.25, 0.25],
alpha: 1
});
t.end()
});
t('lab(0.25 0.25 0.25 / 0.5)', function (t) {
t.deepEqual(parse('lab(0.25 0.25 0.25 / 0.5)'), {
space: 'lab',
values: [0.25, 0.25, 0.25],
alpha: 0.5
});
t.end()
});
t('luv(0.25, 0.25, 0.25)', function (t) {
t.deepEqual(parse('luv(0.25, 0.25, 0.25)'), {
space: 'luv',
values: [0.25, 0.25, 0.25],
alpha: 1
});
t.end()
});
t('luv(0.25 0.25 0.25 / 0.5)', function (t) {
t.deepEqual(parse('luv(0.25 0.25 0.25 / 0.5)'), {
space: 'luv',
values: [0.25, 0.25, 0.25],
alpha: 0.5
});
t.end()
});
t('color(...)', function (t) {
// --srgb: color(srgb 1 1 1);
t.deepEqual(parse('color(srgb-linear 1 1 1)'), {
space: 'srgb-linear',
values: [1, 1, 1],
alpha: 1
});
// --srgb-linear: color(srgb-linear 100% 100% 100% / 50%);
t.deepEqual(parse('color(srgb-linear 100% 100% 100% / 50%)'), {
space: 'srgb-linear',
values: [1, 1, 1],
alpha: 0.5
});
// --display-p3: color(display-p3 1 1 1);
t.deepEqual(parse('color(display-p3 1 1 1)'), {
space: 'display-p3',
values: [1, 1, 1],
alpha: 1
});
// --rec2020: color(rec2020 0 0 0);
t.deepEqual(parse('color(rec2020 0 0 0)'), {
space: 'rec2020',
values: [0, 0, 0],
alpha: 1
});
// --a98-rgb: color(a98-rgb 1 1 1 / 25%);
t.deepEqual(parse('color(a98-rgb 1 1 1 / 25%)'), {
space: 'a98-rgb',
values: [1, 1, 1],
alpha: 0.25
});
// --prophoto: color(prophoto-rgb 0% 0% 0%);
t.deepEqual(parse('color(prophoto-rgb 0% 0% 0%)'), {
space: 'prophoto-rgb',
values: [0, 0, 0],
alpha: 1
});
// --xyz: color(xyz 1 1 1);
t.deepEqual(parse('color(xyz 1 1 1)'), {
space: 'xyz',
values: [1, 1, 1],
alpha: 1
});
t.end()
});
t('oklab', function (t) {
t.deepEqual(parse('oklab(40.1% 0.1143 0.045)'), {
space: 'oklab',
values: [0.401, 0.1143, 0.045],
alpha: 1
});
t.deepEqual(parse('oklab(59.69% 0.1007 -0.1191 / 0.5)'), {
space: 'oklab',
values: [0.5969, 0.1007, -0.1191],
alpha: 0.5
});
t.deepEqual(parse('oklab(0.123 100% -100% / 2)'), {
space: 'oklab',
values: [0.123, 0.4, -0.4],
alpha: 2
});
t.deepEqual(parse('oklab(none none none / none)'), {
space: 'oklab',
values: [0, 0, 0],
alpha: 0
});
t.end()
});
t('oklch', function (t) {
t.deepEqual(parse('oklch(40.1% 0.1143 0.045)'), {
space: 'oklch',
values: [0.401, 0.1143, 0.045],
alpha: 1
});
t.deepEqual(parse('oklch(59.69% 10% 49.77 / 0.5)'), {
space: 'oklch',
values: [0.5969, 0.04000000000000001, 49.77],
alpha: 0.5
});
t.deepEqual(parse('oklch(40.1% 0.156 49.1% / .5)'), {
space: 'oklch',
values: [0.401, 0.156, 176.76],
alpha: .5
});
t.deepEqual(parse('oklch(none none none / none)'), {
space: 'oklch',
values: [0, 0, 0],
alpha: 0
});
t.end()
});
t('#afd6', function (t) {
t.deepEqual(parse('#afd6'), {
space: 'rgb',
values: [170, 255, 221],
alpha: 0.4
});
t.end()
});
t('#AFD6', function (t) {
t.deepEqual(parse('#afd6'), {
space: 'rgb',
values: [170, 255, 221],
alpha: 0.4
});
t.end()
});
t('#aaffdd66', function (t) {
t.deepEqual(parse('#aaffdd66'), {
space: 'rgb',
values: [170, 255, 221],
alpha: 0.4
});
t.end()
});
t('#AAFFDD66', function (t) {
t.deepEqual(parse('#AAFFDD66'), {
space: 'rgb',
values: [170, 255, 221],
alpha: 0.4
});
t.end()
});
t('(R12 / G45 / B234)', function (t) {
t.deepEqual(parse('(R12 / G45 / B234)'), {
space: 'rgb',
values: [12, 45, 234],
alpha: 1
});
t.end()
});
t('R:12 G:45 B:234', function (t) {
t.deepEqual(parse('R:12 G:45 B:234'), {
space: 'rgb',
values: [12, 45, 234],
alpha: 1
});
t.end()
});
t('C100/M80/Y0/K35', function (t) {
t.deepEqual(parse('C100/M80/Y0/K35'), {
space: 'cmyk',
values: [100, 80, 0, 35],
alpha: 1
});
t.end()
});
t.skip('Array', function (t) {
t.deepEqual(parse([1, 2, 3]), {
space: 'rgb',
values: [1, 2, 3],
alpha: 1
});
t.end()
});
t.skip('Object', function (t) {
t.deepEqual(parse({ r: 1, g: 2, b: 3 }), {
space: 'rgb',
values: [1, 2, 3],
alpha: 1
});
t.deepEqual(parse({ red: 1, green: 2, blue: 3 }), {
space: 'rgb',
values: [1, 2, 3],
alpha: 1
});
t.deepEqual(parse({ h: 1, s: 2, l: 3 }), {
space: 'hsl',
values: [1, 2, 3],
alpha: 1
});
t.end()
});
t('Number', function (t) {
t.deepEqual(parse(0xA141E), {
space: 'rgb',
values: [10, 20, 30],
alpha: 1
});
t.deepEqual(parse(0xff), {
space: 'rgb',
values: [0x00, 0x00, 0xff],
alpha: 1
});
t.deepEqual(parse(0xff0000), {
space: 'rgb',
values: [0xff, 0x00, 0x00],
alpha: 1
});
t.deepEqual(parse(0x0000ff), {
space: 'rgb',
values: [0x00, 0x00, 0xff],
alpha: 1
});
// t.deepEqual(parse(new Number(0x0000ff)), {
// space: 'rgb',
// values: [0x00, 0x00, 0xff],
// alpha: 1
// });
t.end()
});