This file contains hidden or 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
{ | |
"PFToFontStyle": { | |
"0": { "value": "UICTFontTextStyleCaption1" }, | |
"1": { "value": "UICTFontTextStyleSubhead" }, | |
"2": { "value": "UICTFontTextStyleBody" }, | |
"3": { "value": "UICTFontTextStyleTitle3" }, | |
"4": { "value": "UICTFontTextStyleTitle2" }, | |
"5": { "value": "UICTFontTextStyleTitle1" }, | |
"6": { "value": "UICTFontTextStyleTitle0" } | |
}, |
This file contains hidden or 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
const StyleDictionary = require('style-dictionary'); | |
StyleDictionary.registerFilter({ | |
name: 'test', | |
matcher: (prop) => { | |
return prop.attributes.category === 'color'; | |
} | |
}); | |
StyleDictionary.extend({ |
This file contains hidden or 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
import React, { PureComponent } from 'react' | |
import Section from 'Components/layout/section' | |
import StyleDictionary from 'StyleDictionary/SellerMobileStyleDictionary/styleDictionary.json' | |
import checkContrast from 'Helpers/checkContrast' | |
const backgroundColors = Object.keys(StyleDictionary.color.background) | |
.filter(key => StyleDictionary.color.background[key].value) | |
.map(key => StyleDictionary.color.background[key]); | |
const fontColors = Object.keys(StyleDictionary.color.font) |
This file contains hidden or 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
const StyleDictionary = require('style-dictionary'); | |
// Way 1: | |
// Will run both name transforms, but yours will run last | |
// StyleDictionary.registerTransformGroup({ | |
// name: 'less', | |
// transforms: StyleDictionary.transformGroup.less.concat('name/ti/camel') | |
// }); | |
// Way 2: |
This file contains hidden or 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
StyleDictionary.registerTransform({ | |
type: 'value', | |
matcher: /* */, | |
transformer: function(prop) { | |
return `var(--${prop.name}, ${prop.original.value})` | |
} | |
}); |
This file contains hidden or 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
const camelCase = require('lodash/camelCase'); | |
module.exports = { | |
format: { | |
customES6: function(dictionary, config) { | |
let toRet = ''; | |
console.log(JSON.stringify(dictionary.properties, null, 2)); | |
Object.keys(dictionary.properties).forEach(function(key) { | |
Object.keys(dictionary.properties[key]).forEach(function(key2) { | |
const varName = camelCase([key, key2].join(' ')); |
This file contains hidden or 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
{ | |
"color": { | |
"base": { | |
"green": { | |
"100": { | |
"value": "#e8f5e9", | |
"attributes": { | |
"font": "base" | |
} | |
}, |
This file contains hidden or 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
const StyleDictionary = require('style-dictionary'); | |
// Creating a function that takes a token value | |
// and returns an object of the transformed value for | |
// the platforms defined in the config | |
const sdValue = (value) => { | |
const styleDictionary = StyleDictionary.extend({ | |
// You can directly set the 'properties' aka tokens | |
// of the dictionary by giving it an object | |
properties: { |
This file contains hidden or 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
{ | |
"type": "APL", | |
"version": "1.3", | |
"import": [], | |
"theme": "dark", | |
"styles": { | |
"bigTest": { | |
"values": [ | |
{ | |
"fontSize": "30dp", |
This file contains hidden or 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
{ | |
"type": "APL", | |
"version": "1.3", | |
"import": [], | |
"theme": "dark", | |
"styles": { | |
"bigTest": { | |
"values": [ | |
{ | |
"fontSize": "40dp", |