@atlaskit/editor-palette 0.1.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/.babelrc +3 -0
- package/CHANGELOG.md +1 -0
- package/LICENSE.md +13 -0
- package/README.md +57 -0
- package/dist/cjs/background.js +48 -0
- package/dist/cjs/index.js +33 -0
- package/dist/cjs/text.js +46 -0
- package/dist/cjs/version.json +5 -0
- package/dist/es2019/background.js +124 -0
- package/dist/es2019/index.js +2 -0
- package/dist/es2019/text.js +122 -0
- package/dist/es2019/version.json +5 -0
- package/dist/esm/background.js +36 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/text.js +34 -0
- package/dist/esm/version.json +5 -0
- package/dist/types/background.d.ts +67 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/text.d.ts +65 -0
- package/package.json +59 -0
- package/report.api.md +96 -0
package/.babelrc
ADDED
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @atlaskit/editor-palette
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2022 Atlassian Pty Ltd
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Editor palette
|
|
2
|
+
|
|
3
|
+
When adding support for themed content to tooling which interacts with
|
|
4
|
+
adf content -- the decision was made to treat existing hex codes as a
|
|
5
|
+
unique id, and link them to design tokens which have theme specific
|
|
6
|
+
versions.
|
|
7
|
+
|
|
8
|
+
By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
Detailed docs and example usage can be found [here](https://atlaskit.atlassian.com/packages/editor/editor-palette).
|
|
13
|
+
|
|
14
|
+
### APIs
|
|
15
|
+
|
|
16
|
+
### Installation
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
yarn add @atlaskit/editor-palette
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
#### hexToBackgroundPaletteColor
|
|
23
|
+
|
|
24
|
+
This takes an adf hex color and returns a matching background palette color.
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
28
|
+
|
|
29
|
+
const cssValue = hexToBackgroundPaletteColor('#FFFFFF');
|
|
30
|
+
// ^? const cssValue: 'var(--ds-surface, #FFFFFF)'
|
|
31
|
+
<div style={{backgroundColor: cssValue}} />
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The names of tokens can change over time, and the values of tokens will differ between themes.
|
|
35
|
+
The exact output of this function is an implementation detail and should only be used when rendering
|
|
36
|
+
content to the user, on a client with a matching major version of `@atlaskit/tokens`.
|
|
37
|
+
- **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
|
38
|
+
- **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
#### hexToTextPaletteColor
|
|
42
|
+
|
|
43
|
+
This takes an adf hex color and returns a matching text palette color.
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import { hexToEditorTextPaletteColor } from '@atlaskit/editor-palette';
|
|
47
|
+
|
|
48
|
+
const cssValue = hexToEditorTextPaletteColor('#0747A6');
|
|
49
|
+
// ^? const cssValue: 'var(--ds-text-accent-blue, #0747A6)'
|
|
50
|
+
<span style={{textColor: cssValue}} />
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
The names of tokens can change over time, and the values of tokens will differ between themes.
|
|
54
|
+
The exact output of this function is an implementation detail and should only be used when rendering
|
|
55
|
+
content to the user, on a client with a matching major version of `@atlaskit/tokens`.
|
|
56
|
+
- **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
|
57
|
+
- **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.editorBackgroundPalette = void 0;
|
|
9
|
+
exports.hexToEditorBackgroundPaletteColor = hexToEditorBackgroundPaletteColor;
|
|
10
|
+
|
|
11
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
+
|
|
13
|
+
var _editorBackgroundPale;
|
|
14
|
+
|
|
15
|
+
// This import will be stripped on build
|
|
16
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* This takes an adf hex color and returns a matching background palette
|
|
20
|
+
* color.
|
|
21
|
+
*
|
|
22
|
+
* By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
|
|
23
|
+
*
|
|
24
|
+
* Example usage
|
|
25
|
+
* ```tsx
|
|
26
|
+
* const cssValue = hexToBackgroundPaletteColor('#FFFFFF');
|
|
27
|
+
* // ^? const cssValue: string
|
|
28
|
+
* <div style={{backgroundColor: cssValue}} />
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* The names of tokens can change over time, and the values of tokens will differ between themes.
|
|
32
|
+
* The exact output of this function is an implementation detail and should only be used when rendering
|
|
33
|
+
* content to the user, on a client with a matching major version of `@atlaskit/tokens`.
|
|
34
|
+
* - **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
|
35
|
+
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
|
|
36
|
+
*/
|
|
37
|
+
function hexToEditorBackgroundPaletteColor(hexColor) {
|
|
38
|
+
// Ts ignore used to allow use of conditional return type
|
|
39
|
+
// (preferencing better type on consumption over safety in implementation)
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
return editorBackgroundPalette[hexColor.toUpperCase()];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Colors taken from
|
|
45
|
+
// https://hello.atlassian.net/wiki/spaces/DST/pages/1790979421/DSTRFC-002+-+Shifting+Editor+s+color+palette+to+design+tokens
|
|
46
|
+
// values are asserted to improve generated type declarations
|
|
47
|
+
var editorBackgroundPalette = (_editorBackgroundPale = {}, (0, _defineProperty2.default)(_editorBackgroundPale, '#DEEBFF', "var(--ds-background-accent-blue-subtlest, #DEEBFF)"), (0, _defineProperty2.default)(_editorBackgroundPale, '#B3D4FF', "var(--ds-background-accent-blue-subtler, #B3D4FF)"), (0, _defineProperty2.default)(_editorBackgroundPale, '#4C9AFF', "var(--ds-background-accent-blue-subtle, #4C9AFF)"), (0, _defineProperty2.default)(_editorBackgroundPale, '#E6FCFF', "var(--ds-background-accent-teal-subtlest, #E6FCFF)"), (0, _defineProperty2.default)(_editorBackgroundPale, '#B3F5FF', "var(--ds-background-accent-teal-subtler, #B3F5FF)"), (0, _defineProperty2.default)(_editorBackgroundPale, '#79E2F2', "var(--ds-background-accent-teal-subtle, #79E2F2)"), (0, _defineProperty2.default)(_editorBackgroundPale, '#E3FCEF', "var(--ds-background-accent-green-subtlest, #E3FCEF)"), (0, _defineProperty2.default)(_editorBackgroundPale, '#ABF5D1', "var(--ds-background-accent-green-subtler, #ABF5D1)"), (0, _defineProperty2.default)(_editorBackgroundPale, '#57D9A3', "var(--ds-background-accent-green-subtle, #57D9A3)"), (0, _defineProperty2.default)(_editorBackgroundPale, '#FFFAE6', "var(--ds-background-accent-yellow-subtlest, #FFFAE6)"), (0, _defineProperty2.default)(_editorBackgroundPale, '#FFF0B3', "var(--ds-background-accent-yellow-subtler, #FFF0B3)"), (0, _defineProperty2.default)(_editorBackgroundPale, '#FFC400', "var(--ds-background-accent-orange-subtle, #FFC400)"), (0, _defineProperty2.default)(_editorBackgroundPale, '#FFEBE6', "var(--ds-background-accent-red-subtlest, #FFEBE6)"), (0, _defineProperty2.default)(_editorBackgroundPale, '#FFBDAD', "var(--ds-background-accent-red-subtler, #FFBDAD)"), (0, _defineProperty2.default)(_editorBackgroundPale, '#FF8F73', "var(--ds-background-accent-red-subtle, #FF8F73)"), (0, _defineProperty2.default)(_editorBackgroundPale, '#EAE6FF', "var(--ds-background-accent-purple-subtlest, #EAE6FF)"), (0, _defineProperty2.default)(_editorBackgroundPale, '#C0B6F2', "var(--ds-background-accent-purple-subtler, #C0B6F2)"), (0, _defineProperty2.default)(_editorBackgroundPale, '#998DD9', "var(--ds-background-accent-purple-subtle, #998DD9)"), (0, _defineProperty2.default)(_editorBackgroundPale, '#FFFFFF', "var(--ds-surface, #FFFFFF)"), (0, _defineProperty2.default)(_editorBackgroundPale, '#F4F5F7', "var(--ds-background-accent-gray-subtlest, #F4F5F7)"), (0, _defineProperty2.default)(_editorBackgroundPale, '#B3BAC5', "var(--ds-background-accent-gray-subtle, #B3BAC5)"), _editorBackgroundPale);
|
|
48
|
+
exports.editorBackgroundPalette = editorBackgroundPalette;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "editorBackgroundPalette", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _background.editorBackgroundPalette;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "editorTextPalette", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _text.editorTextPalette;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "hexToEditorBackgroundPaletteColor", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _background.hexToEditorBackgroundPaletteColor;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "hexToEditorTextPaletteColor", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _text.hexToEditorTextPaletteColor;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
var _background = require("./background");
|
|
32
|
+
|
|
33
|
+
var _text = require("./text");
|
package/dist/cjs/text.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.editorTextPalette = void 0;
|
|
9
|
+
exports.hexToEditorTextPaletteColor = hexToEditorTextPaletteColor;
|
|
10
|
+
|
|
11
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
+
|
|
13
|
+
var _editorTextPalette;
|
|
14
|
+
|
|
15
|
+
// This import will be stripped on build
|
|
16
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* This takes an adf hex color and returns a matching text palette color.
|
|
20
|
+
*
|
|
21
|
+
* By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
|
|
22
|
+
*
|
|
23
|
+
* Example usage
|
|
24
|
+
* ```tsx
|
|
25
|
+
* const cssValue = hexToTextPaletteColor('#0747A6');
|
|
26
|
+
* // ^? const cssValue: string
|
|
27
|
+
* <span style={{textColor: cssValue}} />
|
|
28
|
+
* ```
|
|
29
|
+
* The names of tokens can change over time, and the values of tokens will differ between themes.
|
|
30
|
+
* The exact output of this function is an implementation detail and should only be used when rendering
|
|
31
|
+
* content to the user, on a client with a matching major version of `@atlaskit/tokens`.
|
|
32
|
+
* - **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
|
33
|
+
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
|
|
34
|
+
*/
|
|
35
|
+
function hexToEditorTextPaletteColor(hexColor) {
|
|
36
|
+
// Ts ignore used to allow use of conditional return type
|
|
37
|
+
// (preferencing better type on consumption over safety in implementation)
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
return editorTextPalette[hexColor.toUpperCase()];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Colors taken from
|
|
43
|
+
// https://hello.atlassian.net/wiki/spaces/DST/pages/1790979421/DSTRFC-002+-+Shifting+Editor+s+color+palette+to+design+tokens
|
|
44
|
+
// values are asserted to improve generated type declarations
|
|
45
|
+
var editorTextPalette = (_editorTextPalette = {}, (0, _defineProperty2.default)(_editorTextPalette, '#B3D4FF', "var(--ds-background-accent-blue-subtler, #B3D4FF)"), (0, _defineProperty2.default)(_editorTextPalette, '#4C9AFF', "var(--ds-icon-accent-blue, #4C9AFF)"), (0, _defineProperty2.default)(_editorTextPalette, '#0747A6', "var(--ds-text-accent-blue, #0747A6)"), (0, _defineProperty2.default)(_editorTextPalette, '#B3F5FF', "var(--ds-background-accent-teal-subtler, #B3F5FF)"), (0, _defineProperty2.default)(_editorTextPalette, '#00B8D9', "var(--ds-icon-accent-teal, #00B8D9)"), (0, _defineProperty2.default)(_editorTextPalette, '#008DA6', "var(--ds-text-accent-teal, #008DA6)"), (0, _defineProperty2.default)(_editorTextPalette, '#ABF5D1', "var(--ds-background-accent-green-subtler, #ABF5D1)"), (0, _defineProperty2.default)(_editorTextPalette, '#36B37E', "var(--ds-icon-accent-green, #36B37E)"), (0, _defineProperty2.default)(_editorTextPalette, '#006644', "var(--ds-text-accent-green, #006644)"), (0, _defineProperty2.default)(_editorTextPalette, '#FFF0B3', "var(--ds-background-accent-yellow-subtler, #FFF0B3)"), (0, _defineProperty2.default)(_editorTextPalette, '#FFC400', "var(--ds-background-accent-orange-subtle, #FFC400)"), (0, _defineProperty2.default)(_editorTextPalette, '#FF991F', "var(--ds-icon-accent-orange, #FF991F)"), (0, _defineProperty2.default)(_editorTextPalette, '#FFBDAD', "var(--ds-background-accent-red-subtler, #FFBDAD)"), (0, _defineProperty2.default)(_editorTextPalette, '#FF5630', "var(--ds-icon-accent-red, #FF5630)"), (0, _defineProperty2.default)(_editorTextPalette, '#BF2600', "var(--ds-text-accent-red, #BF2600)"), (0, _defineProperty2.default)(_editorTextPalette, '#EAE6FF', "var(--ds-background-accent-purple-subtler, #EAE6FF)"), (0, _defineProperty2.default)(_editorTextPalette, '#6554C0', "var(--ds-icon-accent-purple, #6554C0)"), (0, _defineProperty2.default)(_editorTextPalette, '#403294', "var(--ds-text-accent-purple, #403294)"), (0, _defineProperty2.default)(_editorTextPalette, '#FFFFFF', "var(--ds-text-inverse, #FFFFFF)"), (0, _defineProperty2.default)(_editorTextPalette, '#97A0AF', "var(--ds-icon-accent-gray, #97A0AF)"), (0, _defineProperty2.default)(_editorTextPalette, '#172B4D', "var(--ds-text, #172B4D)"), _editorTextPalette);
|
|
46
|
+
exports.editorTextPalette = editorTextPalette;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// This import will be stripped on build
|
|
2
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This takes an adf hex color and returns a matching background palette
|
|
6
|
+
* color.
|
|
7
|
+
*
|
|
8
|
+
* By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
|
|
9
|
+
*
|
|
10
|
+
* Example usage
|
|
11
|
+
* ```tsx
|
|
12
|
+
* const cssValue = hexToBackgroundPaletteColor('#FFFFFF');
|
|
13
|
+
* // ^? const cssValue: string
|
|
14
|
+
* <div style={{backgroundColor: cssValue}} />
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* The names of tokens can change over time, and the values of tokens will differ between themes.
|
|
18
|
+
* The exact output of this function is an implementation detail and should only be used when rendering
|
|
19
|
+
* content to the user, on a client with a matching major version of `@atlaskit/tokens`.
|
|
20
|
+
* - **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
|
21
|
+
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
|
|
22
|
+
*/
|
|
23
|
+
export function hexToEditorBackgroundPaletteColor(hexColor) {
|
|
24
|
+
// Ts ignore used to allow use of conditional return type
|
|
25
|
+
// (preferencing better type on consumption over safety in implementation)
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
return editorBackgroundPalette[hexColor.toUpperCase()];
|
|
28
|
+
}
|
|
29
|
+
// Colors taken from
|
|
30
|
+
// https://hello.atlassian.net/wiki/spaces/DST/pages/1790979421/DSTRFC-002+-+Shifting+Editor+s+color+palette+to+design+tokens
|
|
31
|
+
// values are asserted to improve generated type declarations
|
|
32
|
+
export const editorBackgroundPalette = {
|
|
33
|
+
// blue
|
|
34
|
+
|
|
35
|
+
/** blue - light */
|
|
36
|
+
['#DEEBFF']: "var(--ds-background-accent-blue-subtlest, #DEEBFF)",
|
|
37
|
+
// source for hex code was legacy token B50
|
|
38
|
+
|
|
39
|
+
/** blue - medium */
|
|
40
|
+
['#B3D4FF']: "var(--ds-background-accent-blue-subtler, #B3D4FF)",
|
|
41
|
+
// source for hex code was legacy token B75
|
|
42
|
+
|
|
43
|
+
/** blue - strong */
|
|
44
|
+
['#4C9AFF']: "var(--ds-background-accent-blue-subtle, #4C9AFF)",
|
|
45
|
+
// source for hex code was legacy token B100
|
|
46
|
+
// teal
|
|
47
|
+
|
|
48
|
+
/** teal - light */
|
|
49
|
+
['#E6FCFF']: "var(--ds-background-accent-teal-subtlest, #E6FCFF)",
|
|
50
|
+
// source for hex code was legacy token T50
|
|
51
|
+
|
|
52
|
+
/** teal - medium */
|
|
53
|
+
['#B3F5FF']: "var(--ds-background-accent-teal-subtler, #B3F5FF)",
|
|
54
|
+
// source for hex code was legacy token T75
|
|
55
|
+
|
|
56
|
+
/** teal - strong */
|
|
57
|
+
['#79E2F2']: "var(--ds-background-accent-teal-subtle, #79E2F2)",
|
|
58
|
+
// source for hex code was legacy token T100
|
|
59
|
+
// green
|
|
60
|
+
|
|
61
|
+
/** green - light */
|
|
62
|
+
['#E3FCEF']: "var(--ds-background-accent-green-subtlest, #E3FCEF)",
|
|
63
|
+
// source for hex code was legacy token G50
|
|
64
|
+
|
|
65
|
+
/** green - medium */
|
|
66
|
+
['#ABF5D1']: "var(--ds-background-accent-green-subtler, #ABF5D1)",
|
|
67
|
+
// source for hex code was legacy token G75
|
|
68
|
+
|
|
69
|
+
/** green - strong */
|
|
70
|
+
['#57D9A3']: "var(--ds-background-accent-green-subtle, #57D9A3)",
|
|
71
|
+
// source for hex code was legacy token G200
|
|
72
|
+
// yellowOrange
|
|
73
|
+
|
|
74
|
+
/** yellowOrange - light */
|
|
75
|
+
['#FFFAE6']: "var(--ds-background-accent-yellow-subtlest, #FFFAE6)",
|
|
76
|
+
// source for hex code was legacy token Y50
|
|
77
|
+
|
|
78
|
+
/** yellowOrange - medium */
|
|
79
|
+
['#FFF0B3']: "var(--ds-background-accent-yellow-subtler, #FFF0B3)",
|
|
80
|
+
// source for hex code was legacy token Y75
|
|
81
|
+
|
|
82
|
+
/** yellowOrange - strong */
|
|
83
|
+
['#FFC400']: "var(--ds-background-accent-orange-subtle, #FFC400)",
|
|
84
|
+
// source for hex code was legacy token Y200
|
|
85
|
+
// red
|
|
86
|
+
|
|
87
|
+
/** red - light */
|
|
88
|
+
['#FFEBE6']: "var(--ds-background-accent-red-subtlest, #FFEBE6)",
|
|
89
|
+
// source for hex code was legacy token R50
|
|
90
|
+
|
|
91
|
+
/** red - medium */
|
|
92
|
+
['#FFBDAD']: "var(--ds-background-accent-red-subtler, #FFBDAD)",
|
|
93
|
+
// source for hex code was legacy token R75
|
|
94
|
+
|
|
95
|
+
/** red - strong */
|
|
96
|
+
['#FF8F73']: "var(--ds-background-accent-red-subtle, #FF8F73)",
|
|
97
|
+
// source for hex code was legacy token R100
|
|
98
|
+
// purple
|
|
99
|
+
|
|
100
|
+
/** purple - light */
|
|
101
|
+
['#EAE6FF']: "var(--ds-background-accent-purple-subtlest, #EAE6FF)",
|
|
102
|
+
// source for hex code was legacy token P50
|
|
103
|
+
|
|
104
|
+
/** purple - medium */
|
|
105
|
+
['#C0B6F2']: "var(--ds-background-accent-purple-subtler, #C0B6F2)",
|
|
106
|
+
// source for hex code was legacy token P75
|
|
107
|
+
|
|
108
|
+
/** purple - strong */
|
|
109
|
+
['#998DD9']: "var(--ds-background-accent-purple-subtle, #998DD9)",
|
|
110
|
+
// source for hex code was legacy token P100
|
|
111
|
+
// whiteGray
|
|
112
|
+
|
|
113
|
+
/** whiteGray - light */
|
|
114
|
+
['#FFFFFF']: "var(--ds-surface, #FFFFFF)",
|
|
115
|
+
// source for hex code was legacy token N0
|
|
116
|
+
|
|
117
|
+
/** whiteGray - medium */
|
|
118
|
+
['#F4F5F7']: "var(--ds-background-accent-gray-subtlest, #F4F5F7)",
|
|
119
|
+
// source for hex code was legacy token N20
|
|
120
|
+
|
|
121
|
+
/** whiteGray - strong */
|
|
122
|
+
['#B3BAC5']: "var(--ds-background-accent-gray-subtle, #B3BAC5)" // source for hex code was legacy token N60
|
|
123
|
+
|
|
124
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// This import will be stripped on build
|
|
2
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This takes an adf hex color and returns a matching text palette color.
|
|
6
|
+
*
|
|
7
|
+
* By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
|
|
8
|
+
*
|
|
9
|
+
* Example usage
|
|
10
|
+
* ```tsx
|
|
11
|
+
* const cssValue = hexToTextPaletteColor('#0747A6');
|
|
12
|
+
* // ^? const cssValue: string
|
|
13
|
+
* <span style={{textColor: cssValue}} />
|
|
14
|
+
* ```
|
|
15
|
+
* The names of tokens can change over time, and the values of tokens will differ between themes.
|
|
16
|
+
* The exact output of this function is an implementation detail and should only be used when rendering
|
|
17
|
+
* content to the user, on a client with a matching major version of `@atlaskit/tokens`.
|
|
18
|
+
* - **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
|
19
|
+
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
|
|
20
|
+
*/
|
|
21
|
+
export function hexToEditorTextPaletteColor(hexColor) {
|
|
22
|
+
// Ts ignore used to allow use of conditional return type
|
|
23
|
+
// (preferencing better type on consumption over safety in implementation)
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
return editorTextPalette[hexColor.toUpperCase()];
|
|
26
|
+
}
|
|
27
|
+
// Colors taken from
|
|
28
|
+
// https://hello.atlassian.net/wiki/spaces/DST/pages/1790979421/DSTRFC-002+-+Shifting+Editor+s+color+palette+to+design+tokens
|
|
29
|
+
// values are asserted to improve generated type declarations
|
|
30
|
+
export const editorTextPalette = {
|
|
31
|
+
// blue
|
|
32
|
+
|
|
33
|
+
/** blue - light */
|
|
34
|
+
['#B3D4FF']: "var(--ds-background-accent-blue-subtler, #B3D4FF)",
|
|
35
|
+
// source for hex code was legacy token B75
|
|
36
|
+
|
|
37
|
+
/** blue - medium */
|
|
38
|
+
['#4C9AFF']: "var(--ds-icon-accent-blue, #4C9AFF)",
|
|
39
|
+
// source for hex code was legacy token B100
|
|
40
|
+
|
|
41
|
+
/** blue - strong */
|
|
42
|
+
['#0747A6']: "var(--ds-text-accent-blue, #0747A6)",
|
|
43
|
+
// source for hex code was legacy token B500
|
|
44
|
+
// teal
|
|
45
|
+
|
|
46
|
+
/** teal - light */
|
|
47
|
+
['#B3F5FF']: "var(--ds-background-accent-teal-subtler, #B3F5FF)",
|
|
48
|
+
// source for hex code was legacy token T75
|
|
49
|
+
|
|
50
|
+
/** teal - medium */
|
|
51
|
+
['#00B8D9']: "var(--ds-icon-accent-teal, #00B8D9)",
|
|
52
|
+
// source for hex code was legacy token T300
|
|
53
|
+
|
|
54
|
+
/** teal - strong */
|
|
55
|
+
['#008DA6']: "var(--ds-text-accent-teal, #008DA6)",
|
|
56
|
+
// source for hex code was legacy token T500
|
|
57
|
+
// green
|
|
58
|
+
|
|
59
|
+
/** green - light */
|
|
60
|
+
['#ABF5D1']: "var(--ds-background-accent-green-subtler, #ABF5D1)",
|
|
61
|
+
// source for hex code was legacy token G75
|
|
62
|
+
|
|
63
|
+
/** green - medium */
|
|
64
|
+
['#36B37E']: "var(--ds-icon-accent-green, #36B37E)",
|
|
65
|
+
// source for hex code was legacy token G300
|
|
66
|
+
|
|
67
|
+
/** green - strong */
|
|
68
|
+
['#006644']: "var(--ds-text-accent-green, #006644)",
|
|
69
|
+
// source for hex code was legacy token G500
|
|
70
|
+
// yellowOrange
|
|
71
|
+
|
|
72
|
+
/** yellowOrange - light */
|
|
73
|
+
['#FFF0B3']: "var(--ds-background-accent-yellow-subtler, #FFF0B3)",
|
|
74
|
+
// source for hex code was legacy token Y75
|
|
75
|
+
|
|
76
|
+
/** yellowOrange - medium */
|
|
77
|
+
['#FFC400']: "var(--ds-background-accent-orange-subtle, #FFC400)",
|
|
78
|
+
// source for hex code was legacy token Y200
|
|
79
|
+
|
|
80
|
+
/** yellowOrange - strong */
|
|
81
|
+
['#FF991F']: "var(--ds-icon-accent-orange, #FF991F)",
|
|
82
|
+
// source for hex code was legacy token Y400
|
|
83
|
+
// red
|
|
84
|
+
|
|
85
|
+
/** red - light */
|
|
86
|
+
['#FFBDAD']: "var(--ds-background-accent-red-subtler, #FFBDAD)",
|
|
87
|
+
// source for hex code was legacy token R75
|
|
88
|
+
|
|
89
|
+
/** red - medium */
|
|
90
|
+
['#FF5630']: "var(--ds-icon-accent-red, #FF5630)",
|
|
91
|
+
// source for hex code was legacy token R300
|
|
92
|
+
|
|
93
|
+
/** red - strong */
|
|
94
|
+
['#BF2600']: "var(--ds-text-accent-red, #BF2600)",
|
|
95
|
+
// source for hex code was legacy token R500
|
|
96
|
+
// purple
|
|
97
|
+
|
|
98
|
+
/** purple - light */
|
|
99
|
+
['#EAE6FF']: "var(--ds-background-accent-purple-subtler, #EAE6FF)",
|
|
100
|
+
// source for hex code was legacy token P50
|
|
101
|
+
|
|
102
|
+
/** purple - medium */
|
|
103
|
+
['#6554C0']: "var(--ds-icon-accent-purple, #6554C0)",
|
|
104
|
+
// source for hex code was legacy token P300
|
|
105
|
+
|
|
106
|
+
/** purple - strong */
|
|
107
|
+
['#403294']: "var(--ds-text-accent-purple, #403294)",
|
|
108
|
+
// source for hex code was legacy token P500
|
|
109
|
+
// whiteGray
|
|
110
|
+
|
|
111
|
+
/** whiteGray - light */
|
|
112
|
+
['#FFFFFF']: "var(--ds-text-inverse, #FFFFFF)",
|
|
113
|
+
// source for hex code was legacy token N0
|
|
114
|
+
|
|
115
|
+
/** whiteGray - medium */
|
|
116
|
+
['#97A0AF']: "var(--ds-icon-accent-gray, #97A0AF)",
|
|
117
|
+
// source for hex code was legacy token N80
|
|
118
|
+
|
|
119
|
+
/** whiteGray - strong */
|
|
120
|
+
['#172B4D']: "var(--ds-text, #172B4D)" // source for hex code was legacy token N800
|
|
121
|
+
|
|
122
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
var _editorBackgroundPale;
|
|
4
|
+
|
|
5
|
+
// This import will be stripped on build
|
|
6
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* This takes an adf hex color and returns a matching background palette
|
|
10
|
+
* color.
|
|
11
|
+
*
|
|
12
|
+
* By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
|
|
13
|
+
*
|
|
14
|
+
* Example usage
|
|
15
|
+
* ```tsx
|
|
16
|
+
* const cssValue = hexToBackgroundPaletteColor('#FFFFFF');
|
|
17
|
+
* // ^? const cssValue: string
|
|
18
|
+
* <div style={{backgroundColor: cssValue}} />
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* The names of tokens can change over time, and the values of tokens will differ between themes.
|
|
22
|
+
* The exact output of this function is an implementation detail and should only be used when rendering
|
|
23
|
+
* content to the user, on a client with a matching major version of `@atlaskit/tokens`.
|
|
24
|
+
* - **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
|
25
|
+
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
|
|
26
|
+
*/
|
|
27
|
+
export function hexToEditorBackgroundPaletteColor(hexColor) {
|
|
28
|
+
// Ts ignore used to allow use of conditional return type
|
|
29
|
+
// (preferencing better type on consumption over safety in implementation)
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
return editorBackgroundPalette[hexColor.toUpperCase()];
|
|
32
|
+
}
|
|
33
|
+
// Colors taken from
|
|
34
|
+
// https://hello.atlassian.net/wiki/spaces/DST/pages/1790979421/DSTRFC-002+-+Shifting+Editor+s+color+palette+to+design+tokens
|
|
35
|
+
// values are asserted to improve generated type declarations
|
|
36
|
+
export var editorBackgroundPalette = (_editorBackgroundPale = {}, _defineProperty(_editorBackgroundPale, '#DEEBFF', "var(--ds-background-accent-blue-subtlest, #DEEBFF)"), _defineProperty(_editorBackgroundPale, '#B3D4FF', "var(--ds-background-accent-blue-subtler, #B3D4FF)"), _defineProperty(_editorBackgroundPale, '#4C9AFF', "var(--ds-background-accent-blue-subtle, #4C9AFF)"), _defineProperty(_editorBackgroundPale, '#E6FCFF', "var(--ds-background-accent-teal-subtlest, #E6FCFF)"), _defineProperty(_editorBackgroundPale, '#B3F5FF', "var(--ds-background-accent-teal-subtler, #B3F5FF)"), _defineProperty(_editorBackgroundPale, '#79E2F2', "var(--ds-background-accent-teal-subtle, #79E2F2)"), _defineProperty(_editorBackgroundPale, '#E3FCEF', "var(--ds-background-accent-green-subtlest, #E3FCEF)"), _defineProperty(_editorBackgroundPale, '#ABF5D1', "var(--ds-background-accent-green-subtler, #ABF5D1)"), _defineProperty(_editorBackgroundPale, '#57D9A3', "var(--ds-background-accent-green-subtle, #57D9A3)"), _defineProperty(_editorBackgroundPale, '#FFFAE6', "var(--ds-background-accent-yellow-subtlest, #FFFAE6)"), _defineProperty(_editorBackgroundPale, '#FFF0B3', "var(--ds-background-accent-yellow-subtler, #FFF0B3)"), _defineProperty(_editorBackgroundPale, '#FFC400', "var(--ds-background-accent-orange-subtle, #FFC400)"), _defineProperty(_editorBackgroundPale, '#FFEBE6', "var(--ds-background-accent-red-subtlest, #FFEBE6)"), _defineProperty(_editorBackgroundPale, '#FFBDAD', "var(--ds-background-accent-red-subtler, #FFBDAD)"), _defineProperty(_editorBackgroundPale, '#FF8F73', "var(--ds-background-accent-red-subtle, #FF8F73)"), _defineProperty(_editorBackgroundPale, '#EAE6FF', "var(--ds-background-accent-purple-subtlest, #EAE6FF)"), _defineProperty(_editorBackgroundPale, '#C0B6F2', "var(--ds-background-accent-purple-subtler, #C0B6F2)"), _defineProperty(_editorBackgroundPale, '#998DD9', "var(--ds-background-accent-purple-subtle, #998DD9)"), _defineProperty(_editorBackgroundPale, '#FFFFFF', "var(--ds-surface, #FFFFFF)"), _defineProperty(_editorBackgroundPale, '#F4F5F7', "var(--ds-background-accent-gray-subtlest, #F4F5F7)"), _defineProperty(_editorBackgroundPale, '#B3BAC5', "var(--ds-background-accent-gray-subtle, #B3BAC5)"), _editorBackgroundPale);
|
package/dist/esm/text.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
var _editorTextPalette;
|
|
4
|
+
|
|
5
|
+
// This import will be stripped on build
|
|
6
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* This takes an adf hex color and returns a matching text palette color.
|
|
10
|
+
*
|
|
11
|
+
* By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
|
|
12
|
+
*
|
|
13
|
+
* Example usage
|
|
14
|
+
* ```tsx
|
|
15
|
+
* const cssValue = hexToTextPaletteColor('#0747A6');
|
|
16
|
+
* // ^? const cssValue: string
|
|
17
|
+
* <span style={{textColor: cssValue}} />
|
|
18
|
+
* ```
|
|
19
|
+
* The names of tokens can change over time, and the values of tokens will differ between themes.
|
|
20
|
+
* The exact output of this function is an implementation detail and should only be used when rendering
|
|
21
|
+
* content to the user, on a client with a matching major version of `@atlaskit/tokens`.
|
|
22
|
+
* - **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
|
23
|
+
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
|
|
24
|
+
*/
|
|
25
|
+
export function hexToEditorTextPaletteColor(hexColor) {
|
|
26
|
+
// Ts ignore used to allow use of conditional return type
|
|
27
|
+
// (preferencing better type on consumption over safety in implementation)
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
return editorTextPalette[hexColor.toUpperCase()];
|
|
30
|
+
}
|
|
31
|
+
// Colors taken from
|
|
32
|
+
// https://hello.atlassian.net/wiki/spaces/DST/pages/1790979421/DSTRFC-002+-+Shifting+Editor+s+color+palette+to+design+tokens
|
|
33
|
+
// values are asserted to improve generated type declarations
|
|
34
|
+
export var editorTextPalette = (_editorTextPalette = {}, _defineProperty(_editorTextPalette, '#B3D4FF', "var(--ds-background-accent-blue-subtler, #B3D4FF)"), _defineProperty(_editorTextPalette, '#4C9AFF', "var(--ds-icon-accent-blue, #4C9AFF)"), _defineProperty(_editorTextPalette, '#0747A6', "var(--ds-text-accent-blue, #0747A6)"), _defineProperty(_editorTextPalette, '#B3F5FF', "var(--ds-background-accent-teal-subtler, #B3F5FF)"), _defineProperty(_editorTextPalette, '#00B8D9', "var(--ds-icon-accent-teal, #00B8D9)"), _defineProperty(_editorTextPalette, '#008DA6', "var(--ds-text-accent-teal, #008DA6)"), _defineProperty(_editorTextPalette, '#ABF5D1', "var(--ds-background-accent-green-subtler, #ABF5D1)"), _defineProperty(_editorTextPalette, '#36B37E', "var(--ds-icon-accent-green, #36B37E)"), _defineProperty(_editorTextPalette, '#006644', "var(--ds-text-accent-green, #006644)"), _defineProperty(_editorTextPalette, '#FFF0B3', "var(--ds-background-accent-yellow-subtler, #FFF0B3)"), _defineProperty(_editorTextPalette, '#FFC400', "var(--ds-background-accent-orange-subtle, #FFC400)"), _defineProperty(_editorTextPalette, '#FF991F', "var(--ds-icon-accent-orange, #FF991F)"), _defineProperty(_editorTextPalette, '#FFBDAD', "var(--ds-background-accent-red-subtler, #FFBDAD)"), _defineProperty(_editorTextPalette, '#FF5630', "var(--ds-icon-accent-red, #FF5630)"), _defineProperty(_editorTextPalette, '#BF2600', "var(--ds-text-accent-red, #BF2600)"), _defineProperty(_editorTextPalette, '#EAE6FF', "var(--ds-background-accent-purple-subtler, #EAE6FF)"), _defineProperty(_editorTextPalette, '#6554C0', "var(--ds-icon-accent-purple, #6554C0)"), _defineProperty(_editorTextPalette, '#403294', "var(--ds-text-accent-purple, #403294)"), _defineProperty(_editorTextPalette, '#FFFFFF', "var(--ds-text-inverse, #FFFFFF)"), _defineProperty(_editorTextPalette, '#97A0AF', "var(--ds-icon-accent-gray, #97A0AF)"), _defineProperty(_editorTextPalette, '#172B4D', "var(--ds-text, #172B4D)"), _editorTextPalette);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This takes an adf hex color and returns a matching background palette
|
|
3
|
+
* color.
|
|
4
|
+
*
|
|
5
|
+
* By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
|
|
6
|
+
*
|
|
7
|
+
* Example usage
|
|
8
|
+
* ```tsx
|
|
9
|
+
* const cssValue = hexToBackgroundPaletteColor('#FFFFFF');
|
|
10
|
+
* // ^? const cssValue: string
|
|
11
|
+
* <div style={{backgroundColor: cssValue}} />
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* The names of tokens can change over time, and the values of tokens will differ between themes.
|
|
15
|
+
* The exact output of this function is an implementation detail and should only be used when rendering
|
|
16
|
+
* content to the user, on a client with a matching major version of `@atlaskit/tokens`.
|
|
17
|
+
* - **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
|
18
|
+
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
|
|
19
|
+
*/
|
|
20
|
+
export declare function hexToEditorBackgroundPaletteColor<HexColor extends string>(hexColor: HexColor): HexColor extends EditorBackgroundPaletteKey ? EditorBackgroundPalette[HexColor] : string | undefined;
|
|
21
|
+
declare type EditorBackgroundPalette = typeof editorBackgroundPalette;
|
|
22
|
+
export declare type EditorBackgroundPaletteKey = keyof EditorBackgroundPalette;
|
|
23
|
+
export declare const editorBackgroundPalette: {
|
|
24
|
+
/** blue - light */
|
|
25
|
+
"#DEEBFF": "var(--ds-background-accent-blue-subtlest, #DEEBFF)";
|
|
26
|
+
/** blue - medium */
|
|
27
|
+
"#B3D4FF": "var(--ds-background-accent-blue-subtler, #B3D4FF)";
|
|
28
|
+
/** blue - strong */
|
|
29
|
+
"#4C9AFF": "var(--ds-background-accent-blue-subtle, #4C9AFF)";
|
|
30
|
+
/** teal - light */
|
|
31
|
+
"#E6FCFF": "var(--ds-background-accent-teal-subtlest, #E6FCFF)";
|
|
32
|
+
/** teal - medium */
|
|
33
|
+
"#B3F5FF": "var(--ds-background-accent-teal-subtler, #B3F5FF)";
|
|
34
|
+
/** teal - strong */
|
|
35
|
+
"#79E2F2": "var(--ds-background-accent-teal-subtle, #79E2F2)";
|
|
36
|
+
/** green - light */
|
|
37
|
+
"#E3FCEF": "var(--ds-background-accent-green-subtlest, #E3FCEF)";
|
|
38
|
+
/** green - medium */
|
|
39
|
+
"#ABF5D1": "var(--ds-background-accent-green-subtler, #ABF5D1)";
|
|
40
|
+
/** green - strong */
|
|
41
|
+
"#57D9A3": "var(--ds-background-accent-green-subtle, #57D9A3)";
|
|
42
|
+
/** yellowOrange - light */
|
|
43
|
+
"#FFFAE6": "var(--ds-background-accent-yellow-subtlest, #FFFAE6)";
|
|
44
|
+
/** yellowOrange - medium */
|
|
45
|
+
"#FFF0B3": "var(--ds-background-accent-yellow-subtler, #FFF0B3)";
|
|
46
|
+
/** yellowOrange - strong */
|
|
47
|
+
"#FFC400": "var(--ds-background-accent-orange-subtle, #FFC400)";
|
|
48
|
+
/** red - light */
|
|
49
|
+
"#FFEBE6": "var(--ds-background-accent-red-subtlest, #FFEBE6)";
|
|
50
|
+
/** red - medium */
|
|
51
|
+
"#FFBDAD": "var(--ds-background-accent-red-subtler, #FFBDAD)";
|
|
52
|
+
/** red - strong */
|
|
53
|
+
"#FF8F73": "var(--ds-background-accent-red-subtle, #FF8F73)";
|
|
54
|
+
/** purple - light */
|
|
55
|
+
"#EAE6FF": "var(--ds-background-accent-purple-subtlest, #EAE6FF)";
|
|
56
|
+
/** purple - medium */
|
|
57
|
+
"#C0B6F2": "var(--ds-background-accent-purple-subtler, #C0B6F2)";
|
|
58
|
+
/** purple - strong */
|
|
59
|
+
"#998DD9": "var(--ds-background-accent-purple-subtle, #998DD9)";
|
|
60
|
+
/** whiteGray - light */
|
|
61
|
+
"#FFFFFF": "var(--ds-surface, #FFFFFF)";
|
|
62
|
+
/** whiteGray - medium */
|
|
63
|
+
"#F4F5F7": "var(--ds-background-accent-gray-subtlest, #F4F5F7)";
|
|
64
|
+
/** whiteGray - strong */
|
|
65
|
+
"#B3BAC5": "var(--ds-background-accent-gray-subtle, #B3BAC5)";
|
|
66
|
+
};
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This takes an adf hex color and returns a matching text palette color.
|
|
3
|
+
*
|
|
4
|
+
* By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
|
|
5
|
+
*
|
|
6
|
+
* Example usage
|
|
7
|
+
* ```tsx
|
|
8
|
+
* const cssValue = hexToTextPaletteColor('#0747A6');
|
|
9
|
+
* // ^? const cssValue: string
|
|
10
|
+
* <span style={{textColor: cssValue}} />
|
|
11
|
+
* ```
|
|
12
|
+
* The names of tokens can change over time, and the values of tokens will differ between themes.
|
|
13
|
+
* The exact output of this function is an implementation detail and should only be used when rendering
|
|
14
|
+
* content to the user, on a client with a matching major version of `@atlaskit/tokens`.
|
|
15
|
+
* - **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
|
16
|
+
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
|
|
17
|
+
*/
|
|
18
|
+
export declare function hexToEditorTextPaletteColor<HexColor extends string>(hexColor: HexColor): HexColor extends EditorTextPaletteKey ? EditorTextPalette[HexColor] : string | undefined;
|
|
19
|
+
declare type EditorTextPalette = typeof editorTextPalette;
|
|
20
|
+
export declare type EditorTextPaletteKey = keyof EditorTextPalette;
|
|
21
|
+
export declare const editorTextPalette: {
|
|
22
|
+
/** blue - light */
|
|
23
|
+
"#B3D4FF": "var(--ds-background-accent-blue-subtler, #B3D4FF)";
|
|
24
|
+
/** blue - medium */
|
|
25
|
+
"#4C9AFF": "var(--ds-icon-accent-blue, #4C9AFF)";
|
|
26
|
+
/** blue - strong */
|
|
27
|
+
"#0747A6": "var(--ds-text-accent-blue, #0747A6)";
|
|
28
|
+
/** teal - light */
|
|
29
|
+
"#B3F5FF": "var(--ds-background-accent-teal-subtler, #B3F5FF)";
|
|
30
|
+
/** teal - medium */
|
|
31
|
+
"#00B8D9": "var(--ds-icon-accent-teal, #00B8D9)";
|
|
32
|
+
/** teal - strong */
|
|
33
|
+
"#008DA6": "var(--ds-text-accent-teal, #008DA6)";
|
|
34
|
+
/** green - light */
|
|
35
|
+
"#ABF5D1": "var(--ds-background-accent-green-subtler, #ABF5D1)";
|
|
36
|
+
/** green - medium */
|
|
37
|
+
"#36B37E": "var(--ds-icon-accent-green, #36B37E)";
|
|
38
|
+
/** green - strong */
|
|
39
|
+
"#006644": "var(--ds-text-accent-green, #006644)";
|
|
40
|
+
/** yellowOrange - light */
|
|
41
|
+
"#FFF0B3": "var(--ds-background-accent-yellow-subtler, #FFF0B3)";
|
|
42
|
+
/** yellowOrange - medium */
|
|
43
|
+
"#FFC400": "var(--ds-background-accent-orange-subtle, #FFC400)";
|
|
44
|
+
/** yellowOrange - strong */
|
|
45
|
+
"#FF991F": "var(--ds-icon-accent-orange, #FF991F)";
|
|
46
|
+
/** red - light */
|
|
47
|
+
"#FFBDAD": "var(--ds-background-accent-red-subtler, #FFBDAD)";
|
|
48
|
+
/** red - medium */
|
|
49
|
+
"#FF5630": "var(--ds-icon-accent-red, #FF5630)";
|
|
50
|
+
/** red - strong */
|
|
51
|
+
"#BF2600": "var(--ds-text-accent-red, #BF2600)";
|
|
52
|
+
/** purple - light */
|
|
53
|
+
"#EAE6FF": "var(--ds-background-accent-purple-subtler, #EAE6FF)";
|
|
54
|
+
/** purple - medium */
|
|
55
|
+
"#6554C0": "var(--ds-icon-accent-purple, #6554C0)";
|
|
56
|
+
/** purple - strong */
|
|
57
|
+
"#403294": "var(--ds-text-accent-purple, #403294)";
|
|
58
|
+
/** whiteGray - light */
|
|
59
|
+
"#FFFFFF": "var(--ds-text-inverse, #FFFFFF)";
|
|
60
|
+
/** whiteGray - medium */
|
|
61
|
+
"#97A0AF": "var(--ds-icon-accent-gray, #97A0AF)";
|
|
62
|
+
/** whiteGray - strong */
|
|
63
|
+
"#172B4D": "var(--ds-text, #172B4D)";
|
|
64
|
+
};
|
|
65
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-palette",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "The editor palette",
|
|
5
|
+
"author": "Atlassian Pty Ltd",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"registry": "https://registry.npmjs.org/"
|
|
9
|
+
},
|
|
10
|
+
"atlassian": {
|
|
11
|
+
"team": "Editor",
|
|
12
|
+
"releaseModel": "scheduled",
|
|
13
|
+
"website": {
|
|
14
|
+
"name": "Editor Palette"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"repository": "https://bitbucket.org/atlassian/atlassian-frontend",
|
|
18
|
+
"main": "dist/cjs/index.js",
|
|
19
|
+
"module": "dist/esm/index.js",
|
|
20
|
+
"module:es2019": "dist/es2019/index.js",
|
|
21
|
+
"types": "dist/types/index.d.ts",
|
|
22
|
+
"sideEffects": false,
|
|
23
|
+
"atlaskit:src": "src/index.ts",
|
|
24
|
+
"af:exports": {
|
|
25
|
+
".": "./src/index.ts"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@babel/runtime": "^7.0.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@atlaskit/docs": "*",
|
|
32
|
+
"@atlaskit/ssr": "*",
|
|
33
|
+
"@atlaskit/tokens": "^0.11.1",
|
|
34
|
+
"@atlaskit/visual-regression": "*",
|
|
35
|
+
"@atlaskit/webdriver-runner": "*",
|
|
36
|
+
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|
|
37
|
+
"@testing-library/react": "^12.1.5",
|
|
38
|
+
"react-dom": "^16.8.0",
|
|
39
|
+
"typescript": "4.5.5",
|
|
40
|
+
"wait-for-expect": "^1.2.0"
|
|
41
|
+
},
|
|
42
|
+
"techstack": {
|
|
43
|
+
"@atlassian/frontend": {
|
|
44
|
+
"import-structure": [
|
|
45
|
+
"atlassian-conventions"
|
|
46
|
+
],
|
|
47
|
+
"circular-dependencies": [
|
|
48
|
+
"file-and-folder-level"
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
"@repo/internal": {
|
|
52
|
+
"deprecation": [
|
|
53
|
+
"no-deprecated-imports"
|
|
54
|
+
],
|
|
55
|
+
"theming": "tokens"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
|
|
59
|
+
}
|
package/report.api.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<!-- API Report Version: 2.2 -->
|
|
2
|
+
|
|
3
|
+
## API Report File for "@atlaskit/editor-palette"
|
|
4
|
+
|
|
5
|
+
> Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
|
|
6
|
+
> [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
7
|
+
|
|
8
|
+
### Table of contents
|
|
9
|
+
|
|
10
|
+
- [Main Entry Types](#main-entry-types)
|
|
11
|
+
|
|
12
|
+
### Main Entry Types
|
|
13
|
+
|
|
14
|
+
<!--SECTION START: Main Entry Types-->
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
// @public (undocumented)
|
|
18
|
+
type EditorBackgroundPalette = typeof editorBackgroundPalette;
|
|
19
|
+
|
|
20
|
+
// @public (undocumented)
|
|
21
|
+
export const editorBackgroundPalette: {
|
|
22
|
+
'#DEEBFF': 'var(--ds-background-accent-blue-subtlest, #DEEBFF)';
|
|
23
|
+
'#B3D4FF': 'var(--ds-background-accent-blue-subtler, #B3D4FF)';
|
|
24
|
+
'#4C9AFF': 'var(--ds-background-accent-blue-subtle, #4C9AFF)';
|
|
25
|
+
'#E6FCFF': 'var(--ds-background-accent-teal-subtlest, #E6FCFF)';
|
|
26
|
+
'#B3F5FF': 'var(--ds-background-accent-teal-subtler, #B3F5FF)';
|
|
27
|
+
'#79E2F2': 'var(--ds-background-accent-teal-subtle, #79E2F2)';
|
|
28
|
+
'#E3FCEF': 'var(--ds-background-accent-green-subtlest, #E3FCEF)';
|
|
29
|
+
'#ABF5D1': 'var(--ds-background-accent-green-subtler, #ABF5D1)';
|
|
30
|
+
'#57D9A3': 'var(--ds-background-accent-green-subtle, #57D9A3)';
|
|
31
|
+
'#FFFAE6': 'var(--ds-background-accent-yellow-subtlest, #FFFAE6)';
|
|
32
|
+
'#FFF0B3': 'var(--ds-background-accent-yellow-subtler, #FFF0B3)';
|
|
33
|
+
'#FFC400': 'var(--ds-background-accent-orange-subtle, #FFC400)';
|
|
34
|
+
'#FFEBE6': 'var(--ds-background-accent-red-subtlest, #FFEBE6)';
|
|
35
|
+
'#FFBDAD': 'var(--ds-background-accent-red-subtler, #FFBDAD)';
|
|
36
|
+
'#FF8F73': 'var(--ds-background-accent-red-subtle, #FF8F73)';
|
|
37
|
+
'#EAE6FF': 'var(--ds-background-accent-purple-subtlest, #EAE6FF)';
|
|
38
|
+
'#C0B6F2': 'var(--ds-background-accent-purple-subtler, #C0B6F2)';
|
|
39
|
+
'#998DD9': 'var(--ds-background-accent-purple-subtle, #998DD9)';
|
|
40
|
+
'#FFFFFF': 'var(--ds-surface, #FFFFFF)';
|
|
41
|
+
'#F4F5F7': 'var(--ds-background-accent-gray-subtlest, #F4F5F7)';
|
|
42
|
+
'#B3BAC5': 'var(--ds-background-accent-gray-subtle, #B3BAC5)';
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// @public (undocumented)
|
|
46
|
+
type EditorBackgroundPaletteKey = keyof EditorBackgroundPalette;
|
|
47
|
+
|
|
48
|
+
// @public (undocumented)
|
|
49
|
+
type EditorTextPalette = typeof editorTextPalette;
|
|
50
|
+
|
|
51
|
+
// @public (undocumented)
|
|
52
|
+
export const editorTextPalette: {
|
|
53
|
+
'#B3D4FF': 'var(--ds-background-accent-blue-subtler, #B3D4FF)';
|
|
54
|
+
'#4C9AFF': 'var(--ds-icon-accent-blue, #4C9AFF)';
|
|
55
|
+
'#0747A6': 'var(--ds-text-accent-blue, #0747A6)';
|
|
56
|
+
'#B3F5FF': 'var(--ds-background-accent-teal-subtler, #B3F5FF)';
|
|
57
|
+
'#00B8D9': 'var(--ds-icon-accent-teal, #00B8D9)';
|
|
58
|
+
'#008DA6': 'var(--ds-text-accent-teal, #008DA6)';
|
|
59
|
+
'#ABF5D1': 'var(--ds-background-accent-green-subtler, #ABF5D1)';
|
|
60
|
+
'#36B37E': 'var(--ds-icon-accent-green, #36B37E)';
|
|
61
|
+
'#006644': 'var(--ds-text-accent-green, #006644)';
|
|
62
|
+
'#FFF0B3': 'var(--ds-background-accent-yellow-subtler, #FFF0B3)';
|
|
63
|
+
'#FFC400': 'var(--ds-background-accent-orange-subtle, #FFC400)';
|
|
64
|
+
'#FF991F': 'var(--ds-icon-accent-orange, #FF991F)';
|
|
65
|
+
'#FFBDAD': 'var(--ds-background-accent-red-subtler, #FFBDAD)';
|
|
66
|
+
'#FF5630': 'var(--ds-icon-accent-red, #FF5630)';
|
|
67
|
+
'#BF2600': 'var(--ds-text-accent-red, #BF2600)';
|
|
68
|
+
'#EAE6FF': 'var(--ds-background-accent-purple-subtler, #EAE6FF)';
|
|
69
|
+
'#6554C0': 'var(--ds-icon-accent-purple, #6554C0)';
|
|
70
|
+
'#403294': 'var(--ds-text-accent-purple, #403294)';
|
|
71
|
+
'#FFFFFF': 'var(--ds-text-inverse, #FFFFFF)';
|
|
72
|
+
'#97A0AF': 'var(--ds-icon-accent-gray, #97A0AF)';
|
|
73
|
+
'#172B4D': 'var(--ds-text, #172B4D)';
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// @public (undocumented)
|
|
77
|
+
type EditorTextPaletteKey = keyof EditorTextPalette;
|
|
78
|
+
|
|
79
|
+
// @public
|
|
80
|
+
export function hexToEditorBackgroundPaletteColor<HexColor extends string>(
|
|
81
|
+
hexColor: HexColor,
|
|
82
|
+
): HexColor extends EditorBackgroundPaletteKey
|
|
83
|
+
? EditorBackgroundPalette[HexColor]
|
|
84
|
+
: string | undefined;
|
|
85
|
+
|
|
86
|
+
// @public
|
|
87
|
+
export function hexToEditorTextPaletteColor<HexColor extends string>(
|
|
88
|
+
hexColor: HexColor,
|
|
89
|
+
): HexColor extends EditorTextPaletteKey
|
|
90
|
+
? EditorTextPalette[HexColor]
|
|
91
|
+
: string | undefined;
|
|
92
|
+
|
|
93
|
+
// (No @packageDocumentation comment for this package)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
<!--SECTION END: Main Entry Types-->
|