@@ -142,8 +142,12 @@ function generateTypographyOutput(prop, propName, isVariable) {
142142
143143// Generates a color based css utility-class from a color Design Token structure
144144function generateColorUtilityClasses ( prop , className ) {
145- return `.${ variablesPrefix } -${ className } {\n color: $${ variablesPrefix } -${ prop . name } ;\n}
146- .${ variablesPrefix } -background-${ className } {\n background-color: $${ variablesPrefix } -${ prop . name } ;\n}` ;
145+ const isBg = className . includes ( 'bg' ) ;
146+ const cssProp = isBg ? 'background-color' : 'color' ;
147+ return `.${ variablesPrefix } -${ className } {
148+ --${ cssProp } : $${ variablesPrefix } -${ prop . name } ;
149+ ${ cssProp } : $${ variablesPrefix } -${ prop . name } ;
150+ }` ;
147151}
148152
149153// Generates margin and padding utility classes to match the token-agnostic
@@ -264,7 +268,10 @@ function generateSpaceUtilityClasses(prop, className) {
264268
265269// Generates a valid box-shadow value from a shadow Design Token structure
266270function generateRadiusUtilityClasses ( propName ) {
267- return `.${ variablesPrefix } -${ propName } {\n border-radius: $${ variablesPrefix } -${ propName } ;\n}` ;
271+ return `.${ variablesPrefix } -${ propName } {
272+ --border-radius: $${ variablesPrefix } -${ propName } ;
273+ border-radius: $${ variablesPrefix } -${ propName } ;
274+ }` ;
268275}
269276
270277// Generates a border based css utility-class from a font Design Token structure
@@ -282,7 +289,10 @@ function generateBorderUtilityClasses(prop, propName) {
282289 default :
283290 attribute = 'border-color' ;
284291 }
285- return `.${ variablesPrefix } -${ propName } {\n ${ attribute } : $${ variablesPrefix } -${ propName } ;\n}` ;
292+ return `.${ variablesPrefix } -${ propName } {
293+ --${ attribute } : $${ variablesPrefix } -${ propName } ;
294+ ${ attribute } : $${ variablesPrefix } -${ propName } ;
295+ }` ;
286296}
287297
288298// Generates a font based css utility-class from a font Design Token structure
@@ -292,7 +302,10 @@ function generateFontUtilityClasses(prop, propName) {
292302
293303// Generates a valid box-shadow value from a shadow Design Token structure
294304function generateShadowUtilityClasses ( propName ) {
295- return `.${ variablesPrefix } -${ propName } {\n box-shadow: $${ variablesPrefix } -${ propName } ;\n}` ;
305+ return `.${ variablesPrefix } -${ propName } {
306+ --box-shadow: $${ variablesPrefix } -${ propName } ;
307+ box-shadow: $${ variablesPrefix } -${ propName } ;
308+ }` ;
296309}
297310
298311// Generates a utility class for a given token category and name
0 commit comments