@chipmobilesdk/rn-theme 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +111 -0
- package/README.md +3 -1
- package/lib/commonjs/color/categorical.js +35 -0
- package/lib/commonjs/color/categorical.js.map +1 -0
- package/lib/commonjs/color/contrast.js +199 -0
- package/lib/commonjs/color/contrast.js.map +1 -0
- package/lib/commonjs/color/parse.js +110 -0
- package/lib/commonjs/color/parse.js.map +1 -0
- package/lib/commonjs/color/roles.js +235 -0
- package/lib/commonjs/color/roles.js.map +1 -0
- package/lib/commonjs/index.js +94 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/integration/navigationTheme.js +43 -0
- package/lib/commonjs/integration/navigationTheme.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/presets/byTone.js +28 -0
- package/lib/commonjs/presets/byTone.js.map +1 -0
- package/lib/commonjs/presets/layout.js +67 -0
- package/lib/commonjs/presets/layout.js.map +1 -0
- package/lib/commonjs/presets/themePresets.js +115 -0
- package/lib/commonjs/presets/themePresets.js.map +1 -0
- package/lib/commonjs/theme/buildThemes.js +211 -0
- package/lib/commonjs/theme/buildThemes.js.map +1 -0
- package/lib/commonjs/theme/errors.js +49 -0
- package/lib/commonjs/theme/errors.js.map +1 -0
- package/lib/commonjs/theme/overrides.js +125 -0
- package/lib/commonjs/theme/overrides.js.map +1 -0
- package/lib/commonjs/theme/validateThemeConfig.js +157 -0
- package/lib/commonjs/theme/validateThemeConfig.js.map +1 -0
- package/lib/commonjs/tokens/defaults.js +132 -0
- package/lib/commonjs/tokens/defaults.js.map +1 -0
- package/lib/commonjs/tokens/typography.js +136 -0
- package/lib/commonjs/tokens/typography.js.map +1 -0
- package/lib/commonjs/types/brand.js +2 -0
- package/lib/commonjs/types/brand.js.map +1 -0
- package/lib/commonjs/types/colors.js +2 -0
- package/lib/commonjs/types/colors.js.map +1 -0
- package/lib/commonjs/types/index.js +2 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/commonjs/types/theme.js +6 -0
- package/lib/commonjs/types/theme.js.map +1 -0
- package/lib/commonjs/types/tokens.js +2 -0
- package/lib/commonjs/types/tokens.js.map +1 -0
- package/lib/commonjs/types/typography.js +2 -0
- package/lib/commonjs/types/typography.js.map +1 -0
- package/lib/commonjs/unistyles/createUnistylesConfig.js +113 -0
- package/lib/commonjs/unistyles/createUnistylesConfig.js.map +1 -0
- package/lib/commonjs/unistyles/themeMode.js +39 -0
- package/lib/commonjs/unistyles/themeMode.js.map +1 -0
- package/lib/commonjs/vendor/mcu/LICENSE +191 -0
- package/lib/commonjs/vendor/mcu/hct/cam16.js +362 -0
- package/lib/commonjs/vendor/mcu/hct/cam16.js.map +1 -0
- package/lib/commonjs/vendor/mcu/hct/hct.js +183 -0
- package/lib/commonjs/vendor/mcu/hct/hct.js.map +1 -0
- package/lib/commonjs/vendor/mcu/hct/hct_solver.js +401 -0
- package/lib/commonjs/vendor/mcu/hct/hct_solver.js.map +1 -0
- package/lib/commonjs/vendor/mcu/hct/viewing_conditions.js +116 -0
- package/lib/commonjs/vendor/mcu/hct/viewing_conditions.js.map +1 -0
- package/lib/commonjs/vendor/mcu/index.js +27 -0
- package/lib/commonjs/vendor/mcu/index.js.map +1 -0
- package/lib/commonjs/vendor/mcu/palettes/tonal_palette.js +177 -0
- package/lib/commonjs/vendor/mcu/palettes/tonal_palette.js.map +1 -0
- package/lib/commonjs/vendor/mcu/utils/color_utils.js +298 -0
- package/lib/commonjs/vendor/mcu/utils/color_utils.js.map +1 -0
- package/lib/commonjs/vendor/mcu/utils/math_utils.js +158 -0
- package/lib/commonjs/vendor/mcu/utils/math_utils.js.map +1 -0
- package/lib/module/color/categorical.js +31 -0
- package/lib/module/color/categorical.js.map +1 -0
- package/lib/module/color/contrast.js +194 -0
- package/lib/module/color/contrast.js.map +1 -0
- package/lib/module/color/parse.js +101 -0
- package/lib/module/color/parse.js.map +1 -0
- package/lib/module/color/roles.js +229 -0
- package/lib/module/color/roles.js.map +1 -0
- package/lib/module/index.js +23 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/integration/navigationTheme.js +39 -0
- package/lib/module/integration/navigationTheme.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/presets/byTone.js +24 -0
- package/lib/module/presets/byTone.js.map +1 -0
- package/lib/module/presets/layout.js +63 -0
- package/lib/module/presets/layout.js.map +1 -0
- package/lib/module/presets/themePresets.js +110 -0
- package/lib/module/presets/themePresets.js.map +1 -0
- package/lib/module/theme/buildThemes.js +208 -0
- package/lib/module/theme/buildThemes.js.map +1 -0
- package/lib/module/theme/errors.js +43 -0
- package/lib/module/theme/errors.js.map +1 -0
- package/lib/module/theme/overrides.js +119 -0
- package/lib/module/theme/overrides.js.map +1 -0
- package/lib/module/theme/validateThemeConfig.js +152 -0
- package/lib/module/theme/validateThemeConfig.js.map +1 -0
- package/lib/module/tokens/defaults.js +120 -0
- package/lib/module/tokens/defaults.js.map +1 -0
- package/lib/module/tokens/typography.js +129 -0
- package/lib/module/tokens/typography.js.map +1 -0
- package/lib/module/types/brand.js +2 -0
- package/lib/module/types/brand.js.map +1 -0
- package/lib/module/types/colors.js +2 -0
- package/lib/module/types/colors.js.map +1 -0
- package/lib/module/types/index.js +2 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/types/theme.js +4 -0
- package/lib/module/types/theme.js.map +1 -0
- package/lib/module/types/tokens.js +2 -0
- package/lib/module/types/tokens.js.map +1 -0
- package/lib/module/types/typography.js +2 -0
- package/lib/module/types/typography.js.map +1 -0
- package/lib/module/unistyles/createUnistylesConfig.js +109 -0
- package/lib/module/unistyles/createUnistylesConfig.js.map +1 -0
- package/lib/module/unistyles/themeMode.js +36 -0
- package/lib/module/unistyles/themeMode.js.map +1 -0
- package/lib/module/vendor/mcu/LICENSE +191 -0
- package/lib/module/vendor/mcu/hct/cam16.js +356 -0
- package/lib/module/vendor/mcu/hct/cam16.js.map +1 -0
- package/lib/module/vendor/mcu/hct/hct.js +178 -0
- package/lib/module/vendor/mcu/hct/hct.js.map +1 -0
- package/lib/module/vendor/mcu/hct/hct_solver.js +396 -0
- package/lib/module/vendor/mcu/hct/hct_solver.js.map +1 -0
- package/lib/module/vendor/mcu/hct/viewing_conditions.js +110 -0
- package/lib/module/vendor/mcu/hct/viewing_conditions.js.map +1 -0
- package/lib/module/vendor/mcu/index.js +8 -0
- package/lib/module/vendor/mcu/index.js.map +1 -0
- package/lib/module/vendor/mcu/palettes/tonal_palette.js +172 -0
- package/lib/module/vendor/mcu/palettes/tonal_palette.js.map +1 -0
- package/lib/module/vendor/mcu/utils/color_utils.js +277 -0
- package/lib/module/vendor/mcu/utils/color_utils.js.map +1 -0
- package/lib/module/vendor/mcu/utils/math_utils.js +146 -0
- package/lib/module/vendor/mcu/utils/math_utils.js.map +1 -0
- package/lib/typescript/commonjs/color/categorical.d.ts +7 -0
- package/lib/typescript/commonjs/color/categorical.d.ts.map +1 -0
- package/lib/typescript/commonjs/color/contrast.d.ts +26 -0
- package/lib/typescript/commonjs/color/contrast.d.ts.map +1 -0
- package/lib/typescript/commonjs/color/parse.d.ts +25 -0
- package/lib/typescript/commonjs/color/parse.d.ts.map +1 -0
- package/lib/typescript/commonjs/color/roles.d.ts +26 -0
- package/lib/typescript/commonjs/color/roles.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +18 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/integration/navigationTheme.d.ts +30 -0
- package/lib/typescript/commonjs/integration/navigationTheme.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/presets/byTone.d.ts +19 -0
- package/lib/typescript/commonjs/presets/byTone.d.ts.map +1 -0
- package/lib/typescript/commonjs/presets/layout.d.ts +63 -0
- package/lib/typescript/commonjs/presets/layout.d.ts.map +1 -0
- package/lib/typescript/commonjs/presets/themePresets.d.ts +11 -0
- package/lib/typescript/commonjs/presets/themePresets.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/buildThemes.d.ts +18 -0
- package/lib/typescript/commonjs/theme/buildThemes.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/errors.d.ts +23 -0
- package/lib/typescript/commonjs/theme/errors.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/overrides.d.ts +11 -0
- package/lib/typescript/commonjs/theme/overrides.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/validateThemeConfig.d.ts +6 -0
- package/lib/typescript/commonjs/theme/validateThemeConfig.d.ts.map +1 -0
- package/lib/typescript/commonjs/tokens/defaults.d.ts +23 -0
- package/lib/typescript/commonjs/tokens/defaults.d.ts.map +1 -0
- package/lib/typescript/commonjs/tokens/typography.d.ts +14 -0
- package/lib/typescript/commonjs/tokens/typography.d.ts.map +1 -0
- package/lib/typescript/commonjs/types/brand.d.ts +21 -0
- package/lib/typescript/commonjs/types/brand.d.ts.map +1 -0
- package/lib/typescript/commonjs/types/colors.d.ts +76 -0
- package/lib/typescript/commonjs/types/colors.d.ts.map +1 -0
- package/lib/typescript/commonjs/types/index.d.ts +6 -0
- package/lib/typescript/commonjs/types/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/types/theme.d.ts +140 -0
- package/lib/typescript/commonjs/types/theme.d.ts.map +1 -0
- package/lib/typescript/commonjs/types/tokens.d.ts +79 -0
- package/lib/typescript/commonjs/types/tokens.d.ts.map +1 -0
- package/lib/typescript/commonjs/types/typography.d.ts +53 -0
- package/lib/typescript/commonjs/types/typography.d.ts.map +1 -0
- package/lib/typescript/commonjs/unistyles/createUnistylesConfig.d.ts +52 -0
- package/lib/typescript/commonjs/unistyles/createUnistylesConfig.d.ts.map +1 -0
- package/lib/typescript/commonjs/unistyles/themeMode.d.ts +13 -0
- package/lib/typescript/commonjs/unistyles/themeMode.d.ts.map +1 -0
- package/lib/typescript/commonjs/vendor/mcu/hct/cam16.d.ts +132 -0
- package/lib/typescript/commonjs/vendor/mcu/hct/cam16.d.ts.map +1 -0
- package/lib/typescript/commonjs/vendor/mcu/hct/hct.d.ts +93 -0
- package/lib/typescript/commonjs/vendor/mcu/hct/hct.d.ts.map +1 -0
- package/lib/typescript/commonjs/vendor/mcu/hct/hct_solver.d.ts +147 -0
- package/lib/typescript/commonjs/vendor/mcu/hct/hct_solver.d.ts.map +1 -0
- package/lib/typescript/commonjs/vendor/mcu/hct/viewing_conditions.d.ts +75 -0
- package/lib/typescript/commonjs/vendor/mcu/hct/viewing_conditions.d.ts.map +1 -0
- package/lib/typescript/commonjs/vendor/mcu/index.d.ts +4 -0
- package/lib/typescript/commonjs/vendor/mcu/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/vendor/mcu/palettes/tonal_palette.d.ts +56 -0
- package/lib/typescript/commonjs/vendor/mcu/palettes/tonal_palette.d.ts.map +1 -0
- package/lib/typescript/commonjs/vendor/mcu/utils/color_utils.d.ts +129 -0
- package/lib/typescript/commonjs/vendor/mcu/utils/color_utils.d.ts.map +1 -0
- package/lib/typescript/commonjs/vendor/mcu/utils/math_utils.d.ts +83 -0
- package/lib/typescript/commonjs/vendor/mcu/utils/math_utils.d.ts.map +1 -0
- package/lib/typescript/module/color/categorical.d.ts +7 -0
- package/lib/typescript/module/color/categorical.d.ts.map +1 -0
- package/lib/typescript/module/color/contrast.d.ts +26 -0
- package/lib/typescript/module/color/contrast.d.ts.map +1 -0
- package/lib/typescript/module/color/parse.d.ts +25 -0
- package/lib/typescript/module/color/parse.d.ts.map +1 -0
- package/lib/typescript/module/color/roles.d.ts +26 -0
- package/lib/typescript/module/color/roles.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +18 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/integration/navigationTheme.d.ts +30 -0
- package/lib/typescript/module/integration/navigationTheme.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/presets/byTone.d.ts +19 -0
- package/lib/typescript/module/presets/byTone.d.ts.map +1 -0
- package/lib/typescript/module/presets/layout.d.ts +63 -0
- package/lib/typescript/module/presets/layout.d.ts.map +1 -0
- package/lib/typescript/module/presets/themePresets.d.ts +11 -0
- package/lib/typescript/module/presets/themePresets.d.ts.map +1 -0
- package/lib/typescript/module/theme/buildThemes.d.ts +18 -0
- package/lib/typescript/module/theme/buildThemes.d.ts.map +1 -0
- package/lib/typescript/module/theme/errors.d.ts +23 -0
- package/lib/typescript/module/theme/errors.d.ts.map +1 -0
- package/lib/typescript/module/theme/overrides.d.ts +11 -0
- package/lib/typescript/module/theme/overrides.d.ts.map +1 -0
- package/lib/typescript/module/theme/validateThemeConfig.d.ts +6 -0
- package/lib/typescript/module/theme/validateThemeConfig.d.ts.map +1 -0
- package/lib/typescript/module/tokens/defaults.d.ts +23 -0
- package/lib/typescript/module/tokens/defaults.d.ts.map +1 -0
- package/lib/typescript/module/tokens/typography.d.ts +14 -0
- package/lib/typescript/module/tokens/typography.d.ts.map +1 -0
- package/lib/typescript/module/types/brand.d.ts +21 -0
- package/lib/typescript/module/types/brand.d.ts.map +1 -0
- package/lib/typescript/module/types/colors.d.ts +76 -0
- package/lib/typescript/module/types/colors.d.ts.map +1 -0
- package/lib/typescript/module/types/index.d.ts +6 -0
- package/lib/typescript/module/types/index.d.ts.map +1 -0
- package/lib/typescript/module/types/theme.d.ts +140 -0
- package/lib/typescript/module/types/theme.d.ts.map +1 -0
- package/lib/typescript/module/types/tokens.d.ts +79 -0
- package/lib/typescript/module/types/tokens.d.ts.map +1 -0
- package/lib/typescript/module/types/typography.d.ts +53 -0
- package/lib/typescript/module/types/typography.d.ts.map +1 -0
- package/lib/typescript/module/unistyles/createUnistylesConfig.d.ts +52 -0
- package/lib/typescript/module/unistyles/createUnistylesConfig.d.ts.map +1 -0
- package/lib/typescript/module/unistyles/themeMode.d.ts +13 -0
- package/lib/typescript/module/unistyles/themeMode.d.ts.map +1 -0
- package/lib/typescript/module/vendor/mcu/hct/cam16.d.ts +132 -0
- package/lib/typescript/module/vendor/mcu/hct/cam16.d.ts.map +1 -0
- package/lib/typescript/module/vendor/mcu/hct/hct.d.ts +93 -0
- package/lib/typescript/module/vendor/mcu/hct/hct.d.ts.map +1 -0
- package/lib/typescript/module/vendor/mcu/hct/hct_solver.d.ts +147 -0
- package/lib/typescript/module/vendor/mcu/hct/hct_solver.d.ts.map +1 -0
- package/lib/typescript/module/vendor/mcu/hct/viewing_conditions.d.ts +75 -0
- package/lib/typescript/module/vendor/mcu/hct/viewing_conditions.d.ts.map +1 -0
- package/lib/typescript/module/vendor/mcu/index.d.ts +4 -0
- package/lib/typescript/module/vendor/mcu/index.d.ts.map +1 -0
- package/lib/typescript/module/vendor/mcu/palettes/tonal_palette.d.ts +56 -0
- package/lib/typescript/module/vendor/mcu/palettes/tonal_palette.d.ts.map +1 -0
- package/lib/typescript/module/vendor/mcu/utils/color_utils.d.ts +129 -0
- package/lib/typescript/module/vendor/mcu/utils/color_utils.d.ts.map +1 -0
- package/lib/typescript/module/vendor/mcu/utils/math_utils.d.ts +83 -0
- package/lib/typescript/module/vendor/mcu/utils/math_utils.d.ts.map +1 -0
- package/package.json +40 -16
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.clampDouble = clampDouble;
|
|
7
|
+
exports.clampInt = clampInt;
|
|
8
|
+
exports.differenceDegrees = differenceDegrees;
|
|
9
|
+
exports.lerp = lerp;
|
|
10
|
+
exports.matrixMultiply = matrixMultiply;
|
|
11
|
+
exports.rotationDirection = rotationDirection;
|
|
12
|
+
exports.sanitizeDegreesDouble = sanitizeDegreesDouble;
|
|
13
|
+
exports.sanitizeDegreesInt = sanitizeDegreesInt;
|
|
14
|
+
exports.signum = signum;
|
|
15
|
+
/**
|
|
16
|
+
* @license
|
|
17
|
+
* Copyright 2021 Google LLC
|
|
18
|
+
*
|
|
19
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
20
|
+
* you may not use this file except in compliance with the License.
|
|
21
|
+
* You may obtain a copy of the License at
|
|
22
|
+
*
|
|
23
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
24
|
+
*
|
|
25
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
26
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
27
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
28
|
+
* See the License for the specific language governing permissions and
|
|
29
|
+
* limitations under the License.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
// Vendored from material-foundation/material-color-utilities v0.4.0
|
|
33
|
+
// (commit dd62982dfdefdfc9232ce8d76e122fb1c6d188ae, typescript/). Modified:
|
|
34
|
+
// relative import specifiers drop the `.js` suffix so Metro and Jest resolve them.
|
|
35
|
+
// This file is automatically generated. Do not modify it.
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Utility methods for mathematical operations.
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The signum function.
|
|
43
|
+
*
|
|
44
|
+
* @return 1 if num > 0, -1 if num < 0, and 0 if num = 0
|
|
45
|
+
*/
|
|
46
|
+
function signum(num) {
|
|
47
|
+
if (num < 0) {
|
|
48
|
+
return -1;
|
|
49
|
+
} else if (num === 0) {
|
|
50
|
+
return 0;
|
|
51
|
+
} else {
|
|
52
|
+
return 1;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The linear interpolation function.
|
|
58
|
+
*
|
|
59
|
+
* @return start if amount = 0 and stop if amount = 1
|
|
60
|
+
*/
|
|
61
|
+
function lerp(start, stop, amount) {
|
|
62
|
+
return (1.0 - amount) * start + amount * stop;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Clamps an integer between two integers.
|
|
67
|
+
*
|
|
68
|
+
* @return input when min <= input <= max, and either min or max
|
|
69
|
+
* otherwise.
|
|
70
|
+
*/
|
|
71
|
+
function clampInt(min, max, input) {
|
|
72
|
+
if (input < min) {
|
|
73
|
+
return min;
|
|
74
|
+
} else if (input > max) {
|
|
75
|
+
return max;
|
|
76
|
+
}
|
|
77
|
+
return input;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Clamps an integer between two floating-point numbers.
|
|
82
|
+
*
|
|
83
|
+
* @return input when min <= input <= max, and either min or max
|
|
84
|
+
* otherwise.
|
|
85
|
+
*/
|
|
86
|
+
function clampDouble(min, max, input) {
|
|
87
|
+
if (input < min) {
|
|
88
|
+
return min;
|
|
89
|
+
} else if (input > max) {
|
|
90
|
+
return max;
|
|
91
|
+
}
|
|
92
|
+
return input;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Sanitizes a degree measure as an integer.
|
|
97
|
+
*
|
|
98
|
+
* @return a degree measure between 0 (inclusive) and 360
|
|
99
|
+
* (exclusive).
|
|
100
|
+
*/
|
|
101
|
+
function sanitizeDegreesInt(degrees) {
|
|
102
|
+
degrees = degrees % 360;
|
|
103
|
+
if (degrees < 0) {
|
|
104
|
+
degrees = degrees + 360;
|
|
105
|
+
}
|
|
106
|
+
return degrees;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Sanitizes a degree measure as a floating-point number.
|
|
111
|
+
*
|
|
112
|
+
* @return a degree measure between 0.0 (inclusive) and 360.0
|
|
113
|
+
* (exclusive).
|
|
114
|
+
*/
|
|
115
|
+
function sanitizeDegreesDouble(degrees) {
|
|
116
|
+
degrees = degrees % 360.0;
|
|
117
|
+
if (degrees < 0) {
|
|
118
|
+
degrees = degrees + 360.0;
|
|
119
|
+
}
|
|
120
|
+
return degrees;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Sign of direction change needed to travel from one angle to
|
|
125
|
+
* another.
|
|
126
|
+
*
|
|
127
|
+
* For angles that are 180 degrees apart from each other, both
|
|
128
|
+
* directions have the same travel distance, so either direction is
|
|
129
|
+
* shortest. The value 1.0 is returned in this case.
|
|
130
|
+
*
|
|
131
|
+
* @param from The angle travel starts from, in degrees.
|
|
132
|
+
* @param to The angle travel ends at, in degrees.
|
|
133
|
+
* @return -1 if decreasing from leads to the shortest travel
|
|
134
|
+
* distance, 1 if increasing from leads to the shortest travel
|
|
135
|
+
* distance.
|
|
136
|
+
*/
|
|
137
|
+
function rotationDirection(from, to) {
|
|
138
|
+
const increasingDifference = sanitizeDegreesDouble(to - from);
|
|
139
|
+
return increasingDifference <= 180.0 ? 1.0 : -1.0;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Distance of two points on a circle, represented using degrees.
|
|
144
|
+
*/
|
|
145
|
+
function differenceDegrees(a, b) {
|
|
146
|
+
return 180.0 - Math.abs(Math.abs(a - b) - 180.0);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Multiplies a 1x3 row vector with a 3x3 matrix.
|
|
151
|
+
*/
|
|
152
|
+
function matrixMultiply(row, matrix) {
|
|
153
|
+
const a = row[0] * matrix[0][0] + row[1] * matrix[0][1] + row[2] * matrix[0][2];
|
|
154
|
+
const b = row[0] * matrix[1][0] + row[1] * matrix[1][1] + row[2] * matrix[1][2];
|
|
155
|
+
const c = row[0] * matrix[2][0] + row[1] * matrix[2][1] + row[2] * matrix[2][2];
|
|
156
|
+
return [a, b, c];
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=math_utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["signum","num","lerp","start","stop","amount","clampInt","min","max","input","clampDouble","sanitizeDegreesInt","degrees","sanitizeDegreesDouble","rotationDirection","from","to","increasingDifference","differenceDegrees","a","b","Math","abs","matrixMultiply","row","matrix","c"],"sourceRoot":"../../../../../src","sources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,GAAGD,GAAG,CAAC,CAAC,CAAC,GAAGC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;EACzE,MAAMC,CAAC,GACHF,GAAG,CAAC,CAAC,CAAC,GAAGC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAGD,GAAG,CAAC,CAAC,CAAC,GAAGC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAGD,GAAG,CAAC,CAAC,CAAC,GAAGC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;EACzE,OAAO,CAACN,CAAC,EAAEC,CAAC,EAAEM,CAAC,CAAC;AAClB","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Hct } from "../vendor/mcu/index.js";
|
|
4
|
+
import { argbFromColor, hexFromArgb } from "./parse.js";
|
|
5
|
+
const SERIES_COUNT = 8;
|
|
6
|
+
const SERIES_CHROMA = 48;
|
|
7
|
+
/** 3 × 45°: consecutive series land far apart on the hue wheel. */
|
|
8
|
+
const HUE_STEP = 135;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Alternating tones. Every tone clears 3:1 against `surface` (98 / 6), and the
|
|
12
|
+
* 15-unit L* step keeps neighbours apart even when colour vision cannot
|
|
13
|
+
* separate their hues.
|
|
14
|
+
*/
|
|
15
|
+
const SERIES_TONES = {
|
|
16
|
+
light: [40, 55],
|
|
17
|
+
dark: [80, 60]
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Categorical series colours for charts, starting at the primary hue
|
|
22
|
+
* (spec US-11). Status colours stay free for status.
|
|
23
|
+
*/
|
|
24
|
+
export function buildCategorical(primary, scheme) {
|
|
25
|
+
const startHue = Hct.fromInt(argbFromColor(primary)).hue;
|
|
26
|
+
const tones = SERIES_TONES[scheme];
|
|
27
|
+
return Array.from({
|
|
28
|
+
length: SERIES_COUNT
|
|
29
|
+
}, (_, index) => hexFromArgb(Hct.from((startHue + index * HUE_STEP) % 360, SERIES_CHROMA, tones[index % 2]).toInt()));
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=categorical.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Hct","argbFromColor","hexFromArgb","SERIES_COUNT","SERIES_CHROMA","HUE_STEP","SERIES_TONES","light","dark","buildCategorical","primary","scheme","startHue","fromInt","hue","tones","Array","from","length","_","index","toInt"],"sourceRoot":"../../../src","sources":["color/categorical.ts"],"mappings":";;AAAA,SAASA,GAAG,QAAQ,wBAAe;AAEnC,SAASC,aAAa,EAAEC,WAAW,QAAQ,YAAS;AAEpD,MAAMC,YAAY,GAAG,CAAC;AACtB,MAAMC,aAAa,GAAG,EAAE;AACxB;AACA,MAAMC,QAAQ,GAAG,GAAG;;AAEpB;AACA;AACA;AACA;AACA;AACA,MAAMC,YAAmD,GAAG;EAC3DC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;EACfC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE;AACd,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAACC,OAAe,EAAEC,MAAmB,EAAY;EAChF,MAAMC,QAAQ,GAAGZ,GAAG,CAACa,OAAO,CAACZ,aAAa,CAACS,OAAO,CAAC,CAAC,CAACI,GAAG;EACxD,MAAMC,KAAK,GAAGT,YAAY,CAACK,MAAM,CAAC;EAElC,OAAOK,KAAK,CAACC,IAAI,CAAC;IAAEC,MAAM,EAAEf;EAAa,CAAC,EAAE,CAACgB,CAAC,EAAEC,KAAK,KACpDlB,WAAW,CACVF,GAAG,CAACiB,IAAI,CAAC,CAACL,QAAQ,GAAGQ,KAAK,GAAGf,QAAQ,IAAI,GAAG,EAAED,aAAa,EAAEW,KAAK,CAACK,KAAK,GAAG,CAAC,CAAC,CAAC,CAACC,KAAK,CAAC,CACtF,CACD,CAAC;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { parseColor } from "./parse.js";
|
|
4
|
+
|
|
5
|
+
/** WCAG 2.x minimum ratio for text (1.4.3). */
|
|
6
|
+
export const TEXT_CONTRAST = 4.5;
|
|
7
|
+
/** WCAG 2.x minimum ratio for non-text boundaries (1.4.11). */
|
|
8
|
+
export const NON_TEXT_CONTRAST = 3;
|
|
9
|
+
const WHITE = {
|
|
10
|
+
r: 255,
|
|
11
|
+
g: 255,
|
|
12
|
+
b: 255,
|
|
13
|
+
a: 1
|
|
14
|
+
};
|
|
15
|
+
const LUMINANCE_OFFSET = 0.05;
|
|
16
|
+
const ACCENT_ROLES = ['primary', 'secondary', 'tertiary', 'error', 'success', 'warning', 'info'];
|
|
17
|
+
const SEMANTIC_ROLES = ['error', 'success', 'warning', 'info'];
|
|
18
|
+
const BASE_BACKGROUNDS = ['color.background', 'color.surface'];
|
|
19
|
+
const SURFACE_TIERS = ['surfaceContainerLowest', 'surfaceContainerLow', 'surfaceContainer', 'surfaceContainerHigh', 'surfaceContainerHighest'];
|
|
20
|
+
function capitalize(value) {
|
|
21
|
+
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
22
|
+
}
|
|
23
|
+
function onBase(foreground, target = TEXT_CONTRAST) {
|
|
24
|
+
return BASE_BACKGROUNDS.map(background => ({
|
|
25
|
+
foreground,
|
|
26
|
+
background,
|
|
27
|
+
target
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Every pair the package guarantees, expressed as theme paths. Paths missing
|
|
33
|
+
* from a theme (e.g. presets an older theme does not have) are skipped.
|
|
34
|
+
*/
|
|
35
|
+
function guaranteedPairs(theme) {
|
|
36
|
+
const pairs = [];
|
|
37
|
+
for (const role of SEMANTIC_ROLES) {
|
|
38
|
+
pairs.push(...onBase(`color.${role}`));
|
|
39
|
+
}
|
|
40
|
+
for (const role of ACCENT_ROLES) {
|
|
41
|
+
const on = `on${capitalize(role)}`;
|
|
42
|
+
pairs.push({
|
|
43
|
+
foreground: `color.${on}`,
|
|
44
|
+
background: `color.${role}`,
|
|
45
|
+
target: TEXT_CONTRAST
|
|
46
|
+
}, {
|
|
47
|
+
foreground: `color.${on}Container`,
|
|
48
|
+
background: `color.${role}Container`,
|
|
49
|
+
target: TEXT_CONTRAST
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
pairs.push({
|
|
53
|
+
foreground: 'color.onBackground',
|
|
54
|
+
background: 'color.background',
|
|
55
|
+
target: TEXT_CONTRAST
|
|
56
|
+
}, {
|
|
57
|
+
foreground: 'color.onSurface',
|
|
58
|
+
background: 'color.surface',
|
|
59
|
+
target: TEXT_CONTRAST
|
|
60
|
+
}, {
|
|
61
|
+
foreground: 'color.onSurfaceVariant',
|
|
62
|
+
background: 'color.surfaceVariant',
|
|
63
|
+
target: TEXT_CONTRAST
|
|
64
|
+
}, ...onBase('color.onSurfaceVariant'), {
|
|
65
|
+
foreground: 'color.inverseOnSurface',
|
|
66
|
+
background: 'color.inverseSurface',
|
|
67
|
+
target: TEXT_CONTRAST
|
|
68
|
+
}, {
|
|
69
|
+
foreground: 'color.inversePrimary',
|
|
70
|
+
background: 'color.inverseSurface',
|
|
71
|
+
target: TEXT_CONTRAST
|
|
72
|
+
}, ...SURFACE_TIERS.map(tier => ({
|
|
73
|
+
foreground: 'color.onSurface',
|
|
74
|
+
background: `color.${tier}`,
|
|
75
|
+
target: TEXT_CONTRAST
|
|
76
|
+
})), ...onBase('color.outline', NON_TEXT_CONTRAST));
|
|
77
|
+
const tones = readPath(theme, 'tone');
|
|
78
|
+
if (isRecord(tones)) {
|
|
79
|
+
for (const name of Object.keys(tones)) {
|
|
80
|
+
const tone = `tone.${name}`;
|
|
81
|
+
pairs.push(...onBase(`${tone}.fg`), {
|
|
82
|
+
foreground: `${tone}.onContainer`,
|
|
83
|
+
background: `${tone}.container`,
|
|
84
|
+
target: TEXT_CONTRAST
|
|
85
|
+
}, {
|
|
86
|
+
foreground: `${tone}.onFill`,
|
|
87
|
+
background: `${tone}.fill`,
|
|
88
|
+
target: TEXT_CONTRAST
|
|
89
|
+
}, {
|
|
90
|
+
foreground: `${tone}.border`,
|
|
91
|
+
background: 'color.background',
|
|
92
|
+
target: NON_TEXT_CONTRAST
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const text = readPath(theme, 'text');
|
|
97
|
+
if (isRecord(text)) {
|
|
98
|
+
for (const name of Object.keys(text)) {
|
|
99
|
+
// `text.disabled` deliberately uses the contrast-exempt disabled colour.
|
|
100
|
+
if (name !== 'disabled') {
|
|
101
|
+
pairs.push(...onBase(`text.${name}.color`));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const categorical = readPath(theme, 'categorical');
|
|
106
|
+
if (Array.isArray(categorical)) {
|
|
107
|
+
categorical.forEach((_, index) => {
|
|
108
|
+
pairs.push({
|
|
109
|
+
foreground: `categorical.${index}`,
|
|
110
|
+
background: 'color.surface',
|
|
111
|
+
target: NON_TEXT_CONTRAST
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
return pairs;
|
|
116
|
+
}
|
|
117
|
+
function isRecord(value) {
|
|
118
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
119
|
+
}
|
|
120
|
+
function readPath(source, path) {
|
|
121
|
+
return path.split('.').reduce((node, key) => {
|
|
122
|
+
if (Array.isArray(node)) {
|
|
123
|
+
return node[Number(key)];
|
|
124
|
+
}
|
|
125
|
+
return isRecord(node) ? node[key] : undefined;
|
|
126
|
+
}, source);
|
|
127
|
+
}
|
|
128
|
+
function channelLuminance(channel) {
|
|
129
|
+
const value = channel / 255;
|
|
130
|
+
return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
|
|
131
|
+
}
|
|
132
|
+
function relativeLuminance({
|
|
133
|
+
r,
|
|
134
|
+
g,
|
|
135
|
+
b
|
|
136
|
+
}) {
|
|
137
|
+
return 0.2126 * channelLuminance(r) + 0.7152 * channelLuminance(g) + 0.0722 * channelLuminance(b);
|
|
138
|
+
}
|
|
139
|
+
function composite(top, bottom) {
|
|
140
|
+
const mix = (upper, lower) => upper * top.a + lower * (1 - top.a);
|
|
141
|
+
return {
|
|
142
|
+
r: mix(top.r, bottom.r),
|
|
143
|
+
g: mix(top.g, bottom.g),
|
|
144
|
+
b: mix(top.b, bottom.b),
|
|
145
|
+
a: 1
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* WCAG contrast ratio of two colour strings. Translucent colours are
|
|
151
|
+
* composited first: the background over `base` (default white), then the
|
|
152
|
+
* foreground over the result.
|
|
153
|
+
*/
|
|
154
|
+
export function contrastRatio(foreground, background, base) {
|
|
155
|
+
const fg = parseColor(foreground);
|
|
156
|
+
const bg = parseColor(background);
|
|
157
|
+
const baseColor = (base != null ? parseColor(base) : null) ?? WHITE;
|
|
158
|
+
if (!fg || !bg) {
|
|
159
|
+
throw new Error(`contrastRatio: unsupported colour "${!fg ? foreground : background}".`);
|
|
160
|
+
}
|
|
161
|
+
const opaqueBackground = composite(bg, composite(baseColor, WHITE));
|
|
162
|
+
const opaqueForeground = composite(fg, opaqueBackground);
|
|
163
|
+
const lighter = Math.max(relativeLuminance(opaqueForeground), relativeLuminance(opaqueBackground));
|
|
164
|
+
const darker = Math.min(relativeLuminance(opaqueForeground), relativeLuminance(opaqueBackground));
|
|
165
|
+
return (lighter + LUMINANCE_OFFSET) / (darker + LUMINANCE_OFFSET);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Checks every contrast pair the package guarantees against the given theme
|
|
170
|
+
* and returns the ones below target. An empty list means the theme passes.
|
|
171
|
+
* `color.disabled` is never audited: inactive components are exempt from
|
|
172
|
+
* WCAG 1.4.3.
|
|
173
|
+
*/
|
|
174
|
+
export function auditTheme(theme) {
|
|
175
|
+
const base = readPath(theme, 'color.background');
|
|
176
|
+
const failures = [];
|
|
177
|
+
for (const pair of guaranteedPairs(theme)) {
|
|
178
|
+
const foreground = readPath(theme, pair.foreground);
|
|
179
|
+
const background = readPath(theme, pair.background);
|
|
180
|
+
if (typeof foreground !== 'string' || typeof background !== 'string') {
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
const ratio = contrastRatio(foreground, background, typeof base === 'string' ? base : undefined);
|
|
184
|
+
if (ratio < pair.target) {
|
|
185
|
+
// Floored so a reported ratio never reads as passing (4.499 → 4.49).
|
|
186
|
+
failures.push({
|
|
187
|
+
...pair,
|
|
188
|
+
ratio: Math.floor(ratio * 100) / 100
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return failures;
|
|
193
|
+
}
|
|
194
|
+
//# sourceMappingURL=contrast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["parseColor","TEXT_CONTRAST","NON_TEXT_CONTRAST","WHITE","r","g","b","a","LUMINANCE_OFFSET","ACCENT_ROLES","SEMANTIC_ROLES","BASE_BACKGROUNDS","SURFACE_TIERS","capitalize","value","charAt","toUpperCase","slice","onBase","foreground","target","map","background","guaranteedPairs","theme","pairs","role","push","on","tier","tones","readPath","isRecord","name","Object","keys","tone","text","categorical","Array","isArray","forEach","_","index","source","path","split","reduce","node","key","Number","undefined","channelLuminance","channel","relativeLuminance","composite","top","bottom","mix","upper","lower","contrastRatio","base","fg","bg","baseColor","Error","opaqueBackground","opaqueForeground","lighter","Math","max","darker","min","auditTheme","failures","pair","ratio","floor"],"sourceRoot":"../../../src","sources":["color/contrast.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAmB,YAAS;;AAE/C;AACA,OAAO,MAAMC,aAAa,GAAG,GAAG;AAChC;AACA,OAAO,MAAMC,iBAAiB,GAAG,CAAC;AAElC,MAAMC,KAAW,GAAG;EAAEC,CAAC,EAAE,GAAG;EA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CAAC;EAChD,MAAMmD,QAA2B,GAAG,EAAE;EAEtC,KAAK,MAAMC,IAAI,IAAIrD,eAAe,CAACC,KAAK,CAAC,EAAE;IAC1C,MAAML,UAAU,GAAGY,QAAQ,CAACP,KAAK,EAAEoD,IAAI,CAACzD,UAAU,CAAC;IACnD,MAAMG,UAAU,GAAGS,QAAQ,CAACP,KAAK,EAAEoD,IAAI,CAACtD,UAAU,CAAC;IAEnD,IAAI,OAAOH,UAAU,KAAK,QAAQ,IAAI,OAAOG,UAAU,KAAK,QAAQ,EAAE;MACrE;IACD;IAEA,MAAMuD,KAAK,GAAGhB,aAAa,CAC1B1C,UAAU,EACVG,UAAU,EACV,OAAOwC,IAAI,KAAK,QAAQ,GAAGA,IAAI,GAAGX,SACnC,CAAC;IAED,IAAI0B,KAAK,GAAGD,IAAI,CAACxD,MAAM,EAAE;MACxB;MACAuD,QAAQ,CAAChD,IAAI,CAAC;QAAE,GAAGiD,IAAI;QAAEC,KAAK,EAAEP,IAAI,CAACQ,KAAK,CAACD,KAAK,GAAG,GAAG,CAAC,GAAG;MAAI,CAAC,CAAC;IACjE;EACD;EAEA,OAAOF,QAAQ;AAChB","ignoreList":[]}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { argbFromRgb } from "../vendor/mcu/index.js";
|
|
4
|
+
|
|
5
|
+
/** A colour channel set: red/green/blue 0–255, alpha 0–1. */
|
|
6
|
+
|
|
7
|
+
const HEX_PATTERN = /^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
|
|
8
|
+
const RGB_PATTERN = /^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d*\.?\d+)\s*)?\)$/i;
|
|
9
|
+
const CHANNEL_MAX = 255;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Parses the colour formats the package accepts: `#RGB`, `#RGBA`, `#RRGGBB`,
|
|
13
|
+
* `#RRGGBBAA`, `rgb(r, g, b)` and `rgba(r, g, b, a)`. Returns `null` for
|
|
14
|
+
* anything else, including named colours and `hsl()`.
|
|
15
|
+
*/
|
|
16
|
+
export function parseColor(value) {
|
|
17
|
+
if (typeof value !== 'string') {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const color = value.trim();
|
|
21
|
+
const hex = HEX_PATTERN.exec(color);
|
|
22
|
+
if (hex) {
|
|
23
|
+
return parseHex(hex[1]);
|
|
24
|
+
}
|
|
25
|
+
const rgb = RGB_PATTERN.exec(color);
|
|
26
|
+
if (!rgb) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
const [r, g, b] = [rgb[1], rgb[2], rgb[3]].map(Number);
|
|
30
|
+
const a = rgb[4] == null ? 1 : Number(rgb[4]);
|
|
31
|
+
if ([r, g, b].some(channel => channel > CHANNEL_MAX) || a > 1) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
r,
|
|
36
|
+
g,
|
|
37
|
+
b,
|
|
38
|
+
a
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function parseHex(digits) {
|
|
42
|
+
const full = digits.length <= 4 ? digits.split('').map(digit => digit + digit).join('') : digits;
|
|
43
|
+
const channel = index => parseInt(full.slice(index * 2, index * 2 + 2), 16);
|
|
44
|
+
return {
|
|
45
|
+
r: channel(0),
|
|
46
|
+
g: channel(1),
|
|
47
|
+
b: channel(2),
|
|
48
|
+
a: full.length === 8 ? channel(3) / CHANNEL_MAX : 1
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export function isValidColor(value) {
|
|
52
|
+
return parseColor(value) !== null;
|
|
53
|
+
}
|
|
54
|
+
export function isOpaqueColor(value) {
|
|
55
|
+
return parseColor(value)?.a === 1;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** ARGB integer of an opaque colour string; throws for anything else. */
|
|
59
|
+
export function argbFromColor(value) {
|
|
60
|
+
const rgba = parseColor(value);
|
|
61
|
+
if (!rgba || rgba.a !== 1) {
|
|
62
|
+
throw new Error(`Expected an opaque colour, received "${value}".`);
|
|
63
|
+
}
|
|
64
|
+
return argbFromRgb(rgba.r, rgba.g, rgba.b);
|
|
65
|
+
}
|
|
66
|
+
function toHexPair(channel) {
|
|
67
|
+
return Math.round(channel).toString(16).padStart(2, '0').toUpperCase();
|
|
68
|
+
}
|
|
69
|
+
export function hexFromArgb(argb) {
|
|
70
|
+
// eslint-disable-next-line no-bitwise -- unpacking the ARGB integer's channels
|
|
71
|
+
const [r, g, b] = [argb >> 16 & 0xff, argb >> 8 & 0xff, argb & 0xff];
|
|
72
|
+
return `#${toHexPair(r)}${toHexPair(g)}${toHexPair(b)}`;
|
|
73
|
+
}
|
|
74
|
+
export function formatColor({
|
|
75
|
+
r,
|
|
76
|
+
g,
|
|
77
|
+
b,
|
|
78
|
+
a
|
|
79
|
+
}) {
|
|
80
|
+
const rgb = `#${toHexPair(r)}${toHexPair(g)}${toHexPair(b)}`;
|
|
81
|
+
return a >= 1 ? rgb : `${rgb}${toHexPair(a * CHANNEL_MAX)}`;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Applies an opacity to a colour, multiplying any alpha it already has.
|
|
86
|
+
* Returns `#RRGGBBAA` (or `#RRGGBB` when the result is opaque).
|
|
87
|
+
*/
|
|
88
|
+
export function withAlpha(color, alpha) {
|
|
89
|
+
const rgba = parseColor(color);
|
|
90
|
+
if (!rgba) {
|
|
91
|
+
throw new Error(`withAlpha: "${color}" is not a supported colour.`);
|
|
92
|
+
}
|
|
93
|
+
if (!Number.isFinite(alpha) || alpha < 0 || alpha > 1) {
|
|
94
|
+
throw new Error(`withAlpha: alpha must be between 0 and 1, received ${alpha}.`);
|
|
95
|
+
}
|
|
96
|
+
return formatColor({
|
|
97
|
+
...rgba,
|
|
98
|
+
a: rgba.a * alpha
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=parse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["argbFromRgb","HEX_PATTERN","RGB_PATTERN","CHANNEL_MAX","parseColor","value","color","trim","hex","exec","parseHex","rgb","r","g","b","map","Number","a","some","channel","digits","full","length","split","digit","join","index","parseInt","slice","isValidColor","isOpaqueColor","argbFromColor","rgba","Error","toHexPair","Math","round","toString","padStart","toUpperCase","hexFromArgb","argb","formatColor","withAlpha","alpha","isFinite"],"sourceRoot":"../../../src","sources":["color/parse.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,wBAAe;;AAE3C;;AAQA,MAAMC,WAAW,GAAG,uDAAuD;AAC3E,MAAMC,WAAW,GAChB,oFAAoF;AACrF,MAAMC,WAAW,GAAG,GAAG;;AAEvB;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAACC,KAAc,EAAe;EACvD,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC9B,OAAO,IAAI;EACZ;EAEA,MAAMC,KAAK,GAAGD,KAAK,CAACE,IAAI,CAAC,CAAC;EAC1B,MAAMC,GAAG,GAAGP,WAAW,CAACQ,IAAI,CAACH,KAAK,CAAC;EAEnC,IAAIE,GAAG,EAAE;IACR,OAAOE,QAAQ,CAACF,GAAG,CAAC,CAAC,CAAC,CAAC;EACxB;EAEA,MAAMG,GAAG,GAAGT,WAAW,CAACO,IAAI,CAACH,KAAK,CAAC;EAEnC,IAAI,CAACK,GAAG,EAAE;IACT,OAAO,IAAI;EACZ;EAEA,MAAM,CAACC,CAAC,EAAEC,CAAC,EAAEC,CAAC,CAAC,GAAG,CAACH,GAAG,CAAC,CAAC,CAAC,EAAEA,GAAG,CAAC,CAAC,CAAC,EAAEA,GAAG,CAAC,CAAC,CAAC,CAAC,CAACI,GAAG,CAACC,MAAM,CAAC;EACtD,MAAMC,CAAC,GAAGN,GAAG,CAAC,CAAC,CAAC,IAAI,IAAI,GA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