Skip to content

Commit f7e3827

Browse files
authored
fix (color schemes): colors for different heading in container (#3625)
1 parent 526dca2 commit f7e3827

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
// Use Blocksy theme colors as fallback defaults for container color schemes.
22
// These defaults apply when the default container color scheme is unset, but background or custom schemes exist.
3-
:where(.stk--is-blocksy-theme.stk--has-container-scheme) {
4-
--stk-default-heading-color: var(--theme-heading-color, var(--theme-heading-2-color, var(--theme-headings-color)));
3+
:where(.stk--is-blocksy-theme.stk--has-default-container-scheme) {
54
--stk-default-link-color: var(--theme-link-initial-color);
5+
--stk-default-heading-color: var(--theme-heading-color, var(--theme-headings-color));
6+
7+
:where(.stk-block-heading) {
8+
@for $i from 1 through 6 {
9+
:where(h#{ $i }) {
10+
--stk-heading-color: var(--theme-heading-color, var(--theme-heading-#{ $i }-color, var(--theme-headings-color)));
11+
}
12+
}
13+
}
614
}

src/plugins/global-settings/color-schemes/editor-loader.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,12 @@ export const GlobalColorSchemeStyles = () => {
187187
classNamesToAdd.push( 'stk--has-container-scheme' )
188188
}
189189

190+
if ( ! styles.includes( '--stk-default-container-background-color' ) ) {
191+
classNamesToRemove.push( 'stk--has-default-container-scheme' )
192+
} else if ( editor.classList.contains( 'stk--has-container-scheme' ) === false ) {
193+
classNamesToAdd.push( 'stk--has-default-container-scheme' )
194+
}
195+
190196
editor.classList.add( ...classNamesToAdd )
191197
editor.classList.remove( ...classNamesToRemove )
192198
}
@@ -199,6 +205,7 @@ export const GlobalColorSchemeStyles = () => {
199205
const hasBase = editor.classList.contains( 'stk--has-base-scheme' )
200206
const hasBackground = editor.classList.contains( 'stk--has-background-scheme' )
201207
const hasContainer = editor.classList.contains( 'stk--has-container-scheme' )
208+
const hasDefaultContainer = editor.classList.contains( 'stk--has-default-container-scheme' )
202209

203210
if ( hasBase && ! classnames.includes( 'stk--has-base-scheme' ) ) {
204211
classnames.push( 'stk--has-base-scheme' )
@@ -209,6 +216,9 @@ export const GlobalColorSchemeStyles = () => {
209216
if ( hasContainer && ! classnames.includes( 'stk--has-container-scheme' ) ) {
210217
classnames.push( 'stk--has-container-scheme' )
211218
}
219+
if ( hasDefaultContainer && ! classnames.includes( 'stk--has-default-container-scheme' ) ) {
220+
classnames.push( 'stk--has-default-container-scheme' )
221+
}
212222
return classnames
213223
} )
214224
filterRegistered = true

src/plugins/global-settings/color-schemes/index.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,10 @@ public function add_body_class_color_schemes( $classes, $color_scheme_css ) {
398398
if ( strpos( $color_scheme_css, '.stk-container:where(:not(.stk--no-background))' ) !== false ) {
399399
$classes[] = 'stk--has-container-scheme';
400400
}
401+
402+
if ( strpos( $color_scheme_css, '--stk-default-container-background-color' ) !== false ) {
403+
$classes[] = 'stk--has-default-container-scheme';
404+
}
401405
}
402406
return $classes;
403407
}

0 commit comments

Comments
 (0)