Skip to content

Commit

Permalink
change formatting for old tokens to diff output
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasoppermann committed Oct 4, 2022
1 parent 552a9f1 commit 8b9b14e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
4 changes: 3 additions & 1 deletion script/lib/variable-collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ export default class VariableCollection {
const fullName = getFullName(this.prefix, path)

if (value === 'transparent') {
value = 'rgba(0,0,0,0)'
// TODO: revert before merge
// value = 'rgba(0,0,0,0)'
value = '#ffffff00'
}

const variable: ModeVariable = {name: fullName, path, value}
Expand Down
8 changes: 6 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,19 @@ export function get(path: string) {
}

export function alpha(value: Value, amount: number) {
return (obj: any) => color2k.transparentize(resolveValue(value, obj), 1 - amount).replace(/ /g, '')
// TODO: revert before merge
// return (obj: any) => color2k.transparentize(resolveValue(value, obj), 1 - amount).replace(/ /g, '')
return (obj: any) => color2k.toHex(color2k.transparentize(resolveValue(value, obj), 1 - amount).replace(/ /g, ''))
}

export function lighten(value: Value, amount: number) {
return (obj: any) => color2k.lighten(resolveValue(value, obj), amount).replace(/ /g, '')
}

export function darken(value: Value, amount: number) {
return (obj: any) => color2k.darken(resolveValue(value, obj), amount).replace(/ /g, '')
// TODO: revert before merge
// return (obj: any) => color2k.darken(resolveValue(value, obj), amount).replace(/ /g, '')
return (obj: any) => color2k.toHex(color2k.darken(resolveValue(value, obj), amount).replace(/ /g, ''))
}

export function mix(color1: Value, color2: Value, weight: number = 0.5) {
Expand Down
21 changes: 17 additions & 4 deletions tempColorTokenBuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,24 @@ const buildPath = 'tokens-v2-private'
const inputPath = 'tokens'
const prefix = 'primer'

const functionalColorFiles = {
light: [
`tokens/functional/color/primitives-light.json`,
`tokens/functional/color/marketing-light.json`,
`tokens/functional/color/misc-light.json`,
`tokens/functional/color/syntax-light.json`,
`tokens/functional/color/diff-light.json`,
`tokens/functional/color/checks-light.json`,
`tokens/functional/color/components-light.json`,
`tokens/functional/color/ansi-light.json`,
]
}

const themes = [
['light', [`tokens/functional/color/primitives-light.json`], [`tokens/base/color/light.json`]],
['light-tritanopia', [`tokens/functional/color/primitives-light.json`], [`tokens/base/color/light.json`, `tokens/base/color/light-tritanopia.json`]],
['light-colorblind', [`tokens/functional/color/primitives-light.json`], [`tokens/base/color/light.json`, `tokens/base/color/light-colorblind.json`]],
['light-high-contrast', [`tokens/functional/color/primitives-light.json`, `tokens/functional/color/primitives-light-high-contrast.json`], [`tokens/base/color/light.json`, `tokens/base/color/light-high-contrast.json`]],
['light', functionalColorFiles.light, [`tokens/base/color/light.json`]],
['light-tritanopia', [...functionalColorFiles.light], [`tokens/base/color/light.json`, `tokens/base/color/light-tritanopia.json`]],
['light-colorblind', [...functionalColorFiles.light], [`tokens/base/color/light.json`, `tokens/base/color/light-colorblind.json`]],
['light-high-contrast', [...functionalColorFiles.light, `tokens/functional/color/primitives-light-high-contrast.json`], [`tokens/base/color/light.json`, `tokens/base/color/light-high-contrast.json`]],
['dark', [`tokens/functional/color/primitives-dark.json`], [`tokens/base/color/dark.json`]],
['dark-dimmed', [`tokens/functional/color/primitives-dark.json`], [`tokens/base/color/dark.json`, `tokens/base/color/dark-dimmed.json`]],
['dark-tritanopia', [`tokens/functional/color/primitives-dark.json`], [`tokens/base/color/dark.json`, `tokens/base/color/dark-tritanopia.json`]],
Expand Down

0 comments on commit 8b9b14e

Please sign in to comment.