@asamuzakjp/css-color
Advanced tools
Comparing version
@@ -32,11 +32,11 @@ { | ||
"devDependencies": { | ||
"c8": "^10.1.2", | ||
"c8": "^10.1.3", | ||
"esbuild": "^0.24.0", | ||
"eslint": "^9.16.0", | ||
"eslint-plugin-import-x": "^4.5.0", | ||
"eslint-plugin-jsdoc": "^50.6.0", | ||
"eslint-plugin-jsdoc": "^50.6.1", | ||
"eslint-plugin-regexp": "^2.7.0", | ||
"globals": "^15.13.0", | ||
"mocha": "^11.0.1", | ||
"neostandard": "^0.11.9", | ||
"neostandard": "^0.12.0", | ||
"npm-run-all2": "^7.0.1", | ||
@@ -55,3 +55,3 @@ "sinon": "^19.0.2", | ||
}, | ||
"version": "2.3.0" | ||
"version": "2.4.0" | ||
} |
@@ -23,4 +23,4 @@ # CSS color | ||
const resolvedValue = | ||
resolve('color-mix(in oklab, rgb(255 0 0), color(srgb 0 0.5 0 / 0.5))'); | ||
// 'oklab(0.5914 0.103273 0.119688 / 0.75)' | ||
resolve('color-mix(in oklab, lch(67.5345 42.5 258.2), color(srgb 0 0.5 0))'); | ||
// 'oklab(0.620754 -0.0931934 -0.00374881)' | ||
@@ -44,3 +44,6 @@ const convertedValue = covert.colorToHex('lab(46.2775% -47.5621 48.5837)'); | ||
* `opt.currentColor` **[string][133]?** color to use for `currentcolor` keyword | ||
* `opt.customProperty` **[object][135]?** custom properties, pair of `--` prefixed property name and value, e.g. `customProperty: { '--some-color': '#0000ff' }` | ||
* `opt.cssCalc` **[object][135]?** options for [@csstools/css-calc][141], e.g. `cssCalc: { globals: new Map([['foo', 'bar'], ['baz', 1]]) }` | ||
* `opt.customProperty` **[object][135]?** custom properties | ||
* pair of `--` prefixed property name and value, e.g. `customProperty: { '--some-color': '#0000ff' }` | ||
* and/or callback function to get the value, e.g. `customProperty: { callback: someDeclaration.getPropertyValue }` | ||
* `opt.format` **[string][133]?** output format, one of `computedValue` (default), `specifiedValue`, `rgb`, `hex`, `hexAlpha` | ||
@@ -52,9 +55,8 @@ * `computedValue` is a [computed value][139] of the color | ||
Returns **([string][133]? | [Array][137])** returns one of `rgba?()`, `color(space r g b / a)`, `color(space x y z / a)`, `lab(l a b / A)`, `lch(l c h / a)`, `oklab(l a b / A)`, `oklch(l c h / a)`, `\#rrggbb(aa)?`, `color-name?`, `null`, and, if `key` is specified, `[key, rgba?()]` etc. | ||
Returns **([string][133]? | [Array][137])** one of `rgba?()`, `#rrggbb(aa)?`, `color-name`, `'(empty-string)'`, `color(color-space r g b / alpha)`, `color(color-space x y z / alpha)`, `lab(l a b / alpha)`, `lch(l c h / alpha)`, `oklab(l a b / alpha)`, `oklch(l c h / alpha)`, `null`, or `[key, rgba?()]` etc. if `key` is specified | ||
* in `computedValue`, values are numbers, however `rgb()` values are integers | ||
* in `specifiedValue`, returns `empty string` for unknown and/or invalid color | ||
* in `rgb`, values are rounded to integers, and returns `rgba(0, 0, 0, 0)` for unknown colors | ||
* in `hex`, returns `null` for `transparent`, and also returns `null` if any of `r`, `g`, `b`, `a` is not a number | ||
* in `hexAlpha`, returns `#00000000` for `transparent`, however returns `null` if any of `r`, `g`, `b`, `a` is not a number | ||
* in `rgb`, values are rounded to integers, and returns `rgba(0, 0, 0, 0)` for unknown and/or invalid color | ||
* in `hex`, returns `null` for `transparent`, and also returns `null` if any of `r`, `g`, `b`, `alpha` is not a number | ||
* in `hexAlpha`, returns `#00000000` for `transparent`, however returns `null` if any of `r`, `g`, `b`, `alpha` is not a number | ||
@@ -84,5 +86,8 @@ ### convert | ||
* `opt.alpha` **[boolean][136]?** return in #rrggbbaa notation | ||
* `opt.customProperty` **[object][135]?** custom properties, pair of `--` prefixed property name and value, e.g. `customProperty: { '--some-color': '#0000ff' }` | ||
* `opt.cssCalc` **[object][135]?** options for [@csstools/css-calc][141], e.g. `cssCalc: { globals: new Map([['foo', 'bar'], ['baz', 1]]) }` | ||
* `opt.customProperty` **[object][135]?** custom properties | ||
* pair of `--` prefixed property name and value, e.g. `customProperty: { '--some-color': '#0000ff' }` | ||
* and/or callback function to get the value, e.g. `customProperty: { callback: someDeclaration.getPropertyValue }` | ||
Returns **[string][133]** #rrggbb|#rrggbbaa | ||
Returns **[string][133]** #rrggbb(aa)? | ||
@@ -97,5 +102,8 @@ ### convert.colorToHsl(value, opt) | ||
* `opt` **[object][135]?** options (optional, default `{}`) | ||
* `opt.customProperty` **[object][135]?** custom properties, pair of `--` prefixed property name and value, e.g. `customProperty: { '--some-color': '#0000ff' }` | ||
* `opt.cssCalc` **[object][135]?** options for [@csstools/css-calc][141], e.g. `cssCalc: { globals: new Map([['foo', 'bar'], ['baz', 1]]) }` | ||
* `opt.customProperty` **[object][135]?** custom properties | ||
* pair of `--` prefixed property name and value, e.g. `customProperty: { '--some-color': '#0000ff' }` | ||
* and/or callback function to get the value, e.g. `customProperty: { callback: someDeclaration.getPropertyValue }` | ||
Returns **[Array][137]<[number][134]>** \[h, s, l, a] | ||
Returns **[Array][137]<[number][134]>** \[h, s, l, alpha] | ||
@@ -110,5 +118,8 @@ ### convert.colorToHwb(value, opt) | ||
* `opt` **[object][135]?** options (optional, default `{}`) | ||
* `opt.customProperty` **[object][135]?** custom properties, pair of `--` prefixed property name and value, e.g. `customProperty: { '--some-color': '#0000ff' }` | ||
* `opt.cssCalc` **[object][135]?** options for [@csstools/css-calc][141], e.g. `cssCalc: { globals: new Map([['foo', 'bar'], ['baz', 1]]) }` | ||
* `opt.customProperty` **[object][135]?** custom properties | ||
* pair of `--` prefixed property name and value, e.g. `customProperty: { '--some-color': '#0000ff' }` | ||
* and/or callback function to get the value, e.g. `customProperty: { callback: someDeclaration.getPropertyValue }` | ||
Returns **[Array][137]<[number][134]>** \[h, w, b, a] | ||
Returns **[Array][137]<[number][134]>** \[h, w, b, alpha] | ||
@@ -123,5 +134,8 @@ ### convert.colorToLab(value, opt) | ||
* `opt` **[object][135]?** options (optional, default `{}`) | ||
* `opt.customProperty` **[object][135]?** custom properties, pair of `--` prefixed property name and value, e.g. `customProperty: { '--some-color': '#0000ff' }` | ||
* `opt.cssCalc` **[object][135]?** options for [@csstools/css-calc][141], e.g. `cssCalc: { globals: new Map([['foo', 'bar'], ['baz', 1]]) }` | ||
* `opt.customProperty` **[object][135]?** custom properties | ||
* pair of `--` prefixed property name and value, e.g. `customProperty: { '--some-color': '#0000ff' }` | ||
* and/or callback function to get the value, e.g. `customProperty: { callback: someDeclaration.getPropertyValue }` | ||
Returns **[Array][137]<[number][134]>** \[l, a, b, aa] | ||
Returns **[Array][137]<[number][134]>** \[l, a, b, alpha] | ||
@@ -136,5 +150,8 @@ ### convert.colorToLch(value, opt) | ||
* `opt` **[object][135]?** options (optional, default `{}`) | ||
* `opt.customProperty` **[object][135]?** custom properties, pair of `--` prefixed property name and value, e.g. `customProperty: { '--some-color': '#0000ff' }` | ||
* `opt.cssCalc` **[object][135]?** options for [@csstools/css-calc][141], e.g. `cssCalc: { globals: new Map([['foo', 'bar'], ['baz', 1]]) }` | ||
* `opt.customProperty` **[object][135]?** custom properties | ||
* pair of `--` prefixed property name and value, e.g. `customProperty: { '--some-color': '#0000ff' }` | ||
* and/or callback function to get the value, e.g. `customProperty: { callback: someDeclaration.getPropertyValue }` | ||
Returns **[Array][137]<[number][134]>** \[l, c, h, aa] | ||
Returns **[Array][137]<[number][134]>** \[l, c, h, alpha] | ||
@@ -149,5 +166,8 @@ ### convert.colorToOklab(value, opt) | ||
* `opt` **[object][135]?** options (optional, default `{}`) | ||
* `opt.customProperty` **[object][135]?** custom properties, pair of `--` prefixed property name and value, e.g. `customProperty: { '--some-color': '#0000ff' }` | ||
* `opt.cssCalc` **[object][135]?** options for [@csstools/css-calc][141], e.g. `cssCalc: { globals: new Map([['foo', 'bar'], ['baz', 1]]) }` | ||
* `opt.customProperty` **[object][135]?** custom properties | ||
* pair of `--` prefixed property name and value, e.g. `customProperty: { '--some-color': '#0000ff' }` | ||
* and/or callback function to get the value, e.g. `customProperty: { callback: someDeclaration.getPropertyValue }` | ||
Returns **[Array][137]<[number][134]>** \[l, a, b, aa] | ||
Returns **[Array][137]<[number][134]>** \[l, a, b, alpha] | ||
@@ -162,5 +182,8 @@ ### convert.colorToOklch(value, opt) | ||
* `opt` **[object][135]?** options (optional, default `{}`) | ||
* `opt.customProperty` **[object][135]?** custom properties, pair of `--` prefixed property name and value, e.g. `customProperty: { '--some-color': '#0000ff' }` | ||
* `opt.cssCalc` **[object][135]?** options for [@csstools/css-calc][141], e.g. `cssCalc: { globals: new Map([['foo', 'bar'], ['baz', 1]]) }` | ||
* `opt.customProperty` **[object][135]?** custom properties | ||
* pair of `--` prefixed property name and value, e.g. `customProperty: { '--some-color': '#0000ff' }` | ||
* and/or callback function to get the value, e.g. `customProperty: { callback: someDeclaration.getPropertyValue }` | ||
Returns **[Array][137]<[number][134]>** \[l, c, h, aa] | ||
Returns **[Array][137]<[number][134]>** \[l, c, h, alpha] | ||
@@ -175,5 +198,8 @@ ### convert.colorToRgb(value, opt) | ||
* `opt` **[object][135]?** options (optional, default `{}`) | ||
* `opt.customProperty` **[object][135]?** custom properties, pair of `--` prefixed property name and value, e.g. `customProperty: { '--some-color': '#0000ff' }` | ||
* `opt.cssCalc` **[object][135]?** options for [@csstools/css-calc][141], e.g. `cssCalc: { globals: new Map([['foo', 'bar'], ['baz', 1]]) }` | ||
* `opt.customProperty` **[object][135]?** custom properties | ||
* pair of `--` prefixed property name and value, e.g. `customProperty: { '--some-color': '#0000ff' }` | ||
* and/or callback function to get the value, e.g. `customProperty: { callback: someDeclaration.getPropertyValue }` | ||
Returns **[Array][137]<[number][134]>** \[r, g, b, a] | ||
Returns **[Array][137]<[number][134]>** \[r, g, b, alpha] | ||
@@ -188,6 +214,9 @@ ### convert.colorToXyz(value, opt) | ||
* `opt` **[object][135]?** options (optional, default `{}`) | ||
* `opt.customProperty` **[object][135]?** custom properties, pair of `--` prefixed property name and value, e.g. `customProperty: { '--some-color': '#0000ff' }` | ||
* `opt.cssCalc` **[object][135]?** options for [@csstools/css-calc][141], e.g. `cssCalc: { globals: new Map([['foo', 'bar'], ['baz', 1]]) }` | ||
* `opt.customProperty` **[object][135]?** custom properties | ||
* pair of `--` prefixed property name and value, e.g. `customProperty: { '--some-color': '#0000ff' }` | ||
* and/or callback function to get the value, e.g. `customProperty: { callback: someDeclaration.getPropertyValue }` | ||
* `opt.d50` **[boolean][136]?** xyz in d50 white point | ||
Returns **[Array][137]<[number][134]>** \[x, y, z, a] | ||
Returns **[Array][137]<[number][134]>** \[x, y, z, alpha] | ||
@@ -202,5 +231,8 @@ ### convert.colorToXyzD50(value, opt) | ||
* `opt` **[object][135]?** options (optional, default `{}`) | ||
* `opt.customProperty` **[object][135]?** custom properties, pair of `--` prefixed property name and value, e.g. `customProperty: { '--some-color': '#0000ff' }` | ||
* `opt.cssCalc` **[object][135]?** options for [@csstools/css-calc][141], e.g. `cssCalc: { globals: new Map([['foo', 'bar'], ['baz', 1]]) }` | ||
* `opt.customProperty` **[object][135]?** custom properties | ||
* pair of `--` prefixed property name and value, e.g. `customProperty: { '--some-color': '#0000ff' }` | ||
* and/or callback function to get the value, e.g. `customProperty: { callback: someDeclaration.getPropertyValue }` | ||
Returns **[Array][137]<[number][134]>** \[x, y, z, a] | ||
Returns **[Array][137]<[number][134]>** \[x, y, z, alpha] | ||
@@ -226,1 +258,3 @@ | ||
[140]: https://developer.mozilla.org/en-US/docs/Web/CSS/specified_value | ||
[141]: https://www.npmjs.com/package/@csstools/css-calc |
@@ -5,26 +5,36 @@ /** | ||
/* syntax */ | ||
/* constants */ | ||
const _DIGIT = '(?:0|[1-9]\\d*)'; | ||
export const ANGLE = 'deg|g?rad|turn'; | ||
export const CS_SRGB = 'srgb(?:-linear)?'; | ||
export const CS_RGB = `(?:a98|prophoto)-rgb|display-p3|rec2020|${CS_SRGB}`; | ||
export const CS_XYZ = 'xyz(?:-d(?:50|65))?'; | ||
export const CS_MIX = `(?:ok)?l(?:ab|ch)|h(?:sl|wb)|${CS_SRGB}|${CS_XYZ}`; | ||
export const FUNC_CALC = 'calc('; | ||
export const FUNC_COLOR = 'color('; | ||
export const FUNC_MIX = 'color-mix('; | ||
export const FUNC_VAR = 'var('; | ||
export const NONE = 'none'; | ||
export const SYN_ANGLE = 'deg|g?rad|turn'; | ||
export const SYN_SRGB = 'srgb(?:-linear)?'; | ||
export const SYN_COLOR_SPACE_XYZ = 'xyz(?:-d(?:50|65))?'; | ||
export const SYN_COLOR_SPACE_COLOR_MIX = | ||
`(?:ok)?l(?:ab|ch)|h(?:sl|wb)|${SYN_SRGB}|${SYN_COLOR_SPACE_XYZ}`; | ||
export const SYN_COLOR_SPACE_RGB = | ||
`(?:a98|prophoto)-rgb|display-p3|rec2020|${SYN_SRGB}`; | ||
export const SYN_NUM = | ||
'[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?'; | ||
export const SYN_PCT = `${SYN_NUM}%`; | ||
export const SYN_HSL = `(?:${SYN_NUM}(?:${SYN_ANGLE})?|${NONE})(?:\\s+(?:${SYN_PCT}|${SYN_NUM}|${NONE})){2}(?:\\s*\\/\\s*(?:${SYN_NUM}|${SYN_PCT}|${NONE}))?`; | ||
export const SYN_HSL_LV3 = `${SYN_NUM}(?:${SYN_ANGLE})?(?:\\s*,\\s*${SYN_PCT}){2}(?:\\s*,\\s*(?:${SYN_NUM}|${SYN_PCT}))?`; | ||
export const SYN_RGB = `(?:${SYN_NUM}|${SYN_PCT}|${NONE})(?:\\s+(?:${SYN_NUM}|${SYN_PCT}|${NONE})){2}(?:\\s*\\/\\s*(?:${SYN_NUM}|${SYN_PCT}|${NONE}))?`; | ||
export const SYN_RGB_LV3 = `(?:${SYN_NUM}(?:\\s*,\\s*${SYN_NUM}){2}|${SYN_PCT}(?:\\s*,\\s*${SYN_PCT}){2})(?:\\s*,\\s*(?:${SYN_NUM}|${SYN_PCT}))?`; | ||
export const SYN_LAB = `(?:${SYN_NUM}|${SYN_PCT}|${NONE})(?:\\s+(?:${SYN_NUM}|${SYN_PCT}|${NONE})){2}(?:\\s*\\/\\s*(?:${SYN_NUM}|${SYN_PCT}|${NONE}))?`; | ||
export const SYN_LCH = `(?:(?:${SYN_NUM}|${SYN_PCT}|${NONE})\\s+){2}(?:${SYN_NUM}(?:${SYN_ANGLE})?|${NONE})(?:\\s*\\/\\s*(?:${SYN_NUM}|${SYN_PCT}|${NONE}))?`; | ||
export const SYN_COLOR_FUNC = `(?:${SYN_COLOR_SPACE_RGB}|${SYN_COLOR_SPACE_XYZ})(?:\\s+(?:${SYN_NUM}|${SYN_PCT}|${NONE})){3}(?:\\s*\\/\\s*(?:${SYN_NUM}|${SYN_PCT}|${NONE}))?`; | ||
export const SYN_COLOR_TYPE = `[a-z]+|#(?:[\\da-f]{3}|[\\da-f]{4}|[\\da-f]{6}|[\\da-f]{8})|hsla?\\(\\s*(?:${SYN_HSL}|${SYN_HSL_LV3})\\s*\\)|hwb\\(\\s*${SYN_HSL}\\s*\\)|rgba?\\(\\s*(?:${SYN_RGB}|${SYN_RGB_LV3})\\s*\\)|(?:ok)?lab\\(\\s*${SYN_LAB}\\s*\\)|(?:ok)?lch\\(\\s*${SYN_LCH}\\s*\\)|color\\(\\s*${SYN_COLOR_FUNC}\\s*\\)`; | ||
export const SYN_COLOR_MIX_PART = `(?:${SYN_COLOR_TYPE})(?:\\s+${SYN_PCT})?`; | ||
export const SYN_COLOR_MIX = `color-mix\\(\\s*in\\s+(?:${SYN_COLOR_SPACE_COLOR_MIX})\\s*,\\s*${SYN_COLOR_MIX_PART}\\s*,\\s*${SYN_COLOR_MIX_PART}\\s*\\)`; | ||
export const SYN_COLOR_MIX_CAPT = `color-mix\\(\\s*in\\s+(${SYN_COLOR_SPACE_COLOR_MIX})\\s*,\\s*(${SYN_COLOR_MIX_PART})\\s*,\\s*(${SYN_COLOR_MIX_PART})\\s*\\)`; | ||
export const NUM = `[+-]?(?:${_DIGIT}(?:\\.\\d*)?|\\.\\d+)(?:e-?${_DIGIT})?`; | ||
export const PCT = `${NUM}%`; | ||
export const VAL_COMP = 'computedValue'; | ||
export const VAL_SPEC = 'specifiedValue'; | ||
/* color syntax */ | ||
const _ALPHA = `(?:\\s*\\/\\s*(?:${NUM}|${PCT}|${NONE}))?`; | ||
const _ALPHA_LV3 = `(?:\\s*,\\s*(?:${NUM}|${PCT}))?`; | ||
const _NUM_ANGLE = `${NUM}(?:${ANGLE})?`; | ||
const _NUM_ANGLE_NONE = `(?:${NUM}(?:${ANGLE})?|${NONE})`; | ||
const _NUM_PCT_NONE = `(?:${NUM}|${PCT}|${NONE})`; | ||
export const SYN_FUNC_COLOR = | ||
`(?:${CS_RGB}|${CS_XYZ})(?:\\s+${_NUM_PCT_NONE}){3}${_ALPHA}`; | ||
export const SYN_HSL = `${_NUM_ANGLE_NONE}(?:\\s+${_NUM_PCT_NONE}){2}${_ALPHA}`; | ||
export const SYN_HSL_LV3 = `${_NUM_ANGLE}(?:\\s*,\\s*${PCT}){2}${_ALPHA_LV3}`; | ||
export const SYN_LAB = `${_NUM_PCT_NONE}(?:\\s+${_NUM_PCT_NONE}){2}${_ALPHA}`; | ||
export const SYN_LCH = `(?:${_NUM_PCT_NONE}\\s+){2}${_NUM_ANGLE_NONE}${_ALPHA}`; | ||
export const SYN_RGB = `${_NUM_PCT_NONE}(?:\\s+${_NUM_PCT_NONE}){2}${_ALPHA}`; | ||
export const SYN_RGB_LV3 = `(?:${NUM}(?:\\s*,\\s*${NUM}){2}|${PCT}(?:\\s*,\\s*${PCT}){2})${_ALPHA_LV3}`; | ||
export const SYN_COLOR_TYPE = `[a-z]+|#(?:[\\da-f]{3}|[\\da-f]{4}|[\\da-f]{6}|[\\da-f]{8})|hsla?\\(\\s*(?:${SYN_HSL}|${SYN_HSL_LV3})\\s*\\)|hwb\\(\\s*${SYN_HSL}\\s*\\)|rgba?\\(\\s*(?:${SYN_RGB}|${SYN_RGB_LV3})\\s*\\)|(?:ok)?lab\\(\\s*${SYN_LAB}\\s*\\)|(?:ok)?lch\\(\\s*${SYN_LCH}\\s*\\)|color\\(\\s*${SYN_FUNC_COLOR}\\s*\\)`; | ||
export const SYN_MIX_PART = `(?:${SYN_COLOR_TYPE})(?:\\s+${PCT})?`; | ||
export const SYN_MIX = `color-mix\\(\\s*in\\s+(?:${CS_MIX})\\s*,\\s*${SYN_MIX_PART}\\s*,\\s*${SYN_MIX_PART}\\s*\\)`; | ||
export const SYN_MIX_CAPT = `color-mix\\(\\s*in\\s+(${CS_MIX})\\s*,\\s*(${SYN_MIX_PART})\\s*,\\s*(${SYN_MIX_PART})\\s*\\)`; |
@@ -15,5 +15,6 @@ /** | ||
import { resolve } from './resolve.js'; | ||
import { valueToJsonString } from './util.js'; | ||
/* constants */ | ||
import { FUNC_CALC, FUNC_VAR } from './constant.js'; | ||
import { FUNC_CALC, FUNC_VAR, VAL_COMP } from './constant.js'; | ||
@@ -29,2 +30,3 @@ /* cached results */ | ||
* @param {object} [opt] - options | ||
* @param {object} [opt.customProperty] - custom properties | ||
* @returns {?string} - value | ||
@@ -41,5 +43,9 @@ */ | ||
} | ||
const cacheKey = `{preProcess:${value}}`; | ||
if (cachedResults.has(cacheKey)) { | ||
return cachedResults.get(cacheKey); | ||
const { customProperty } = opt; | ||
let cacheKey; | ||
if (typeof customProperty?.callback !== 'function') { | ||
cacheKey = `{preProcess:${value},opt:${valueToJsonString(opt)}}`; | ||
if (cachedResults.has(cacheKey)) { | ||
return cachedResults.get(cacheKey); | ||
} | ||
} | ||
@@ -49,2 +55,5 @@ if (value.includes(FUNC_VAR)) { | ||
if (!value) { | ||
if (cacheKey) { | ||
cachedResults.set(cacheKey, null); | ||
} | ||
return null; | ||
@@ -58,3 +67,3 @@ } | ||
value = resolve(value, { | ||
format: 'computedValue' | ||
format: VAL_COMP | ||
}); | ||
@@ -90,2 +99,3 @@ } | ||
* @param {boolean} [opt.alpha] - return in #rrggbbaa notation | ||
* @param {object} [opt.customProperty] - custom properties | ||
* @returns {?string} - #rrggbb | #rrggbbaa | null | ||
@@ -104,7 +114,10 @@ */ | ||
} | ||
const cacheKey = `{colorToHex:${value},opt:${JSON.stringify(opt)}}`; | ||
if (cachedResults.has(cacheKey)) { | ||
return cachedResults.get(cacheKey); | ||
const { alpha, customProperty } = opt; | ||
let cacheKey; | ||
if (typeof customProperty?.callback !== 'function') { | ||
cacheKey = `{colorToHex:${value},opt:${valueToJsonString(opt)}}`; | ||
if (cachedResults.has(cacheKey)) { | ||
return cachedResults.get(cacheKey); | ||
} | ||
} | ||
const { alpha } = opt; | ||
let hex; | ||
@@ -130,3 +143,4 @@ if (alpha) { | ||
* @param {object} [opt] - options | ||
* @returns {Array.<number>} - [h, s, l, a] | ||
* @param {object} [opt.customProperty] - custom properties | ||
* @returns {Array.<number>} - [h, s, l, alpha] | ||
*/ | ||
@@ -144,5 +158,9 @@ export const colorToHsl = (value, opt = {}) => { | ||
} | ||
const cacheKey = `{colorToHsl:${value}}`; | ||
if (cachedResults.has(cacheKey)) { | ||
return cachedResults.get(cacheKey); | ||
const { customProperty } = opt; | ||
let cacheKey; | ||
if (typeof customProperty?.callback !== 'function') { | ||
cacheKey = `{colorToHsl:${value},opt:${valueToJsonString(opt)}}`; | ||
if (cachedResults.has(cacheKey)) { | ||
return cachedResults.get(cacheKey); | ||
} | ||
} | ||
@@ -152,3 +170,5 @@ const hsl = convertColorToHsl(value, { | ||
}); | ||
cachedResults.set(cacheKey, hsl); | ||
if (cacheKey) { | ||
cachedResults.set(cacheKey, hsl); | ||
} | ||
return hsl; | ||
@@ -161,3 +181,4 @@ }; | ||
* @param {object} [opt] - options | ||
* @returns {Array.<number>} - [h, w, b, a] | ||
* @param {object} [opt.customProperty] - custom properties | ||
* @returns {Array.<number>} - [h, w, b, alpha] | ||
*/ | ||
@@ -175,5 +196,9 @@ export const colorToHwb = (value, opt = {}) => { | ||
} | ||
const cacheKey = `{colorToHwb:${value}}`; | ||
if (cachedResults.has(cacheKey)) { | ||
return cachedResults.get(cacheKey); | ||
const { customProperty } = opt; | ||
let cacheKey; | ||
if (typeof customProperty?.callback !== 'function') { | ||
cacheKey = `{colorToHwb:${value},opt:${valueToJsonString(opt)}}`; | ||
if (cachedResults.has(cacheKey)) { | ||
return cachedResults.get(cacheKey); | ||
} | ||
} | ||
@@ -191,3 +216,4 @@ const hwb = convertColorToHwb(value, { | ||
* @param {object} [opt] - options | ||
* @returns {Array.<number>} - [l, a, b, aa] | ||
* @param {object} [opt.customProperty] - custom properties | ||
* @returns {Array.<number>} - [l, a, b, alpha] | ||
*/ | ||
@@ -205,8 +231,14 @@ export const colorToLab = (value, opt = {}) => { | ||
} | ||
const cacheKey = `{colorToLab:${value}}`; | ||
if (cachedResults.has(cacheKey)) { | ||
return cachedResults.get(cacheKey); | ||
const { customProperty } = opt; | ||
let cacheKey; | ||
if (typeof customProperty?.callback !== 'function') { | ||
cacheKey = `{colorToLab:${value},opt:${valueToJsonString(opt)}}`; | ||
if (cachedResults.has(cacheKey)) { | ||
return cachedResults.get(cacheKey); | ||
} | ||
} | ||
const lab = convertColorToLab(value); | ||
cachedResults.set(cacheKey, lab); | ||
if (cacheKey) { | ||
cachedResults.set(cacheKey, lab); | ||
} | ||
return lab; | ||
@@ -219,3 +251,4 @@ }; | ||
* @param {object} [opt] - options | ||
* @returns {Array.<number>} - [l, c, h, aa] | ||
* @param {object} [opt.customProperty] - custom properties | ||
* @returns {Array.<number>} - [l, c, h, alpha] | ||
*/ | ||
@@ -233,8 +266,14 @@ export const colorToLch = (value, opt = {}) => { | ||
} | ||
const cacheKey = `{colorToLch:${value}}`; | ||
if (cachedResults.has(cacheKey)) { | ||
return cachedResults.get(cacheKey); | ||
const { customProperty } = opt; | ||
let cacheKey; | ||
if (typeof customProperty?.callback !== 'function') { | ||
cacheKey = `{colorToLch:${value},opt:${valueToJsonString(opt)}}`; | ||
if (cachedResults.has(cacheKey)) { | ||
return cachedResults.get(cacheKey); | ||
} | ||
} | ||
const lch = convertColorToLch(value); | ||
cachedResults.set(cacheKey, lch); | ||
if (cacheKey) { | ||
cachedResults.set(cacheKey, lch); | ||
} | ||
return lch; | ||
@@ -247,3 +286,4 @@ }; | ||
* @param {object} [opt] - options | ||
* @returns {Array.<number>} - [l, a, b, aa] | ||
* @param {object} [opt.customProperty] - custom properties | ||
* @returns {Array.<number>} - [l, a, b, alpha] | ||
*/ | ||
@@ -261,8 +301,14 @@ export const colorToOklab = (value, opt = {}) => { | ||
} | ||
const cacheKey = `{colorToOklab:${value}}`; | ||
if (cachedResults.has(cacheKey)) { | ||
return cachedResults.get(cacheKey); | ||
const { customProperty } = opt; | ||
let cacheKey; | ||
if (typeof customProperty?.callback !== 'function') { | ||
cacheKey = `{colorToOklab:${value},opt:${valueToJsonString(opt)}}`; | ||
if (cachedResults.has(cacheKey)) { | ||
return cachedResults.get(cacheKey); | ||
} | ||
} | ||
const lab = convertColorToOklab(value); | ||
cachedResults.set(cacheKey, lab); | ||
if (cacheKey) { | ||
cachedResults.set(cacheKey, lab); | ||
} | ||
return lab; | ||
@@ -275,3 +321,4 @@ }; | ||
* @param {object} [opt] - options | ||
* @returns {Array.<number>} - [l, c, h, aa] | ||
* @param {object} [opt.customProperty] - custom properties | ||
* @returns {Array.<number>} - [l, c, h, alpha] | ||
*/ | ||
@@ -289,8 +336,14 @@ export const colorToOklch = (value, opt = {}) => { | ||
} | ||
const cacheKey = `{colorToOklch:${value}}`; | ||
if (cachedResults.has(cacheKey)) { | ||
return cachedResults.get(cacheKey); | ||
const { customProperty } = opt; | ||
let cacheKey; | ||
if (typeof customProperty?.callback !== 'function') { | ||
cacheKey = `{colorToOklch:${value},opt:${valueToJsonString(opt)}}`; | ||
if (cachedResults.has(cacheKey)) { | ||
return cachedResults.get(cacheKey); | ||
} | ||
} | ||
const lch = convertColorToOklch(value); | ||
cachedResults.set(cacheKey, lch); | ||
if (cacheKey) { | ||
cachedResults.set(cacheKey, lch); | ||
} | ||
return lch; | ||
@@ -303,3 +356,4 @@ }; | ||
* @param {object} [opt] - options | ||
* @returns {Array.<number>} - [r, g, b, a] | ||
* @param {object} [opt.customProperty] - custom properties | ||
* @returns {Array.<number>} - [r, g, b, alpha] | ||
*/ | ||
@@ -317,8 +371,14 @@ export const colorToRgb = (value, opt = {}) => { | ||
} | ||
const cacheKey = `{colorToRgb:${value}}`; | ||
if (cachedResults.has(cacheKey)) { | ||
return cachedResults.get(cacheKey); | ||
const { customProperty } = opt; | ||
let cacheKey; | ||
if (typeof customProperty?.callback !== 'function') { | ||
cacheKey = `{colorToRgb:${value},opt:${valueToJsonString(opt)}}`; | ||
if (cachedResults.has(cacheKey)) { | ||
return cachedResults.get(cacheKey); | ||
} | ||
} | ||
const rgb = convertColorToRgb(value); | ||
cachedResults.set(cacheKey, rgb); | ||
if (cacheKey) { | ||
cachedResults.set(cacheKey, rgb); | ||
} | ||
return rgb; | ||
@@ -331,4 +391,4 @@ }; | ||
* @param {object} [opt] - options | ||
* @param {boolean} [opt.d50] - xyz in d50 white point | ||
* @returns {Array.<number>} - [x, y, z, a] | ||
* @param {object} [opt.customProperty] - custom properties | ||
* @returns {Array.<number>} - [x, y, z, alpha] | ||
*/ | ||
@@ -346,5 +406,9 @@ export const colorToXyz = (value, opt = {}) => { | ||
} | ||
const cacheKey = `{colorToXyz:${value},opt:${JSON.stringify(opt)}}`; | ||
if (cachedResults.has(cacheKey)) { | ||
return cachedResults.get(cacheKey); | ||
const { customProperty } = opt; | ||
let cacheKey; | ||
if (typeof customProperty?.callback !== 'function') { | ||
cacheKey = `{colorToXyz:${value},opt:${valueToJsonString(opt)}}`; | ||
if (cachedResults.has(cacheKey)) { | ||
return cachedResults.get(cacheKey); | ||
} | ||
} | ||
@@ -357,3 +421,5 @@ let xyz; | ||
} | ||
cachedResults.set(cacheKey, xyz); | ||
if (cacheKey) { | ||
cachedResults.set(cacheKey, xyz); | ||
} | ||
return xyz; | ||
@@ -366,3 +432,3 @@ }; | ||
* @param {object} [opt] - options | ||
* @returns {Array.<number>} - [x, y, z, a] | ||
* @returns {Array.<number>} - [x, y, z, alpha] | ||
*/ | ||
@@ -369,0 +435,0 @@ export const colorToXyzD50 = (value, opt = {}) => { |
@@ -9,8 +9,7 @@ /** | ||
import { getType, isString } from './common.js'; | ||
import { valueToJsonString } from './util.js'; | ||
/* constants */ | ||
import { NAMED_COLORS } from './color.js'; | ||
import { | ||
FUNC_CALC, FUNC_VAR, SYN_COLOR_MIX, SYN_COLOR_TYPE | ||
} from './constant.js'; | ||
import { FUNC_CALC, FUNC_VAR, SYN_COLOR_TYPE, SYN_MIX } from './constant.js'; | ||
const { | ||
@@ -22,3 +21,3 @@ CloseParen: CLOSE_PAREN, Comment: COMMENT, Ident: IDENT, Whitespace: W_SPACE | ||
const REG_COLOR = new RegExp(`^(?:${SYN_COLOR_TYPE})$`); | ||
const REG_COLOR_MIX = new RegExp(`${SYN_COLOR_MIX}`); | ||
const REG_MIX = new RegExp(`${SYN_MIX}`); | ||
@@ -44,3 +43,3 @@ /* cached results */ | ||
} | ||
} else if (REG_COLOR.test(value) || REG_COLOR_MIX.test(value)) { | ||
} else if (REG_COLOR.test(value) || REG_MIX.test(value)) { | ||
bool = true; | ||
@@ -80,5 +79,9 @@ } | ||
if (value.startsWith('--')) { | ||
const item = customProperty[value]; | ||
if (item) { | ||
items.push(item); | ||
if (Object.hasOwnProperty.call(customProperty, value)) { | ||
items.push(customProperty[value]); | ||
} else if (typeof customProperty.callback === 'function') { | ||
const item = customProperty.callback(value); | ||
if (item) { | ||
items.push(item); | ||
} | ||
} | ||
@@ -184,2 +187,3 @@ } else if (value) { | ||
* @param {object} [opt] - options | ||
* @param {object} [opt.customProperty] - custom properties | ||
* @returns {?string} - value | ||
@@ -196,5 +200,9 @@ */ | ||
} | ||
const cacheKey = `{cssVar:${value},opt:${JSON.stringify(opt)}}`; | ||
if (cachedResults.has(cacheKey)) { | ||
return cachedResults.get(cacheKey); | ||
const { customProperty } = opt; | ||
let cacheKey; | ||
if (typeof customProperty?.callback !== 'function') { | ||
cacheKey = `{cssVar:${value},opt:${valueToJsonString(opt)}}`; | ||
if (cachedResults.has(cacheKey)) { | ||
return cachedResults.get(cacheKey); | ||
} | ||
} | ||
@@ -208,8 +216,12 @@ const tokens = tokenize({ css: value }); | ||
} | ||
cachedResults.set(cacheKey, color); | ||
if (cacheKey) { | ||
cachedResults.set(cacheKey, color); | ||
} | ||
return color; | ||
} else { | ||
cachedResults.set(cacheKey, null); | ||
if (cacheKey) { | ||
cachedResults.set(cacheKey, null); | ||
} | ||
return null; | ||
} | ||
} |
@@ -12,5 +12,9 @@ /** | ||
import { cssVar } from './css-var.js'; | ||
import { valueToJsonString } from './util.js'; | ||
/* constants */ | ||
import { FUNC_CALC, FUNC_VAR } from './constant.js'; | ||
import { | ||
FUNC_CALC, FUNC_COLOR, FUNC_MIX, FUNC_VAR, VAL_COMP, VAL_SPEC | ||
} from './constant.js'; | ||
const RGB_TRANSPARENT = 'rgba(0, 0, 0, 0)'; | ||
@@ -28,2 +32,8 @@ /* cached results */ | ||
* @param {string} [opt.currentColor] - color to use for `currentcolor` keyword | ||
* @param {object} [opt.customProperty] | ||
* - custom properties | ||
* - pair of `--` prefixed property name and value, | ||
* e.g. `customProperty: { '--some-color': '#0000ff' }` | ||
* - and/or callback function to get the value of custom property, | ||
* e.g. `customProperty: { callback: someDeclaration.getPropertyValue }` | ||
* @param {string} [opt.format] | ||
@@ -35,5 +45,6 @@ * - output format, one of `computedValue` (default), `specifiedValue`, | ||
* @returns {?string|Array} | ||
* - returns one of rgba?(), color(space r g b / a), color(space x y z / a), | ||
* lab(l a b / A), lch(l c h / a), oklab(l a b / A), oklch(l c h / a), | ||
* #rrggbb(aa)?, null, and, if `key` is specified, [key, rgba?()] etc. | ||
* - one of rgba?(), #rrggbb(aa)?, color-name, '(empty-string)', | ||
* color(color-space r g b / alpha), color(color-space x y z / alpha), | ||
* lab(l a b / alpha), lch(l c h / alpha), oklab(l a b / alpha), | ||
* oklch(l c h / alpha), null or [key, rgba?()] etc. if `key` is specified | ||
* - in `spec`, returned values are numbers, however rgb() values are integers | ||
@@ -43,5 +54,5 @@ * - in `rgb`, values are rounded to integers, and returns `rgba(0, 0, 0, 0)` | ||
* - in `hex`, `transparent` value is resolved as `null`, also returns `null` | ||
* if any of `r`, `g`, `b`, `a` is not a number | ||
* if any of `r`, `g`, `b`, `alpha` is not a number | ||
* - in `hexAlpha`, `transparent` resolves as `#00000000`, and returns `null` | ||
* if any of `r`, `g`, `b`, `a` is not a number | ||
* if any of `r`, `g`, `b`, `alpha` is not a number | ||
*/ | ||
@@ -54,10 +65,17 @@ export const resolve = (color, opt = {}) => { | ||
} | ||
const cacheKey = `{resolve:${color},opt:${JSON.stringify(opt)}}`; | ||
if (cachedResults.has(cacheKey)) { | ||
return cachedResults.get(cacheKey); | ||
const { currentColor, customProperty, format = VAL_COMP, key } = opt; | ||
let cacheKey; | ||
if (!color.includes(FUNC_VAR) || | ||
typeof customProperty?.callback !== 'function') { | ||
cacheKey = `{resolve:${color},opt:${valueToJsonString(opt)}}`; | ||
if (cachedResults.has(cacheKey)) { | ||
return cachedResults.get(cacheKey); | ||
} | ||
} | ||
const { currentColor, format = 'computedValue', key } = opt; | ||
let cs, r, g, b, a; | ||
let res, cs, r, g, b, alpha; | ||
if (color.includes(FUNC_VAR)) { | ||
if (format === 'specifiedValue') { | ||
if (format === VAL_SPEC) { | ||
if (cacheKey) { | ||
cachedResults.set(cacheKey, color); | ||
} | ||
return color; | ||
@@ -70,6 +88,13 @@ } | ||
case 'hexAlpha': { | ||
if (cacheKey) { | ||
cachedResults.set(cacheKey, null); | ||
} | ||
return null; | ||
} | ||
default: { | ||
return 'rgba(0, 0, 0, 0)'; | ||
res = RGB_TRANSPARENT; | ||
if (cacheKey) { | ||
cachedResults.set(cacheKey, res); | ||
} | ||
return res; | ||
} | ||
@@ -85,13 +110,27 @@ } | ||
switch (format) { | ||
case 'computedValue': { | ||
return 'rgba(0, 0, 0, 0)'; | ||
case VAL_COMP: { | ||
res = RGB_TRANSPARENT; | ||
if (cacheKey) { | ||
cachedResults.set(cacheKey, res); | ||
} | ||
return res; | ||
} | ||
case 'specifiedValue': { | ||
case VAL_SPEC: { | ||
if (cacheKey) { | ||
cachedResults.set(cacheKey, color); | ||
} | ||
return color; | ||
} | ||
case 'hex': { | ||
if (cacheKey) { | ||
cachedResults.set(cacheKey, null); | ||
} | ||
return null; | ||
} | ||
case 'hexAlpha': { | ||
return '#00000000'; | ||
res = '#00000000'; | ||
if (cacheKey) { | ||
cachedResults.set(cacheKey, res); | ||
} | ||
return res; | ||
} | ||
@@ -102,39 +141,55 @@ default: { | ||
b = 0; | ||
a = 0; | ||
alpha = 0; | ||
} | ||
} | ||
} else if (color === 'currentcolor') { | ||
if (format === 'specifiedValue') { | ||
if (format === VAL_SPEC) { | ||
if (cacheKey) { | ||
cachedResults.set(cacheKey, color); | ||
} | ||
return color; | ||
} | ||
if (currentColor) { | ||
if (currentColor.startsWith('color-mix')) { | ||
[cs, r, g, b, a] = resolveColorMix(currentColor, { | ||
if (currentColor.startsWith(FUNC_MIX)) { | ||
[cs, r, g, b, alpha] = resolveColorMix(currentColor, { | ||
format | ||
}); | ||
} else if (currentColor.startsWith('color(')) { | ||
[cs, r, g, b, a] = resolveColorFunc(currentColor, { | ||
} else if (currentColor.startsWith(FUNC_COLOR)) { | ||
[cs, r, g, b, alpha] = resolveColorFunc(currentColor, { | ||
format | ||
}); | ||
} else { | ||
[cs, r, g, b, a] = resolveColorValue(currentColor, { | ||
[cs, r, g, b, alpha] = resolveColorValue(currentColor, { | ||
format | ||
}); | ||
} | ||
} else if (format === 'computedValue') { | ||
return 'rgba(0, 0, 0, 0)'; | ||
} else if (format === VAL_COMP) { | ||
res = RGB_TRANSPARENT; | ||
if (cacheKey) { | ||
cachedResults.set(cacheKey, res); | ||
} | ||
return res; | ||
} | ||
} else if (format === 'specifiedValue') { | ||
if (color.startsWith('color-mix')) { | ||
return resolveColorMix(color, { | ||
} else if (format === VAL_SPEC) { | ||
if (color.startsWith(FUNC_MIX)) { | ||
res = resolveColorMix(color, { | ||
format | ||
}); | ||
} else if (color.startsWith('color(')) { | ||
[cs, r, g, b, a] = resolveColorFunc(color, { | ||
if (cacheKey) { | ||
cachedResults.set(cacheKey, res); | ||
} | ||
return res; | ||
} else if (color.startsWith(FUNC_COLOR)) { | ||
[cs, r, g, b, alpha] = resolveColorFunc(color, { | ||
format | ||
}); | ||
if (a === 1) { | ||
return `color(${cs} ${r} ${g} ${b})`; | ||
if (alpha === 1) { | ||
res = `color(${cs} ${r} ${g} ${b})`; | ||
} else { | ||
res = `color(${cs} ${r} ${g} ${b} / ${alpha})`; | ||
} | ||
return `color(${cs} ${r} ${g} ${b} / ${a})`; | ||
if (cacheKey) { | ||
cachedResults.set(cacheKey, res); | ||
} | ||
return res; | ||
} else { | ||
@@ -145,15 +200,29 @@ const rgb = resolveColorValue(color, { | ||
if (!rgb) { | ||
return ''; | ||
res = ''; | ||
if (cacheKey) { | ||
cachedResults.set(cacheKey, res); | ||
} | ||
return res; | ||
} | ||
[cs, r, g, b, a] = rgb; | ||
[cs, r, g, b, alpha] = rgb; | ||
if (cs === 'rgb') { | ||
if (a === 1) { | ||
return `${cs}(${r}, ${g}, ${b})`; | ||
if (alpha === 1) { | ||
res = `${cs}(${r}, ${g}, ${b})`; | ||
} else { | ||
res = `${cs}a(${r}, ${g}, ${b}, ${alpha})`; | ||
} | ||
return `${cs}a(${r}, ${g}, ${b}, ${a})`; | ||
if (cacheKey) { | ||
cachedResults.set(cacheKey, res); | ||
} | ||
return res; | ||
} | ||
if (a === 1) { | ||
return `${cs}(${r} ${g} ${b})`; | ||
if (alpha === 1) { | ||
res = `${cs}(${r} ${g} ${b})`; | ||
} else { | ||
res = `${cs}(${r} ${g} ${b} / ${alpha})`; | ||
} | ||
return `${cs}(${r} ${g} ${b} / ${a})`; | ||
if (cacheKey) { | ||
cachedResults.set(cacheKey, res); | ||
} | ||
return res; | ||
} | ||
@@ -165,6 +234,6 @@ } else if (/currentcolor/.test(color)) { | ||
if (/transparent/.test(color)) { | ||
color = color.replace(/transparent/g, 'rgba(0, 0, 0, 0)'); | ||
color = color.replace(/transparent/g, RGB_TRANSPARENT); | ||
} | ||
if (color.startsWith('color-mix')) { | ||
[cs, r, g, b, a] = resolveColorMix(color, { | ||
if (color.startsWith(FUNC_MIX)) { | ||
[cs, r, g, b, alpha] = resolveColorMix(color, { | ||
format | ||
@@ -174,26 +243,25 @@ }); | ||
} else if (/transparent/.test(color)) { | ||
color = color.replace(/transparent/g, 'rgba(0, 0, 0, 0)'); | ||
if (color.startsWith('color-mix')) { | ||
[cs, r, g, b, a] = resolveColorMix(color, { | ||
color = color.replace(/transparent/g, RGB_TRANSPARENT); | ||
if (color.startsWith(FUNC_MIX)) { | ||
[cs, r, g, b, alpha] = resolveColorMix(color, { | ||
format | ||
}); | ||
} | ||
} else if (color.startsWith('color-mix')) { | ||
[cs, r, g, b, a] = resolveColorMix(color, { | ||
} else if (color.startsWith(FUNC_MIX)) { | ||
[cs, r, g, b, alpha] = resolveColorMix(color, { | ||
format | ||
}); | ||
} else if (color.startsWith('color(')) { | ||
[cs, r, g, b, a] = resolveColorFunc(color, { | ||
} else if (color.startsWith(FUNC_COLOR)) { | ||
[cs, r, g, b, alpha] = resolveColorFunc(color, { | ||
format | ||
}); | ||
} else if (color) { | ||
[cs, r, g, b, a] = resolveColorValue(color, { | ||
[cs, r, g, b, alpha] = resolveColorValue(color, { | ||
format | ||
}); | ||
} | ||
let res; | ||
switch (format) { | ||
case 'hex': { | ||
let hex; | ||
if (isNaN(r) || isNaN(g) || isNaN(b) || isNaN(a) || a === 0) { | ||
if (isNaN(r) || isNaN(g) || isNaN(b) || isNaN(alpha) || alpha === 0) { | ||
hex = null; | ||
@@ -212,6 +280,6 @@ } else { | ||
let hex; | ||
if (isNaN(r) || isNaN(g) || isNaN(b) || isNaN(a)) { | ||
if (isNaN(r) || isNaN(g) || isNaN(b) || isNaN(alpha)) { | ||
hex = null; | ||
} else { | ||
hex = convertRgbToHex([r, g, b, a]); | ||
hex = convertRgbToHex([r, g, b, alpha]); | ||
} | ||
@@ -227,6 +295,6 @@ if (key) { | ||
let rgb; | ||
if (a === 1) { | ||
if (alpha === 1) { | ||
rgb = `rgb(${r}, ${g}, ${b})`; | ||
} else { | ||
rgb = `rgba(${r}, ${g}, ${b}, ${a})`; | ||
rgb = `rgba(${r}, ${g}, ${b}, ${alpha})`; | ||
} | ||
@@ -240,3 +308,3 @@ if (key) { | ||
} | ||
case 'computedValue': | ||
case VAL_COMP: | ||
default: { | ||
@@ -246,6 +314,6 @@ let value; | ||
case 'rgb': { | ||
if (a === 1) { | ||
if (alpha === 1) { | ||
value = `${cs}(${r}, ${g}, ${b})`; | ||
} else { | ||
value = `${cs}a(${r}, ${g}, ${b}, ${a})`; | ||
value = `${cs}a(${r}, ${g}, ${b}, ${alpha})`; | ||
} | ||
@@ -258,6 +326,6 @@ break; | ||
case 'oklch': { | ||
if (a === 1) { | ||
if (alpha === 1) { | ||
value = `${cs}(${r} ${g} ${b})`; | ||
} else { | ||
value = `${cs}(${r} ${g} ${b} / ${a})`; | ||
value = `${cs}(${r} ${g} ${b} / ${alpha})`; | ||
} | ||
@@ -268,6 +336,6 @@ break; | ||
default: { | ||
if (a === 1) { | ||
if (alpha === 1) { | ||
value = `color(${cs} ${r} ${g} ${b})`; | ||
} else { | ||
value = `color(${cs} ${r} ${g} ${b} / ${a})`; | ||
value = `color(${cs} ${r} ${g} ${b} / ${alpha})`; | ||
} | ||
@@ -283,4 +351,6 @@ } | ||
} | ||
cachedResults.set(cacheKey, res); | ||
if (cacheKey) { | ||
cachedResults.set(cacheKey, res); | ||
} | ||
return res; | ||
}; |
@@ -160,7 +160,6 @@ export namespace NAMED_COLORS { | ||
export function transformMatrix(mtx: Array<Array<number>>, vct: Array<number>, skip?: boolean): Array<number>; | ||
export function reInsertMissingColorComponents(value: string, color?: any[]): Array<number | string>; | ||
export function normalizeColorComponents(colorA: any[], colorB: any[], skip?: boolean): Array<Array<number>>; | ||
export function numberToHexString(value: number): string; | ||
export function angleToDeg(angle: string): number; | ||
export function parseAlpha(a?: string | null): number; | ||
export function parseAlpha(alpha?: string | null): number; | ||
export function parseHexAlpha(value: string): number; | ||
@@ -192,33 +191,37 @@ export function convertRgbToLinearRgb(rgb: Array<number>, skip?: boolean): Array<number>; | ||
format?: string; | ||
}): Array<string | number> | string; | ||
}): Array<string | number> | (string | null); | ||
export function parseHwb(value: string, opt?: { | ||
format?: string; | ||
}): Array<string | number> | string; | ||
}): Array<string | number> | (string | null); | ||
export function parseLab(value: string, opt?: { | ||
format?: string; | ||
}): Array<string | number> | string; | ||
}): Array<string | number> | (string | null); | ||
export function parseLch(value: string, opt?: { | ||
format?: string; | ||
}): Array<string | number> | string; | ||
}): Array<string | number> | (string | null); | ||
export function parseOklab(value: string, opt?: { | ||
format?: string; | ||
}): Array<string | number> | string; | ||
}): Array<string | number> | (string | null); | ||
export function parseOklch(value: string, opt?: { | ||
format?: string; | ||
}): Array<string | number> | string; | ||
}): Array<string | number> | (string | null); | ||
export function parseColorFunc(value: string, opt?: { | ||
colorSpace?: string; | ||
d50?: boolean; | ||
format?: string; | ||
}): Array<string | number> | string; | ||
}): Array<string | number> | (string | null); | ||
export function parseColorValue(value: string, opt?: { | ||
d50?: boolean; | ||
format?: string; | ||
}): Array<string | number> | string; | ||
}): Array<string | number> | (string | null); | ||
export function resolveColorValue(value: string, opt?: { | ||
colorSpace?: string; | ||
format?: string; | ||
}): Array<string | number> | string; | ||
}): Array<string | number> | (string | null); | ||
export function resolveColorFunc(value: string, opt?: { | ||
colorSpace?: string; | ||
format?: string; | ||
}): Array<string | number> | string; | ||
}): Array<string | number> | (string | null); | ||
export function convertColorToLinearRgb(value: string, opt?: { | ||
colorSpace?: string; | ||
format?: string; | ||
@@ -253,2 +256,2 @@ }): Array<number>; | ||
format?: string; | ||
}): Array<string | number> | string; | ||
}): Array<string | number> | (string | null); |
@@ -0,21 +1,25 @@ | ||
export const ANGLE: "deg|g?rad|turn"; | ||
export const CS_SRGB: "srgb(?:-linear)?"; | ||
export const CS_RGB: "(?:a98|prophoto)-rgb|display-p3|rec2020|srgb(?:-linear)?"; | ||
export const CS_XYZ: "xyz(?:-d(?:50|65))?"; | ||
export const CS_MIX: "(?:ok)?l(?:ab|ch)|h(?:sl|wb)|srgb(?:-linear)?|xyz(?:-d(?:50|65))?"; | ||
export const FUNC_CALC: "calc("; | ||
export const FUNC_COLOR: "color("; | ||
export const FUNC_MIX: "color-mix("; | ||
export const FUNC_VAR: "var("; | ||
export const NONE: "none"; | ||
export const SYN_ANGLE: "deg|g?rad|turn"; | ||
export const SYN_SRGB: "srgb(?:-linear)?"; | ||
export const SYN_COLOR_SPACE_XYZ: "xyz(?:-d(?:50|65))?"; | ||
export const SYN_COLOR_SPACE_COLOR_MIX: "(?:ok)?l(?:ab|ch)|h(?:sl|wb)|srgb(?:-linear)?|xyz(?:-d(?:50|65))?"; | ||
export const SYN_COLOR_SPACE_RGB: "(?:a98|prophoto)-rgb|display-p3|rec2020|srgb(?:-linear)?"; | ||
export const SYN_NUM: "[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?"; | ||
export const SYN_PCT: "[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%"; | ||
export const SYN_HSL: "(?:[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?(?:deg|g?rad|turn)?|none)(?:\\s+(?:[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%|[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?|none)){2}(?:\\s*\\/\\s*(?:[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?|[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%|none))?"; | ||
export const NUM: "[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?"; | ||
export const PCT: "[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%"; | ||
export const VAL_COMP: "computedValue"; | ||
export const VAL_SPEC: "specifiedValue"; | ||
export const SYN_FUNC_COLOR: "(?:(?:a98|prophoto)-rgb|display-p3|rec2020|srgb(?:-linear)?|xyz(?:-d(?:50|65))?)(?:\\s+(?:[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?|[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%|none)){3}(?:\\s*\\/\\s*(?:[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?|[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%|none))?"; | ||
export const SYN_HSL: "(?:[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?(?:deg|g?rad|turn)?|none)(?:\\s+(?:[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?|[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%|none)){2}(?:\\s*\\/\\s*(?:[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?|[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-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|[1-9]\\d*))?%|none)){3}(?:\\s*\\/\\s*(?:[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?|[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%|none))?\\s*\\))(?:\\s+[+-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)(?:e-?(?:0|[1-9]\\d*))?%)?)\\s*\\)"; |
export const cachedResults: LRUCache<{}, {}, unknown>; | ||
export function preProcess(value: string, opt?: object): string | null; | ||
export function preProcess(value: string, opt?: { | ||
customProperty?: object; | ||
}): string | null; | ||
export function numberToHex(value: number): string; | ||
export function colorToHex(value: string, opt?: { | ||
alpha?: boolean; | ||
customProperty?: object; | ||
}): string | null; | ||
export function colorToHsl(value: string, opt?: object): Array<number>; | ||
export function colorToHwb(value: string, opt?: object): Array<number>; | ||
export function colorToLab(value: string, opt?: object): Array<number>; | ||
export function colorToLch(value: string, opt?: object): Array<number>; | ||
export function colorToOklab(value: string, opt?: object): Array<number>; | ||
export function colorToOklch(value: string, opt?: object): Array<number>; | ||
export function colorToRgb(value: string, opt?: object): Array<number>; | ||
export function colorToHsl(value: string, opt?: { | ||
customProperty?: object; | ||
}): Array<number>; | ||
export function colorToHwb(value: string, opt?: { | ||
customProperty?: object; | ||
}): Array<number>; | ||
export function colorToLab(value: string, opt?: { | ||
customProperty?: object; | ||
}): Array<number>; | ||
export function colorToLch(value: string, opt?: { | ||
customProperty?: object; | ||
}): Array<number>; | ||
export function colorToOklab(value: string, opt?: { | ||
customProperty?: object; | ||
}): Array<number>; | ||
export function colorToOklch(value: string, opt?: { | ||
customProperty?: object; | ||
}): Array<number>; | ||
export function colorToRgb(value: string, opt?: { | ||
customProperty?: object; | ||
}): Array<number>; | ||
export function colorToXyz(value: string, opt?: { | ||
d50?: boolean; | ||
customProperty?: object; | ||
}): Array<number>; | ||
@@ -17,0 +34,0 @@ export function colorToXyzD50(value: string, opt?: object): Array<number>; |
@@ -5,5 +5,7 @@ export function resolveCssVariable(tokens: Array<any[]>, opt?: { | ||
export function parseTokens(tokens: Array<any[]>, opt?: object): Array<any[]> | null; | ||
export function cssVar(value: string, opt?: object): string | null; | ||
export function cssVar(value: string, opt?: { | ||
customProperty?: object; | ||
}): string | null; | ||
export const cachedResults: LRUCache<{}, {}, unknown>; | ||
export function isColor(value: string): boolean; | ||
import { LRUCache } from 'lru-cache'; |
export const cachedResults: LRUCache<{}, {}, unknown>; | ||
export function resolve(color: string, opt?: { | ||
currentColor?: string; | ||
customProperty?: object; | ||
format?: string; | ||
@@ -5,0 +6,0 @@ key?: any; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
23
9.52%247
15.96%1310382
-1.17%5516
-1.2%