File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import { getFontFaces } from "./web/fonts.ts";
21
21
import { kebabCase } from "../index.ts" ;
22
22
import {
23
23
getCssPropertyAsString ,
24
+ getTypedCssPropertyAsString ,
24
25
getCssThemeProperties ,
25
26
getFullColorCss ,
26
27
getPaletteOutput ,
@@ -119,9 +120,9 @@ export const downloadTheme = async (
119
120
120
121
zip . file ( `${ webFolder } /${ fileName } -theme.css` , themeProperties ) ;
121
122
122
- const colorsPalette = getCssPropertyAsString (
123
+ const colorsPalette = getTypedCssPropertyAsString (
123
124
getPaletteOutput ( allColors , luminanceSteps ) ,
124
- true ,
125
+ "color" ,
125
126
) ;
126
127
const colorSpeakingNames = getCssPropertyAsString (
127
128
getSpeakingNames ( speakingNames , allColors ) ,
@@ -139,9 +140,9 @@ export const downloadTheme = async (
139
140
if ( theme . customColors ) {
140
141
const customColorsFolder : string = "Custom Colors" ;
141
142
142
- const customColorsPalette = getCssPropertyAsString (
143
+ const customColorsPalette = getTypedCssPropertyAsString (
143
144
getPaletteOutput ( theme . customColors , luminanceSteps ) ,
144
- true ,
145
+ "color" ,
145
146
) ;
146
147
147
148
const customColorsSpeakingNames = getCssPropertyAsString (
Original file line number Diff line number Diff line change @@ -26,6 +26,19 @@ export const getCssPropertyAsString = (
26
26
return resultString ;
27
27
} ;
28
28
29
+ export const getTypedCssPropertyAsString = (
30
+ properties : any ,
31
+ type : string ,
32
+ ) : string => {
33
+ let resultString = "" ;
34
+
35
+ for ( const [ key , value ] of Object . entries ( properties ) ) {
36
+ resultString += `@property ${ key } { syntax: "<${ type } >"; initial-value: ${ value } ; inherits: true; }\n` ;
37
+ }
38
+
39
+ return resultString ;
40
+ } ;
41
+
29
42
const nonRemProperties = [ "opacity" , "elevation" , "transition" , "font" ] ;
30
43
31
44
const isFontFamily = ( path : string [ ] ) : boolean =>
You can’t perform that action at this time.
0 commit comments