@atlaskit/tokens 13.1.0 → 13.2.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 +34 -0
- package/codemods/css-to-design-tokens/lib/colors.tsx +3 -8
- package/codemods/css-to-design-tokens/lib/declaration.tsx +3 -13
- package/codemods/css-to-design-tokens/lib/extract-between-parentheses.tsx +4 -0
- package/codemods/css-to-design-tokens/lib/extract-less-var-name.tsx +3 -0
- package/codemods/css-to-design-tokens/lib/get-css-var-meta.tsx +13 -0
- package/codemods/css-to-design-tokens/lib/get-named-color-meta.tsx +5 -0
- package/codemods/css-to-design-tokens/lib/get-raw-color-meta.tsx +11 -0
- package/codemods/css-to-design-tokens/lib/is-css-declaration.tsx +3 -0
- package/codemods/css-to-design-tokens/lib/is-known-css-variable.tsx +5 -0
- package/codemods/css-to-design-tokens/lib/known-named-colors.tsx +150 -0
- package/codemods/css-to-design-tokens/lib/known-raw-colors.tsx +17 -0
- package/codemods/css-to-design-tokens/lib/known-variables.tsx +167 -0
- package/codemods/css-to-design-tokens/lib/legacy-colors.tsx +3 -336
- package/codemods/css-to-design-tokens/lib/meta.tsx +3 -28
- package/codemods/css-to-design-tokens/lib/split-css-value.tsx +4 -0
- package/codemods/css-to-design-tokens/lib/value.tsx +6 -9
- package/codemods/css-to-design-tokens/transform.tsx +3 -1
- package/dist/cjs/artifacts/generated-pairs.js +2 -2
- package/dist/cjs/artifacts/palettes-raw/palette.js +35 -1
- package/dist/cjs/artifacts/themes/atlassian-dark-increased-contrast.js +2 -2
- package/dist/cjs/artifacts/themes/atlassian-dark.js +2 -2
- package/dist/cjs/artifacts/themes/atlassian-light-increased-contrast.js +2 -2
- package/dist/cjs/artifacts/themes/atlassian-light.js +2 -2
- package/dist/cjs/artifacts/token-default-values.js +21 -1
- package/dist/cjs/artifacts/token-names.js +21 -1
- package/dist/cjs/artifacts/tokens-raw/atlassian-dark-increased-contrast.js +471 -31
- package/dist/cjs/artifacts/tokens-raw/atlassian-dark.js +471 -31
- package/dist/cjs/artifacts/tokens-raw/atlassian-light-increased-contrast.js +471 -31
- package/dist/cjs/artifacts/tokens-raw/atlassian-light.js +471 -31
- package/dist/cjs/entry-points/theme-state-transformer.js +4 -3
- package/dist/cjs/entry-points/token-metadata.codegen.js +196 -16
- package/dist/cjs/get-custom-theme-styles.js +7 -6
- package/dist/cjs/get-global-theme.js +2 -2
- package/dist/cjs/get-theme-html-attrs.js +2 -2
- package/dist/cjs/index.js +4 -3
- package/dist/cjs/is-color-mode.js +9 -0
- package/dist/cjs/is-theme-ids.js +12 -0
- package/dist/cjs/is-theme-kind.js +12 -0
- package/dist/cjs/theme-config.js +8 -44
- package/dist/cjs/theme-object-to-string.js +42 -0
- package/dist/cjs/theme-options-schema.js +1 -0
- package/dist/cjs/theme-state-defaults.js +39 -0
- package/dist/cjs/theme-state.js +5 -0
- package/dist/cjs/theme-string-to-object.js +51 -0
- package/dist/cjs/utils/additional-contrast-checker.js +43 -0
- package/dist/cjs/utils/custom-theme-loading-utils.js +0 -22
- package/dist/cjs/utils/custom-theme-token-contrast-check.js +2 -40
- package/dist/cjs/utils/delta-e.js +26 -0
- package/dist/cjs/utils/generate-colors.js +47 -0
- package/dist/cjs/utils/generate-token-map-with-contrast-check.js +32 -0
- package/dist/cjs/utils/{generate-custom-color-ramp.js → generate-token-map.js} +6 -75
- package/dist/cjs/utils/get-closest-color-index.js +3 -2
- package/dist/cjs/utils/get-contrast-ratio.js +22 -0
- package/dist/cjs/utils/hct-color-utils/alpha-from-argb.js +12 -0
- package/dist/cjs/utils/hct-color-utils/argb-from-linrgb.js +17 -0
- package/dist/cjs/utils/hct-color-utils/argb-from-lstar.js +21 -0
- package/dist/cjs/utils/hct-color-utils/argb-from-rgba.js +24 -0
- package/dist/cjs/utils/hct-color-utils/argb-from-xyz.js +29 -0
- package/dist/cjs/utils/hct-color-utils/blue-from-argb.js +12 -0
- package/dist/cjs/utils/hct-color-utils/clamp-component.js +15 -0
- package/dist/cjs/utils/hct-color-utils/contrast.js +10 -11
- package/dist/cjs/utils/hct-color-utils/green-from-argb.js +12 -0
- package/dist/cjs/utils/hct-color-utils/hct.js +18 -12
- package/dist/cjs/utils/hct-color-utils/index.js +4 -3
- package/dist/cjs/utils/hct-color-utils/lab-f.js +15 -0
- package/dist/cjs/utils/hct-color-utils/lab-invf.js +16 -0
- package/dist/cjs/utils/hct-color-utils/lstar-from-argb.js +34 -0
- package/dist/cjs/utils/hct-color-utils/lstar-from-y.js +21 -0
- package/dist/cjs/utils/hct-color-utils/red-from-argb.js +12 -0
- package/dist/cjs/utils/hct-color-utils/rgba-from-argb.js +28 -0
- package/dist/cjs/utils/hct-color-utils/rgba.js +1 -0
- package/dist/cjs/utils/hct-color-utils/viewing-conditions.js +5 -4
- package/dist/cjs/utils/hct-color-utils/white-point-d65.js +14 -0
- package/dist/cjs/utils/hct-color-utils/y-from-lstar.js +21 -0
- package/dist/cjs/utils/hex-to-hsl.js +52 -0
- package/dist/cjs/utils/hex-to-rgb-a.js +20 -0
- package/dist/cjs/utils/hex-to-rgb.js +19 -0
- package/dist/cjs/utils/is-valid-hex.js +10 -0
- package/dist/cjs/utils/reduce-token-map.js +18 -0
- package/dist/cjs/utils/rgb-to-lab.js +24 -0
- package/dist/es2019/artifacts/generated-pairs.js +2 -2
- package/dist/es2019/artifacts/palettes-raw/palette.js +35 -1
- package/dist/es2019/artifacts/themes/atlassian-dark-increased-contrast.js +21 -1
- package/dist/es2019/artifacts/themes/atlassian-dark.js +21 -1
- package/dist/es2019/artifacts/themes/atlassian-light-increased-contrast.js +21 -1
- package/dist/es2019/artifacts/themes/atlassian-light.js +21 -1
- package/dist/es2019/artifacts/token-default-values.js +21 -1
- package/dist/es2019/artifacts/token-names.js +21 -1
- package/dist/es2019/artifacts/tokens-raw/atlassian-dark-increased-contrast.js +471 -31
- package/dist/es2019/artifacts/tokens-raw/atlassian-dark.js +471 -31
- package/dist/es2019/artifacts/tokens-raw/atlassian-light-increased-contrast.js +471 -31
- package/dist/es2019/artifacts/tokens-raw/atlassian-light.js +471 -31
- package/dist/es2019/entry-points/theme-state-transformer.js +2 -1
- package/dist/es2019/entry-points/token-metadata.codegen.js +196 -16
- package/dist/es2019/get-custom-theme-styles.js +3 -2
- package/dist/es2019/get-global-theme.js +1 -1
- package/dist/es2019/get-theme-html-attrs.js +1 -1
- package/dist/es2019/index.js +2 -1
- package/dist/es2019/is-color-mode.js +3 -0
- package/dist/es2019/is-theme-ids.js +4 -0
- package/dist/es2019/is-theme-kind.js +4 -0
- package/dist/es2019/theme-config.js +4 -45
- package/dist/es2019/theme-object-to-string.js +28 -0
- package/dist/es2019/theme-options-schema.js +0 -0
- package/dist/es2019/theme-state-defaults.js +34 -0
- package/dist/es2019/theme-state.js +1 -0
- package/dist/es2019/theme-string-to-object.js +38 -0
- package/dist/es2019/utils/additional-contrast-checker.js +39 -0
- package/dist/es2019/utils/custom-theme-loading-utils.js +1 -11
- package/dist/es2019/utils/custom-theme-token-contrast-check.js +1 -41
- package/dist/es2019/utils/delta-e.js +20 -0
- package/dist/es2019/utils/generate-colors.js +39 -0
- package/dist/es2019/utils/generate-token-map-with-contrast-check.js +21 -0
- package/dist/es2019/utils/{generate-custom-color-ramp.js → generate-token-map.js} +3 -63
- package/dist/es2019/utils/get-closest-color-index.js +2 -1
- package/dist/es2019/utils/get-contrast-ratio.js +16 -0
- package/dist/es2019/utils/hct-color-utils/alpha-from-argb.js +6 -0
- package/dist/es2019/utils/hct-color-utils/argb-from-linrgb.js +12 -0
- package/dist/es2019/utils/hct-color-utils/argb-from-lstar.js +16 -0
- package/dist/es2019/utils/hct-color-utils/argb-from-rgba.js +19 -0
- package/dist/es2019/utils/hct-color-utils/argb-from-xyz.js +24 -0
- package/dist/es2019/utils/hct-color-utils/blue-from-argb.js +6 -0
- package/dist/es2019/utils/hct-color-utils/clamp-component.js +9 -0
- package/dist/es2019/utils/hct-color-utils/contrast.js +10 -10
- package/dist/es2019/utils/hct-color-utils/green-from-argb.js +6 -0
- package/dist/es2019/utils/hct-color-utils/hct.js +19 -12
- package/dist/es2019/utils/hct-color-utils/index.js +2 -1
- package/dist/es2019/utils/hct-color-utils/lab-f.js +9 -0
- package/dist/es2019/utils/hct-color-utils/lab-invf.js +10 -0
- package/dist/es2019/utils/hct-color-utils/lstar-from-argb.js +28 -0
- package/dist/es2019/utils/hct-color-utils/lstar-from-y.js +16 -0
- package/dist/es2019/utils/hct-color-utils/red-from-argb.js +6 -0
- package/dist/es2019/utils/hct-color-utils/rgba-from-argb.js +22 -0
- package/dist/es2019/utils/hct-color-utils/rgba.js +0 -0
- package/dist/es2019/utils/hct-color-utils/viewing-conditions.js +4 -3
- package/dist/es2019/utils/hct-color-utils/white-point-d65.js +8 -0
- package/dist/es2019/utils/hct-color-utils/y-from-lstar.js +16 -0
- package/dist/es2019/utils/hex-to-hsl.js +46 -0
- package/dist/es2019/utils/hex-to-rgb-a.js +14 -0
- package/dist/es2019/utils/hex-to-rgb.js +13 -0
- package/dist/es2019/utils/is-valid-hex.js +2 -0
- package/dist/es2019/utils/reduce-token-map.js +7 -0
- package/dist/es2019/utils/rgb-to-lab.js +18 -0
- package/dist/esm/artifacts/generated-pairs.js +2 -2
- package/dist/esm/artifacts/palettes-raw/palette.js +35 -1
- package/dist/esm/artifacts/themes/atlassian-dark-increased-contrast.js +2 -2
- package/dist/esm/artifacts/themes/atlassian-dark.js +2 -2
- package/dist/esm/artifacts/themes/atlassian-light-increased-contrast.js +2 -2
- package/dist/esm/artifacts/themes/atlassian-light.js +2 -2
- package/dist/esm/artifacts/token-default-values.js +21 -1
- package/dist/esm/artifacts/token-names.js +21 -1
- package/dist/esm/artifacts/tokens-raw/atlassian-dark-increased-contrast.js +471 -31
- package/dist/esm/artifacts/tokens-raw/atlassian-dark.js +471 -31
- package/dist/esm/artifacts/tokens-raw/atlassian-light-increased-contrast.js +471 -31
- package/dist/esm/artifacts/tokens-raw/atlassian-light.js +471 -31
- package/dist/esm/entry-points/theme-state-transformer.js +2 -1
- package/dist/esm/entry-points/token-metadata.codegen.js +196 -16
- package/dist/esm/get-custom-theme-styles.js +3 -2
- package/dist/esm/get-global-theme.js +1 -1
- package/dist/esm/get-theme-html-attrs.js +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/is-color-mode.js +3 -0
- package/dist/esm/is-theme-ids.js +6 -0
- package/dist/esm/is-theme-kind.js +6 -0
- package/dist/esm/theme-config.js +4 -45
- package/dist/esm/theme-object-to-string.js +35 -0
- package/dist/esm/theme-options-schema.js +0 -0
- package/dist/esm/theme-state-defaults.js +34 -0
- package/dist/esm/theme-state.js +1 -0
- package/dist/esm/theme-string-to-object.js +44 -0
- package/dist/esm/utils/additional-contrast-checker.js +36 -0
- package/dist/esm/utils/custom-theme-loading-utils.js +1 -15
- package/dist/esm/utils/custom-theme-token-contrast-check.js +1 -38
- package/dist/esm/utils/delta-e.js +20 -0
- package/dist/esm/utils/generate-colors.js +40 -0
- package/dist/esm/utils/generate-token-map-with-contrast-check.js +25 -0
- package/dist/esm/utils/{generate-custom-color-ramp.js → generate-token-map.js} +3 -67
- package/dist/esm/utils/get-closest-color-index.js +2 -1
- package/dist/esm/utils/get-contrast-ratio.js +16 -0
- package/dist/esm/utils/hct-color-utils/alpha-from-argb.js +6 -0
- package/dist/esm/utils/hct-color-utils/argb-from-linrgb.js +12 -0
- package/dist/esm/utils/hct-color-utils/argb-from-lstar.js +16 -0
- package/dist/esm/utils/hct-color-utils/argb-from-rgba.js +18 -0
- package/dist/esm/utils/hct-color-utils/argb-from-xyz.js +24 -0
- package/dist/esm/utils/hct-color-utils/blue-from-argb.js +6 -0
- package/dist/esm/utils/hct-color-utils/clamp-component.js +9 -0
- package/dist/esm/utils/hct-color-utils/contrast.js +10 -10
- package/dist/esm/utils/hct-color-utils/green-from-argb.js +6 -0
- package/dist/esm/utils/hct-color-utils/hct.js +19 -12
- package/dist/esm/utils/hct-color-utils/index.js +2 -1
- package/dist/esm/utils/hct-color-utils/lab-f.js +9 -0
- package/dist/esm/utils/hct-color-utils/lab-invf.js +10 -0
- package/dist/esm/utils/hct-color-utils/lstar-from-argb.js +28 -0
- package/dist/esm/utils/hct-color-utils/lstar-from-y.js +16 -0
- package/dist/esm/utils/hct-color-utils/red-from-argb.js +6 -0
- package/dist/esm/utils/hct-color-utils/rgba-from-argb.js +22 -0
- package/dist/esm/utils/hct-color-utils/rgba.js +0 -0
- package/dist/esm/utils/hct-color-utils/viewing-conditions.js +5 -4
- package/dist/esm/utils/hct-color-utils/white-point-d65.js +8 -0
- package/dist/esm/utils/hct-color-utils/y-from-lstar.js +16 -0
- package/dist/esm/utils/hex-to-hsl.js +46 -0
- package/dist/esm/utils/hex-to-rgb-a.js +14 -0
- package/dist/esm/utils/hex-to-rgb.js +13 -0
- package/dist/esm/utils/is-valid-hex.js +4 -0
- package/dist/esm/utils/reduce-token-map.js +11 -0
- package/dist/esm/utils/rgb-to-lab.js +18 -0
- package/dist/types/artifacts/generated-pairs.d.ts +1 -1
- package/dist/types/artifacts/palettes-raw/palette.d.ts +1 -1
- package/dist/types/artifacts/themes/atlassian-dark-increased-contrast.d.ts +2 -2
- package/dist/types/artifacts/themes/atlassian-dark.d.ts +2 -2
- package/dist/types/artifacts/themes/atlassian-light-increased-contrast.d.ts +2 -2
- package/dist/types/artifacts/themes/atlassian-light.d.ts +2 -2
- package/dist/types/artifacts/token-default-values.d.ts +21 -1
- package/dist/types/artifacts/token-names.d.ts +41 -1
- package/dist/types/artifacts/tokens-raw/atlassian-dark-increased-contrast.d.ts +1 -1
- package/dist/types/artifacts/tokens-raw/atlassian-dark.d.ts +1 -1
- package/dist/types/artifacts/tokens-raw/atlassian-light-increased-contrast.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/entry-points/css-type-schema.codegen.d.ts +3 -3
- package/dist/types/entry-points/theme-state-transformer.d.ts +2 -1
- package/dist/types/entry-points/token-metadata.codegen.d.ts +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/is-color-mode.d.ts +2 -0
- package/dist/types/is-theme-ids.d.ts +2 -0
- package/dist/types/is-theme-kind.d.ts +4 -0
- package/dist/types/theme-color-modes.d.ts +1 -0
- package/dist/types/theme-config.d.ts +8 -40
- package/dist/types/theme-ids.d.ts +1 -0
- package/dist/types/theme-object-to-string.d.ts +13 -0
- package/dist/types/theme-options-schema.d.ts +7 -0
- package/dist/types/theme-state-defaults.d.ts +14 -0
- package/dist/types/theme-state.d.ts +17 -0
- package/dist/types/{theme-state-transformer.d.ts → theme-string-to-object.d.ts} +0 -12
- package/dist/types/types.d.ts +75 -15
- package/dist/types/utils/additional-contrast-checker.d.ts +9 -0
- package/dist/types/utils/custom-theme-loading-utils.d.ts +1 -6
- package/dist/types/utils/custom-theme-token-contrast-check.d.ts +0 -9
- package/dist/types/utils/delta-e.d.ts +1 -0
- package/dist/types/utils/generate-colors.d.ts +5 -0
- package/dist/types/utils/{generate-custom-color-ramp.d.ts → generate-token-map-with-contrast-check.d.ts} +1 -6
- package/dist/types/utils/generate-token-map.d.ts +9 -0
- package/dist/types/utils/get-contrast-ratio.d.ts +1 -0
- package/dist/types/utils/hct-color-utils/alpha-from-argb.d.ts +4 -0
- package/dist/types/utils/hct-color-utils/argb-from-linrgb.d.ts +4 -0
- package/dist/types/utils/hct-color-utils/argb-from-lstar.d.ts +8 -0
- package/dist/types/utils/hct-color-utils/argb-from-rgba.d.ts +8 -0
- package/dist/types/utils/hct-color-utils/argb-from-xyz.d.ts +4 -0
- package/dist/types/utils/hct-color-utils/blue-from-argb.d.ts +4 -0
- package/dist/types/utils/hct-color-utils/clamp-component.d.ts +1 -0
- package/dist/types/utils/hct-color-utils/green-from-argb.d.ts +4 -0
- package/dist/types/utils/hct-color-utils/index.d.ts +2 -1
- package/dist/types/utils/hct-color-utils/lab-f.d.ts +1 -0
- package/dist/types/utils/hct-color-utils/lab-invf.d.ts +1 -0
- package/dist/types/utils/hct-color-utils/lstar-from-argb.d.ts +7 -0
- package/dist/types/utils/hct-color-utils/lstar-from-y.d.ts +12 -0
- package/dist/types/utils/hct-color-utils/red-from-argb.d.ts +4 -0
- package/dist/types/utils/hct-color-utils/rgba-from-argb.d.ts +8 -0
- package/dist/types/utils/hct-color-utils/rgba.d.ts +14 -0
- package/dist/types/utils/hct-color-utils/white-point-d65.d.ts +6 -0
- package/dist/types/utils/hct-color-utils/y-from-lstar.d.ts +12 -0
- package/dist/types/utils/hex-to-hsl.d.ts +1 -0
- package/dist/types/utils/hex-to-rgb-a.d.ts +1 -0
- package/dist/types/utils/hex-to-rgb.d.ts +1 -0
- package/dist/types/utils/is-valid-hex.d.ts +1 -0
- package/dist/types/utils/reduce-token-map.d.ts +6 -0
- package/dist/types/utils/rgb-to-lab.d.ts +1 -0
- package/dist/types-ts4.5/artifacts/generated-pairs.d.ts +1 -1
- package/dist/types-ts4.5/artifacts/palettes-raw/palette.d.ts +1 -1
- package/dist/types-ts4.5/artifacts/themes/atlassian-dark-increased-contrast.d.ts +2 -2
- package/dist/types-ts4.5/artifacts/themes/atlassian-dark.d.ts +2 -2
- package/dist/types-ts4.5/artifacts/themes/atlassian-light-increased-contrast.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 +21 -1
- package/dist/types-ts4.5/artifacts/token-names.d.ts +41 -1
- package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-dark-increased-contrast.d.ts +1 -1
- package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-dark.d.ts +1 -1
- package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-light-increased-contrast.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/entry-points/css-type-schema.codegen.d.ts +3 -3
- package/dist/types-ts4.5/entry-points/theme-state-transformer.d.ts +2 -1
- package/dist/types-ts4.5/entry-points/token-metadata.codegen.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +2 -1
- package/dist/types-ts4.5/is-color-mode.d.ts +2 -0
- package/dist/types-ts4.5/is-theme-ids.d.ts +2 -0
- package/dist/types-ts4.5/is-theme-kind.d.ts +11 -0
- package/dist/types-ts4.5/theme-color-modes.d.ts +1 -0
- package/dist/types-ts4.5/theme-config.d.ts +8 -40
- package/dist/types-ts4.5/theme-ids.d.ts +1 -0
- package/dist/types-ts4.5/theme-object-to-string.d.ts +13 -0
- package/dist/types-ts4.5/theme-options-schema.d.ts +7 -0
- package/dist/types-ts4.5/theme-state-defaults.d.ts +14 -0
- package/dist/types-ts4.5/theme-state.d.ts +17 -0
- package/dist/types-ts4.5/{theme-state-transformer.d.ts → theme-string-to-object.d.ts} +0 -12
- package/dist/types-ts4.5/types.d.ts +75 -15
- package/dist/types-ts4.5/utils/additional-contrast-checker.d.ts +9 -0
- package/dist/types-ts4.5/utils/custom-theme-loading-utils.d.ts +1 -6
- package/dist/types-ts4.5/utils/custom-theme-token-contrast-check.d.ts +0 -9
- package/dist/types-ts4.5/utils/delta-e.d.ts +1 -0
- package/dist/types-ts4.5/utils/generate-colors.d.ts +5 -0
- package/dist/types-ts4.5/utils/{generate-custom-color-ramp.d.ts → generate-token-map-with-contrast-check.d.ts} +1 -8
- package/dist/types-ts4.5/utils/generate-token-map.d.ts +11 -0
- package/dist/types-ts4.5/utils/get-contrast-ratio.d.ts +1 -0
- package/dist/types-ts4.5/utils/hct-color-utils/alpha-from-argb.d.ts +4 -0
- package/dist/types-ts4.5/utils/hct-color-utils/argb-from-linrgb.d.ts +4 -0
- package/dist/types-ts4.5/utils/hct-color-utils/argb-from-lstar.d.ts +8 -0
- package/dist/types-ts4.5/utils/hct-color-utils/argb-from-rgba.d.ts +8 -0
- package/dist/types-ts4.5/utils/hct-color-utils/argb-from-xyz.d.ts +4 -0
- package/dist/types-ts4.5/utils/hct-color-utils/blue-from-argb.d.ts +4 -0
- package/dist/types-ts4.5/utils/hct-color-utils/clamp-component.d.ts +1 -0
- package/dist/types-ts4.5/utils/hct-color-utils/green-from-argb.d.ts +4 -0
- package/dist/types-ts4.5/utils/hct-color-utils/index.d.ts +2 -1
- package/dist/types-ts4.5/utils/hct-color-utils/lab-f.d.ts +1 -0
- package/dist/types-ts4.5/utils/hct-color-utils/lab-invf.d.ts +1 -0
- package/dist/types-ts4.5/utils/hct-color-utils/lstar-from-argb.d.ts +7 -0
- package/dist/types-ts4.5/utils/hct-color-utils/lstar-from-y.d.ts +12 -0
- package/dist/types-ts4.5/utils/hct-color-utils/red-from-argb.d.ts +4 -0
- package/dist/types-ts4.5/utils/hct-color-utils/rgba-from-argb.d.ts +8 -0
- package/dist/types-ts4.5/utils/hct-color-utils/rgba.d.ts +14 -0
- package/dist/types-ts4.5/utils/hct-color-utils/white-point-d65.d.ts +6 -0
- package/dist/types-ts4.5/utils/hct-color-utils/y-from-lstar.d.ts +12 -0
- package/dist/types-ts4.5/utils/hex-to-hsl.d.ts +5 -0
- package/dist/types-ts4.5/utils/hex-to-rgb-a.d.ts +6 -0
- package/dist/types-ts4.5/utils/hex-to-rgb.d.ts +5 -0
- package/dist/types-ts4.5/utils/is-valid-hex.d.ts +1 -0
- package/dist/types-ts4.5/utils/reduce-token-map.d.ts +6 -0
- package/dist/types-ts4.5/utils/rgb-to-lab.d.ts +5 -0
- package/figma/atlassian-dark-increased-contrast.json +180 -0
- package/figma/atlassian-dark.json +180 -0
- package/figma/atlassian-light-increased-contrast.json +180 -0
- package/figma/atlassian-light.json +180 -0
- package/package.json +7 -7
- package/dist/cjs/theme-state-transformer.js +0 -93
- package/dist/cjs/utils/color-utils.js +0 -176
- package/dist/cjs/utils/hct-color-utils/color-utils.js +0 -279
- package/dist/es2019/theme-state-transformer.js +0 -70
- package/dist/es2019/utils/color-utils.js +0 -136
- package/dist/es2019/utils/hct-color-utils/color-utils.js +0 -249
- package/dist/esm/theme-state-transformer.js +0 -86
- package/dist/esm/utils/color-utils.js +0 -138
- package/dist/esm/utils/hct-color-utils/color-utils.js +0 -248
- package/dist/types/utils/color-utils.d.ts +0 -10
- package/dist/types/utils/hct-color-utils/color-utils.d.ts +0 -88
- package/dist/types-ts4.5/utils/color-utils.d.ts +0 -23
- package/dist/types-ts4.5/utils/hct-color-utils/color-utils.d.ts +0 -88
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { alphaFromArgb } from './alpha-from-argb';
|
|
2
|
+
import { blueFromArgb } from './blue-from-argb';
|
|
3
|
+
import { greenFromArgb } from './green-from-argb';
|
|
4
|
+
import { redFromArgb } from './red-from-argb';
|
|
5
|
+
/**
|
|
6
|
+
* Return RGBA from a given int32 color
|
|
7
|
+
*
|
|
8
|
+
* @param argb ARGB representation of a int32 color.
|
|
9
|
+
* @return RGBA representation of a int32 color.
|
|
10
|
+
*/
|
|
11
|
+
export function rgbaFromArgb(argb) {
|
|
12
|
+
const r = redFromArgb(argb);
|
|
13
|
+
const g = greenFromArgb(argb);
|
|
14
|
+
const b = blueFromArgb(argb);
|
|
15
|
+
const a = alphaFromArgb(argb);
|
|
16
|
+
return {
|
|
17
|
+
r,
|
|
18
|
+
g,
|
|
19
|
+
b,
|
|
20
|
+
a
|
|
21
|
+
};
|
|
22
|
+
}
|
|
File without changes
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
var _ViewingConditions;
|
|
3
|
-
import * as utils from './color-utils';
|
|
4
3
|
import * as math from './math-utils';
|
|
4
|
+
import { whitePointD65 } from './white-point-d65';
|
|
5
|
+
import { yFromLstar } from './y-from-lstar';
|
|
5
6
|
export class ViewingConditions {
|
|
6
7
|
/**
|
|
7
8
|
* Create ViewingConditions from a simple, physically relevant, set of
|
|
@@ -25,7 +26,7 @@ export class ViewingConditions {
|
|
|
25
26
|
* default = false, the eye does not perform this process on
|
|
26
27
|
* self-luminous objects like displays.
|
|
27
28
|
*/
|
|
28
|
-
static make(whitePoint =
|
|
29
|
+
static make(whitePoint = whitePointD65(), adaptingLuminance = 200.0 / Math.PI * yFromLstar(50.0) / 100.0, backgroundLstar = 50.0, surround = 2.0, discountingIlluminant = false) {
|
|
29
30
|
const xyz = whitePoint;
|
|
30
31
|
const rW = xyz[0] * 0.401288 + xyz[1] * 0.650173 + xyz[2] * -0.051461;
|
|
31
32
|
const gW = xyz[0] * -0.250268 + xyz[1] * 1.204414 + xyz[2] * 0.045854;
|
|
@@ -40,7 +41,7 @@ export class ViewingConditions {
|
|
|
40
41
|
const k4 = k * k * k * k;
|
|
41
42
|
const k4F = 1.0 - k4;
|
|
42
43
|
const fl = k4 * adaptingLuminance + 0.1 * k4F * k4F * Math.cbrt(5.0 * adaptingLuminance);
|
|
43
|
-
const n =
|
|
44
|
+
const n = yFromLstar(backgroundLstar) / whitePoint[1];
|
|
44
45
|
const z = 1.48 + Math.sqrt(n);
|
|
45
46
|
const nbb = 0.725 / Math.pow(n, 0.2);
|
|
46
47
|
const ncb = nbb;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { labInvf } from './lab-invf';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Converts an L* value to a Y value.
|
|
5
|
+
*
|
|
6
|
+
* L* in L*a*b* and Y in XYZ measure the same quantity, luminance.
|
|
7
|
+
*
|
|
8
|
+
* L* measures perceptual luminance, a linear scale. Y in XYZ
|
|
9
|
+
* measures relative luminance, a logarithmic scale.
|
|
10
|
+
*
|
|
11
|
+
* @param lstar L* in L*a*b*
|
|
12
|
+
* @return Y in XYZ
|
|
13
|
+
*/
|
|
14
|
+
export function yFromLstar(lstar) {
|
|
15
|
+
return 100.0 * labInvf((lstar + 16.0) / 116.0);
|
|
16
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { isValidHex } from './is-valid-hex';
|
|
2
|
+
export function hexToHSL(hex) {
|
|
3
|
+
if (!isValidHex(hex)) {
|
|
4
|
+
throw new Error('Invalid HEX');
|
|
5
|
+
}
|
|
6
|
+
let r = 0,
|
|
7
|
+
g = 0,
|
|
8
|
+
b = 0;
|
|
9
|
+
if (hex.length === 4) {
|
|
10
|
+
r = '0x' + hex[1] + hex[1];
|
|
11
|
+
g = '0x' + hex[2] + hex[2];
|
|
12
|
+
b = '0x' + hex[3] + hex[3];
|
|
13
|
+
} else if (hex.length === 7) {
|
|
14
|
+
r = '0x' + hex[1] + hex[2];
|
|
15
|
+
g = '0x' + hex[3] + hex[4];
|
|
16
|
+
b = '0x' + hex[5] + hex[6];
|
|
17
|
+
}
|
|
18
|
+
// Then to HSL
|
|
19
|
+
r /= 255;
|
|
20
|
+
g /= 255;
|
|
21
|
+
b /= 255;
|
|
22
|
+
let cmin = Math.min(r, g, b),
|
|
23
|
+
cmax = Math.max(r, g, b),
|
|
24
|
+
delta = cmax - cmin,
|
|
25
|
+
h = 0,
|
|
26
|
+
s = 0,
|
|
27
|
+
l = 0;
|
|
28
|
+
if (delta === 0) {
|
|
29
|
+
h = 0;
|
|
30
|
+
} else if (cmax === r) {
|
|
31
|
+
h = (g - b) / delta % 6;
|
|
32
|
+
} else if (cmax === g) {
|
|
33
|
+
h = (b - r) / delta + 2;
|
|
34
|
+
} else {
|
|
35
|
+
h = (r - g) / delta + 4;
|
|
36
|
+
}
|
|
37
|
+
h = Math.round(h * 60);
|
|
38
|
+
if (h < 0) {
|
|
39
|
+
h += 360;
|
|
40
|
+
}
|
|
41
|
+
l = (cmax + cmin) / 2;
|
|
42
|
+
s = delta === 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));
|
|
43
|
+
s = +(s * 100).toFixed(1);
|
|
44
|
+
l = +(l * 100).toFixed(1);
|
|
45
|
+
return [h, s, l];
|
|
46
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { getAlpha } from './get-alpha';
|
|
2
|
+
import { isValidHex } from './is-valid-hex';
|
|
3
|
+
export function hexToRgbA(hex) {
|
|
4
|
+
if (!isValidHex(hex)) {
|
|
5
|
+
throw new Error('Invalid HEX');
|
|
6
|
+
}
|
|
7
|
+
let c;
|
|
8
|
+
c = hex.substring(1).split('');
|
|
9
|
+
if (c.length === 3) {
|
|
10
|
+
c = [c[0], c[0], c[1], c[1], c[2], c[2]];
|
|
11
|
+
}
|
|
12
|
+
c = '0x' + c.join('');
|
|
13
|
+
return [c >> 16 & 255, c >> 8 & 255, c & 255, getAlpha(hex)];
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { isValidHex } from './is-valid-hex';
|
|
2
|
+
export function hexToRgb(hex) {
|
|
3
|
+
if (!isValidHex(hex)) {
|
|
4
|
+
throw new Error('Invalid HEX');
|
|
5
|
+
}
|
|
6
|
+
let c;
|
|
7
|
+
c = hex.substring(1).split('');
|
|
8
|
+
if (c.length === 3) {
|
|
9
|
+
c = [c[0], c[0], c[1], c[1], c[2], c[2]];
|
|
10
|
+
}
|
|
11
|
+
c = '0x' + c.join('');
|
|
12
|
+
return [c >> 16 & 255, c >> 8 & 255, c & 255];
|
|
13
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import tokens from '../artifacts/token-names';
|
|
2
|
+
export function reduceTokenMap(tokenMap, themeRamp) {
|
|
3
|
+
return Object.entries(tokenMap).reduce((acc, [key, value]) => {
|
|
4
|
+
const cssVar = tokens[key];
|
|
5
|
+
return cssVar ? `${acc}\n ${cssVar}: ${typeof value === 'string' ? value : themeRamp[value]};` : acc;
|
|
6
|
+
}, '');
|
|
7
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function rgbToLab(rgb) {
|
|
2
|
+
let r = rgb[0] / 255,
|
|
3
|
+
g = rgb[1] / 255,
|
|
4
|
+
b = rgb[2] / 255,
|
|
5
|
+
x,
|
|
6
|
+
y,
|
|
7
|
+
z;
|
|
8
|
+
r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
|
|
9
|
+
g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
|
|
10
|
+
b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
|
|
11
|
+
x = (r * 0.4124 + g * 0.3576 + b * 0.1805) / 0.95047;
|
|
12
|
+
y = (r * 0.2126 + g * 0.7152 + b * 0.0722) / 1.0;
|
|
13
|
+
z = (r * 0.0193 + g * 0.1192 + b * 0.9505) / 1.08883;
|
|
14
|
+
x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
|
|
15
|
+
y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
|
|
16
|
+
z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
|
|
17
|
+
return [116 * y - 16, 500 * (x - y), 200 * (y - z)];
|
|
18
|
+
}
|