-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add 'ts/color/modifiers format option
- Loading branch information
1 parent
9a9feb7
commit 1327559
Showing
8 changed files
with
127 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@tokens-studio/sd-transforms': patch | ||
--- | ||
|
||
Add 'ts/color/modifiers' option: `format`, to globally set the output format for color modifiers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
import { DesignToken } from 'style-dictionary'; | ||
import { modifyColor } from './modifyColor.js'; | ||
import { ColorModifier } from '@tokens-studio/types'; | ||
import { ColorModifierOptions } from '../TransformOptions.js'; | ||
/** | ||
* Helper: Transforms color tokens with tokens studio color modifiers | ||
*/ | ||
export function transformColorModifiers(token: DesignToken): string | undefined { | ||
export function transformColorModifiers( | ||
token: DesignToken, | ||
options?: ColorModifierOptions, | ||
): string | undefined { | ||
const modifier = token.$extensions['studio.tokens']?.modify as ColorModifier; | ||
if (options?.format) { | ||
modifier.format = options.format; | ||
} | ||
return modifyColor(token.value, modifier); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters