@@ -180,7 +180,9 @@ function add_block_style_inheritance( $current_css ) {
180180 // 'columns-gap' => $this->get_value( $styles, ['blocks', 'core/columns', 'spacing', 'blockGap'] ),
181181 'button-group-gap ' => $ this ->get_value ( $ styles , ['blocks ' , 'core/buttons ' , 'spacing ' , 'blockGap ' ] ),
182182 'default-gap ' => $ this ->get_value ( $ styles , ['spacing ' , 'blockGap ' ] ),
183- 'container-color ' => $ this ->get_value ( $ styles , ['color ' , 'text ' ] ),
183+ 'text-color ' => $ this ->get_value ( $ styles , ['color ' , 'text ' ] ),
184+ 'heading-color ' => $ this ->get_value ( $ styles , [ 'elements ' , 'heading ' , 'color ' , 'text ' ] ),
185+ 'link-color ' => $ this ->get_value ( $ styles , [ 'elements ' , 'link ' , 'color ' , 'text ' ] )
184186 );
185187
186188 if ( $ root_properties [ 'button-group-gap ' ] || $ root_properties [ 'default-gap ' ] ) {
@@ -193,8 +195,22 @@ function add_block_style_inheritance( $current_css ) {
193195 // $style_declarations['root']['declarations'][ '--stk-columns-column-gap' ] = $root_properties[ 'columns-gap' ] ?? $root_properties[ 'default-gap' ];
194196 // }
195197
196- if ( $ root_properties [ 'container-color ' ] ) {
197- $ style_declarations ['root ' ]['declarations ' ][ '--stk-container-color ' ] = $ root_properties [ 'container-color ' ];
198+ if ( $ root_properties [ 'text-color ' ] ) {
199+ $ style_declarations ['root ' ]['declarations ' ][ '--stk-container-color ' ] = $ root_properties [ 'text-color ' ];
200+ $ style_declarations ['root ' ]['declarations ' ][ '--stk-text-color ' ] = $ root_properties [ 'text-color ' ];
201+ $ style_declarations ['root ' ]['declarations ' ][ '--stk-default-text-color ' ] = $ root_properties [ 'text-color ' ];
202+ }
203+
204+ if ( $ root_properties [ 'heading-color ' ] ) {
205+ $ style_declarations ['root ' ]['declarations ' ][ '--stk-default-heading-color ' ] = $ root_properties [ 'heading-color ' ];
206+ } else if ( $ root_properties [ 'text-color ' ] ) {
207+ $ style_declarations ['root ' ]['declarations ' ][ '--stk-default-heading-color ' ] = $ root_properties [ 'text-color ' ];
208+ }
209+
210+ if ( $ root_properties [ 'link-color ' ] ) {
211+ $ style_declarations ['root ' ]['declarations ' ][ '--stk-default-link-color ' ] = $ root_properties [ 'link-color ' ];
212+ } else if ( $ root_properties [ 'text-color ' ] ) {
213+ $ style_declarations ['root ' ]['declarations ' ][ '--stk-default-link-color ' ] = $ root_properties [ 'text-color ' ];
198214 }
199215
200216 /**
@@ -238,8 +254,8 @@ function add_block_style_inheritance( $current_css ) {
238254 ),
239255 'get_properties ' => array ( 'color ' , 'background ' , 'background-color ' ),
240256 'set_custom_properties ' => array (
241- 'color ' => '--stk-button-text-color ' ,
242- 'background ' => '--stk-button-background-color ' ,
257+ 'color ' => array ( '--stk-button-text-color ' , ' --stk-default-button-text-color ' ) ,
258+ 'background ' => array ( '--stk-button-background-color ' , ' --stk-default-button-background-color ' ) ,
243259 ),
244260 'custom_properties_selector ' => 'root ' ,
245261 'custom_properties_selector_hover ' => 'button-default-hover ' ,
@@ -388,7 +404,11 @@ function add_custom_properties( $style_declarations, $custom_properties, $select
388404
389405 // add a CSS custom property from `color`
390406 if ( isset ( $ custom_properties ['color ' ] ) && isset ( $ element_declarations ['color ' ] ) ) {
391- $ style_declarations [ $ selector ][ 'declarations ' ][ $ custom_properties ['color ' ] ] = $ element_declarations [ 'color ' ];
407+ $ color_custom_properties = is_array ( $ custom_properties [ 'color ' ] ) ? $ custom_properties [ 'color ' ] : array ( $ custom_properties [ 'color ' ] );
408+
409+ foreach ($ color_custom_properties as $ custom_property ) {
410+ $ style_declarations [ $ selector ][ 'declarations ' ][ $ custom_property ] = $ element_declarations [ 'color ' ];
411+ }
392412 }
393413
394414 // add a CSS custom property from `background` or `background-color`
@@ -397,7 +417,11 @@ function add_custom_properties( $style_declarations, $custom_properties, $select
397417 ) ) {
398418 $ background_value = $ element_declarations [ 'background ' ] ?? $ element_declarations [ 'background-color ' ];
399419
400- $ style_declarations [ $ selector ][ 'declarations ' ][ $ custom_properties ['background ' ] ] = $ background_value ;
420+ $ background_custom_properties = is_array ( $ custom_properties [ 'background ' ] ) ? $ custom_properties ['background ' ] : array ( $ custom_properties ['background ' ] );
421+
422+ foreach ($ background_custom_properties as $ custom_property ) {
423+ $ style_declarations [ $ selector ][ 'declarations ' ][ $ custom_property ] = $ background_value ;
424+ }
401425
402426 unset( $ style_declarations [ $ element ][ 'declarations ' ][ 'background ' ] );
403427 unset( $ style_declarations [ $ element ][ 'declarations ' ][ 'background-color ' ] );
0 commit comments