@atlaskit/tokens 1.12.0 → 1.13.1
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 +22 -0
- package/dist/cjs/artifacts/atlassian-dark-token-value-for-contrast-check.js +3 -2
- package/dist/cjs/artifacts/atlassian-light-token-value-for-contrast-check.js +3 -2
- package/dist/cjs/artifacts/generated-pairs.js +2 -2
- package/dist/cjs/artifacts/themes/atlassian-dark.js +2 -2
- package/dist/cjs/artifacts/themes/atlassian-legacy-dark.js +2 -2
- package/dist/cjs/artifacts/themes/atlassian-legacy-light.js +2 -2
- package/dist/cjs/artifacts/themes/atlassian-light.js +2 -2
- package/dist/cjs/artifacts/token-default-values.js +7 -1
- package/dist/cjs/artifacts/token-names.js +7 -1
- package/dist/cjs/artifacts/tokens-raw/atlassian-dark.js +137 -5
- package/dist/cjs/artifacts/tokens-raw/atlassian-legacy-dark.js +137 -5
- package/dist/cjs/artifacts/tokens-raw/atlassian-legacy-light.js +139 -7
- package/dist/cjs/artifacts/tokens-raw/atlassian-light.js +137 -5
- package/dist/cjs/get-token-value.js +1 -1
- package/dist/cjs/get-token.js +1 -1
- package/dist/cjs/tokens/atlassian-dark/color/background.js +22 -0
- package/dist/cjs/tokens/atlassian-legacy-dark/color/background.js +22 -0
- package/dist/cjs/tokens/atlassian-legacy-light/color/background.js +22 -0
- package/dist/cjs/tokens/atlassian-legacy-light/color/border.js +1 -1
- package/dist/cjs/tokens/atlassian-light/color/background.js +22 -0
- package/dist/cjs/tokens/default/color/background.js +54 -2
- package/dist/cjs/utils/generate-custom-color-ramp.js +16 -7
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/artifacts/atlassian-dark-token-value-for-contrast-check.js +3 -2
- package/dist/es2019/artifacts/atlassian-light-token-value-for-contrast-check.js +3 -2
- package/dist/es2019/artifacts/generated-pairs.js +2 -2
- package/dist/es2019/artifacts/themes/atlassian-dark.js +7 -1
- package/dist/es2019/artifacts/themes/atlassian-legacy-dark.js +7 -1
- package/dist/es2019/artifacts/themes/atlassian-legacy-light.js +8 -2
- package/dist/es2019/artifacts/themes/atlassian-light.js +7 -1
- package/dist/es2019/artifacts/token-default-values.js +7 -1
- package/dist/es2019/artifacts/token-names.js +7 -1
- package/dist/es2019/artifacts/tokens-raw/atlassian-dark.js +137 -5
- package/dist/es2019/artifacts/tokens-raw/atlassian-legacy-dark.js +137 -5
- package/dist/es2019/artifacts/tokens-raw/atlassian-legacy-light.js +139 -7
- package/dist/es2019/artifacts/tokens-raw/atlassian-light.js +137 -5
- package/dist/es2019/get-token-value.js +1 -1
- package/dist/es2019/get-token.js +1 -1
- package/dist/es2019/tokens/atlassian-dark/color/background.js +22 -0
- package/dist/es2019/tokens/atlassian-legacy-dark/color/background.js +22 -0
- package/dist/es2019/tokens/atlassian-legacy-light/color/background.js +22 -0
- package/dist/es2019/tokens/atlassian-legacy-light/color/border.js +1 -1
- package/dist/es2019/tokens/atlassian-light/color/background.js +22 -0
- package/dist/es2019/tokens/default/color/background.js +54 -2
- package/dist/es2019/utils/generate-custom-color-ramp.js +16 -5
- package/dist/es2019/version.json +1 -1
- package/dist/esm/artifacts/atlassian-dark-token-value-for-contrast-check.js +3 -2
- package/dist/esm/artifacts/atlassian-light-token-value-for-contrast-check.js +3 -2
- package/dist/esm/artifacts/generated-pairs.js +2 -2
- package/dist/esm/artifacts/themes/atlassian-dark.js +2 -2
- package/dist/esm/artifacts/themes/atlassian-legacy-dark.js +2 -2
- package/dist/esm/artifacts/themes/atlassian-legacy-light.js +2 -2
- package/dist/esm/artifacts/themes/atlassian-light.js +2 -2
- package/dist/esm/artifacts/token-default-values.js +7 -1
- package/dist/esm/artifacts/token-names.js +7 -1
- package/dist/esm/artifacts/tokens-raw/atlassian-dark.js +137 -5
- package/dist/esm/artifacts/tokens-raw/atlassian-legacy-dark.js +137 -5
- package/dist/esm/artifacts/tokens-raw/atlassian-legacy-light.js +139 -7
- package/dist/esm/artifacts/tokens-raw/atlassian-light.js +137 -5
- package/dist/esm/get-token-value.js +1 -1
- package/dist/esm/get-token.js +1 -1
- package/dist/esm/tokens/atlassian-dark/color/background.js +22 -0
- package/dist/esm/tokens/atlassian-legacy-dark/color/background.js +22 -0
- package/dist/esm/tokens/atlassian-legacy-light/color/background.js +22 -0
- package/dist/esm/tokens/atlassian-legacy-light/color/border.js +1 -1
- package/dist/esm/tokens/atlassian-light/color/background.js +22 -0
- package/dist/esm/tokens/default/color/background.js +54 -2
- package/dist/esm/utils/generate-custom-color-ramp.js +16 -7
- package/dist/esm/version.json +1 -1
- package/dist/types/artifacts/atlassian-dark-token-value-for-contrast-check.d.ts +2 -1
- package/dist/types/artifacts/atlassian-light-token-value-for-contrast-check.d.ts +2 -1
- package/dist/types/artifacts/generated-pairs.d.ts +1 -1
- package/dist/types/artifacts/themes/atlassian-dark.d.ts +2 -2
- package/dist/types/artifacts/themes/atlassian-legacy-dark.d.ts +2 -2
- package/dist/types/artifacts/themes/atlassian-legacy-light.d.ts +2 -2
- package/dist/types/artifacts/themes/atlassian-light.d.ts +2 -2
- package/dist/types/artifacts/token-default-values.d.ts +7 -1
- package/dist/types/artifacts/token-names.d.ts +13 -1
- package/dist/types/artifacts/tokens-raw/atlassian-dark.d.ts +1 -1
- package/dist/types/artifacts/tokens-raw/atlassian-legacy-dark.d.ts +1 -1
- package/dist/types/artifacts/tokens-raw/atlassian-legacy-light.d.ts +1 -1
- package/dist/types/artifacts/tokens-raw/atlassian-light.d.ts +1 -1
- package/dist/types/artifacts/types-internal.d.ts +2 -2
- package/dist/types/artifacts/types.d.ts +2 -2
- package/dist/types/tokens/atlassian-dark/utility/utility.d.ts +1 -1
- package/dist/types/tokens/atlassian-light/utility/utility.d.ts +1 -1
- package/dist/types/tokens/default/utility/utility.d.ts +1 -1
- package/dist/types/types.d.ts +10 -0
- package/dist/types-ts4.5/artifacts/atlassian-dark-token-value-for-contrast-check.d.ts +2 -1
- package/dist/types-ts4.5/artifacts/atlassian-light-token-value-for-contrast-check.d.ts +2 -1
- package/dist/types-ts4.5/artifacts/generated-pairs.d.ts +1 -1
- package/dist/types-ts4.5/artifacts/themes/atlassian-dark.d.ts +2 -2
- package/dist/types-ts4.5/artifacts/themes/atlassian-legacy-dark.d.ts +2 -2
- package/dist/types-ts4.5/artifacts/themes/atlassian-legacy-light.d.ts +2 -2
- package/dist/types-ts4.5/artifacts/themes/atlassian-light.d.ts +2 -2
- package/dist/types-ts4.5/artifacts/token-default-values.d.ts +7 -1
- package/dist/types-ts4.5/artifacts/token-names.d.ts +13 -1
- package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-dark.d.ts +1 -1
- package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-legacy-dark.d.ts +1 -1
- package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-legacy-light.d.ts +1 -1
- package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-light.d.ts +1 -1
- package/dist/types-ts4.5/artifacts/types-internal.d.ts +2 -2
- package/dist/types-ts4.5/artifacts/types.d.ts +2 -2
- package/dist/types-ts4.5/tokens/atlassian-dark/utility/utility.d.ts +1 -1
- package/dist/types-ts4.5/tokens/atlassian-light/utility/utility.d.ts +1 -1
- package/dist/types-ts4.5/tokens/default/utility/utility.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +10 -0
- package/figma/atlassian-dark.json +56 -2
- package/figma/atlassian-legacy-dark.json +56 -2
- package/figma/atlassian-legacy-light.json +57 -3
- package/figma/atlassian-light.json +56 -2
- package/package.json +2 -2
- package/report.api.md +24 -0
- package/dist/cjs/artifacts/tokens-raw/atlassian-dark-iteration.js +0 -902
- package/dist/es2019/artifacts/tokens-raw/atlassian-dark-iteration.js +0 -895
- package/dist/esm/artifacts/tokens-raw/atlassian-dark-iteration.js +0 -895
- package/dist/types/artifacts/tokens-raw/atlassian-dark-iteration.d.ts +0 -91
- package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-dark-iteration.d.ts +0 -91
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import rawTokensDark from '../artifacts/
|
|
1
|
+
import rawTokensDark from '../artifacts/atlassian-dark-token-value-for-contrast-check';
|
|
2
2
|
import { deltaE, getContrastRatio, hexToHSL, hexToRgb, hexToRgbA, HSLToRGB, relativeLuminanceW3C, rgbToHex } from './color-utils';
|
|
3
3
|
import { additionalContrastChecker } from './custom-theme-token-contrast-check';
|
|
4
4
|
import { argbFromRgba, Contrast, Hct, rgbaFromArgb } from './hct-color-utils';
|
|
5
|
-
const lowLuminanceContrastRatios = [1.12, 1.33, 2.03, 2.73, 3.33, 4.27, 5.2, 6.62, 12.46,
|
|
6
|
-
const highLuminanceContrastRatios = [1.08, 1.24, 1.55, 1.99, 2.45, 3.34, 4.64, 6.1, 10.19,
|
|
5
|
+
const lowLuminanceContrastRatios = [1.12, 1.33, 2.03, 2.73, 3.33, 4.27, 5.2, 6.62, 12.46, 14.25];
|
|
6
|
+
const highLuminanceContrastRatios = [1.08, 1.24, 1.55, 1.99, 2.45, 3.34, 4.64, 6.1, 10.19, 12.6];
|
|
7
7
|
export const getClosestColorIndex = (themeRamp, brandColor) => {
|
|
8
8
|
// Iterate over themeRamp and find whichever color is closest to brandColor
|
|
9
9
|
let closestColorIndex = 0;
|
|
@@ -90,9 +90,15 @@ export const generateTokenMap = (brandColor, mode, themeRamp) => {
|
|
|
90
90
|
customThemeTokenMapLight = {
|
|
91
91
|
'color.text.brand': closestColorIndex,
|
|
92
92
|
'color.icon.brand': closestColorIndex,
|
|
93
|
+
'color.background.brand.subtlest': 0,
|
|
94
|
+
'color.background.brand.subtlest.hovered': 1,
|
|
95
|
+
'color.background.brand.subtlest.pressed': 2,
|
|
93
96
|
'color.background.brand.bold': closestColorIndex,
|
|
94
97
|
'color.background.brand.bold.hovered': brandBoldSelectedHoveredIndex,
|
|
95
98
|
'color.background.brand.bold.pressed': brandBoldSelectedPressedIndex,
|
|
99
|
+
'color.background.brand.boldest': 9,
|
|
100
|
+
'color.background.brand.boldest.hovered': 8,
|
|
101
|
+
'color.background.brand.boldest.pressed': 7,
|
|
96
102
|
'color.border.brand': closestColorIndex,
|
|
97
103
|
'color.text.selected': closestColorIndex,
|
|
98
104
|
'color.icon.selected': closestColorIndex,
|
|
@@ -110,9 +116,15 @@ export const generateTokenMap = (brandColor, mode, themeRamp) => {
|
|
|
110
116
|
};
|
|
111
117
|
} else {
|
|
112
118
|
customThemeTokenMapLight = {
|
|
119
|
+
'color.background.brand.subtlest': 0,
|
|
120
|
+
'color.background.brand.subtlest.hovered': 1,
|
|
121
|
+
'color.background.brand.subtlest.pressed': 2,
|
|
113
122
|
'color.background.brand.bold': 6,
|
|
114
123
|
'color.background.brand.bold.hovered': 7,
|
|
115
124
|
'color.background.brand.bold.pressed': 8,
|
|
125
|
+
'color.background.brand.boldest': 9,
|
|
126
|
+
'color.background.brand.boldest.hovered': 8,
|
|
127
|
+
'color.background.brand.boldest.pressed': 7,
|
|
116
128
|
'color.border.brand': 6,
|
|
117
129
|
'color.background.selected.bold': 6,
|
|
118
130
|
'color.background.selected.bold.hovered': 7,
|
|
@@ -149,8 +161,7 @@ export const generateTokenMap = (brandColor, mode, themeRamp) => {
|
|
|
149
161
|
* in dark mode, shift color.background.brand.bold to the brand color
|
|
150
162
|
*/
|
|
151
163
|
if (inputContrast < 4.5) {
|
|
152
|
-
|
|
153
|
-
const inverseTextColor = (_rawTokensDark$find = rawTokensDark.find(token => token.cleanName === 'color.text.inverse')) === null || _rawTokensDark$find === void 0 ? void 0 : _rawTokensDark$find.value;
|
|
164
|
+
const inverseTextColor = rawTokensDark['color.text.inverse'];
|
|
154
165
|
if (getContrastRatio(inverseTextColor, brandColor) >= 4.5 && closestColorIndex >= 2) {
|
|
155
166
|
customThemeTokenMapDark['color.background.brand.bold'] = closestColorIndex;
|
|
156
167
|
customThemeTokenMapDark['color.background.brand.bold.hovered'] = closestColorIndex - 1;
|
package/dist/es2019/version.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Token names mapped to their values, used for contrast checking when generating custom themes
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::2d922d82772ca155fb2fe7b5c63dc69a>>
|
|
7
7
|
* @codegenCommand yarn build tokens
|
|
8
8
|
*/
|
|
9
9
|
var tokenValues = {
|
|
@@ -12,6 +12,7 @@ var tokenValues = {
|
|
|
12
12
|
'color.text.selected': '#579DFF',
|
|
13
13
|
'color.background.selected': '#092957',
|
|
14
14
|
'color.border.brand': '#579DFF',
|
|
15
|
-
'color.chart.brand': '#388BFF'
|
|
15
|
+
'color.chart.brand': '#388BFF',
|
|
16
|
+
'color.text.inverse': '#1D2125'
|
|
16
17
|
};
|
|
17
18
|
export default tokenValues;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Token names mapped to their values, used for contrast checking when generating custom themes
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::068e846d4121ab9afc08e7a1f99dbb5e>>
|
|
7
7
|
* @codegenCommand yarn build tokens
|
|
8
8
|
*/
|
|
9
9
|
var tokenValues = {
|
|
@@ -12,6 +12,7 @@ var tokenValues = {
|
|
|
12
12
|
'color.text.selected': '#0C66E4',
|
|
13
13
|
'color.background.selected': '#E9F2FF',
|
|
14
14
|
'color.border.brand': '#0C66E4',
|
|
15
|
-
'color.chart.brand': '#1D7AFC'
|
|
15
|
+
'color.chart.brand': '#1D7AFC',
|
|
16
|
+
'color.text.inverse': '#FFFFFF'
|
|
16
17
|
};
|
|
17
18
|
export default tokenValues;
|