File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -96,6 +96,18 @@ class WebpackThemeJsonPlugin {
9696
9797 return result + `$settings-palette: (\n\t${ palette . join ( ',\n\t' ) } \n);\n`
9898 } ,
99+ 'settings-color-gradients' ( key , value ) {
100+ let result = ''
101+ const gradients = [ ]
102+
103+ for ( const gradient of value ) {
104+ const gradientVar = getVariableName ( 'settings-gradient-' + gradient . slug )
105+ result += `${ gradientVar } : ${ gradient . gradient } ;\n`
106+ gradients . push ( `${ gradient . slug } : ${ gradientVar } ` )
107+ }
108+
109+ return result + `$settings-gradients: (\n\t${ gradients . join ( ',\n\t' ) } \n);\n`
110+ } ,
99111 'settings-custom' : 'default' ,
100112 'settings-spacing-spacingSizes' ( key , value ) {
101113 let result = ''
Original file line number Diff line number Diff line change 33/*
44 * Palette : Usefully to get the color or background color of a parent element
55 * Usage Example:
6- * Use these classes to store a color value in a CSS variable.
7- * This allows any child element to reuse the parent's background color.
6+ * Use these classes to store a color / gradient value in a CSS variable.
7+ * This allows any child element to reuse the parent's background color or image .
88 *
99 * HTML:
1010 * <div class="has-primary-background-color">
1717 * .child-element {
1818 * color: var(--background-color);
1919 * }
20+ *
21+ * Gradients expose --gradient on .has-{slug}-gradient-background.
2022 */
2123
2224@each $color-name , $color-value in $settings-palette {
2830 --background-color : #{$color-value } ;
2931 }
3032}
33+
34+ @each $gradient-name , $gradient-value in $settings-gradients {
35+ .has-#{$gradient-name } -gradient-background {
36+ --gradient : #{$gradient-value } ;
37+ }
38+ }
You can’t perform that action at this time.
0 commit comments