|
2 | 2 | // SPDX-License-Identifier: Apache-2.0 |
3 | 3 | import merge from 'lodash/merge.js'; |
4 | 4 |
|
| 5 | +import { expandColorDictionary } from '../utils/index.js'; |
5 | 6 | import { StyleDictionary } from '../utils/interfaces.js'; |
6 | 7 | import { tokens as parentTokens } from '../visual-refresh/color-palette.js'; |
7 | 8 |
|
| 9 | +/** |
| 10 | + * @deprecated These color palette tokens are deprecated and may be removed in a future version. |
| 11 | + * Use semantic reference tokens instead: |
| 12 | + * - colorGrey* → colorNeutral* |
| 13 | + * - colorBlue* → colorPrimary* or colorInfo* |
| 14 | + * - colorRed* → colorError* |
| 15 | + * - colorGreen* → colorSuccess* |
| 16 | + * - colorYellow* → colorWarning* |
| 17 | + * |
| 18 | + * Reference tokens provide better semantic meaning and consistency across themes. |
| 19 | + */ |
8 | 20 | const tokens: StyleDictionary.ColorPaletteDictionary = { |
9 | 21 | colorBlue50: '#f1faff', |
10 | 22 | colorBlue200: '#99cbe4', |
@@ -38,6 +50,50 @@ const tokens: StyleDictionary.ColorPaletteDictionary = { |
38 | 50 | colorYellow900: '#906806', |
39 | 51 | }; |
40 | 52 |
|
41 | | -const expandedTokens: StyleDictionary.ExpandedGlobalScopeDictionary = merge({}, parentTokens, tokens); |
| 53 | +const referenceTokens: StyleDictionary.ReferenceDictionary = { |
| 54 | + colorPrimary50: tokens.colorBlue50, |
| 55 | + colorPrimary200: tokens.colorBlue200, |
| 56 | + colorPrimary300: tokens.colorBlue300, |
| 57 | + colorPrimary400: tokens.colorBlue400, |
| 58 | + colorPrimary600: tokens.colorBlue600, |
| 59 | + colorPrimary700: tokens.colorBlue700, |
| 60 | + colorPrimary1000: tokens.colorBlue1000, |
| 61 | + colorNeutral100: tokens.colorGrey100, |
| 62 | + colorNeutral200: tokens.colorGrey200, |
| 63 | + colorNeutral250: tokens.colorGrey250, |
| 64 | + colorNeutral300: tokens.colorGrey300, |
| 65 | + colorNeutral400: tokens.colorGrey400, |
| 66 | + colorNeutral450: tokens.colorGrey450, |
| 67 | + colorNeutral500: tokens.colorGrey500, |
| 68 | + colorNeutral600: tokens.colorGrey600, |
| 69 | + colorNeutral650: tokens.colorGrey650, |
| 70 | + colorNeutral700: tokens.colorGrey700, |
| 71 | + colorNeutral750: tokens.colorGrey750, |
| 72 | + colorNeutral800: tokens.colorGrey800, |
| 73 | + colorNeutral850: tokens.colorGrey850, |
| 74 | + colorNeutral950: tokens.colorGrey950, |
| 75 | + colorError50: tokens.colorRed50, |
| 76 | + colorError400: tokens.colorRed400, |
| 77 | + colorError600: tokens.colorRed600, |
| 78 | + colorError1000: tokens.colorRed1000, |
| 79 | + colorInfo50: tokens.colorBlue50, |
| 80 | + colorInfo300: tokens.colorBlue300, |
| 81 | + colorInfo400: tokens.colorBlue400, |
| 82 | + colorInfo600: tokens.colorBlue600, |
| 83 | + colorInfo1000: tokens.colorBlue1000, |
| 84 | + colorSuccess50: tokens.colorGreen50, |
| 85 | + colorSuccess500: tokens.colorGreen500, |
| 86 | + colorSuccess600: tokens.colorGreen600, |
| 87 | + colorSuccess1000: tokens.colorGreen1000, |
| 88 | + colorWarning900: tokens.colorYellow900, |
| 89 | +}; |
| 90 | + |
| 91 | +const expandedTokens: StyleDictionary.ExpandedColorScopeDictionary = merge( |
| 92 | + {}, |
| 93 | + parentTokens, |
| 94 | + tokens, |
| 95 | + expandColorDictionary(referenceTokens) |
| 96 | +); |
42 | 97 |
|
43 | 98 | export { expandedTokens as tokens }; |
| 99 | +export const mode: StyleDictionary.ModeIdentifier = 'color'; |
0 commit comments