Skip to content

Commit de025c1

Browse files
committed
remove color scheme styles in editor if there are no color schemes
1 parent 578783c commit de025c1

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ export const renderGlobalColorSchemeStyles = (
6969
css += bgcss
7070
}
7171

72+
// This fixes the issue wherein if there is a background scheme and no container/base scheme, the container inherits the background scheme which may cause the text to be unreadable
73+
const addContainerSchemeDefaultColors = containerModeColorScheme in colorSchemes && ! schemeHasValue( colorSchemes[ containerModeColorScheme ] ) &&
74+
(
75+
// Add default container scheme if background scheme has value
76+
( backgroundModeColorScheme in colorSchemes && schemeHasValue( colorSchemes[ backgroundModeColorScheme ] ) ) ||
77+
// Add default container scheme if there are color schemes other than the default scheme and background scheme
78+
( colorSchemesArray.length !== 2 )
79+
)
80+
7281
if ( containerModeColorScheme in colorSchemes && schemeHasValue( colorSchemes[ containerModeColorScheme ] ) ) {
7382
decls = getCSS( colorSchemes[ containerModeColorScheme ], currentHoverState, 'container' )
7483
let containercss = ''
@@ -79,8 +88,7 @@ export const renderGlobalColorSchemeStyles = (
7988
containercss += `.stk-container:where(:not(.stk--no-background):hover), :where(.stk-hover-parent:hover) .stk-container:where(:not(.stk--no-background)){ ${ decls.desktopParentHover.join( '' ) } }\n`
8089
}
8190
css += containercss
82-
// This fixes the issue wherein if there is a background scheme and no container/base scheme, the container inherits the background scheme which may cause the text to be unreadable
83-
} else if ( containerModeColorScheme in colorSchemes && ! schemeHasValue( colorSchemes[ containerModeColorScheme ] ) ) {
91+
} else if ( addContainerSchemeDefaultColors ) {
8492
const containercss = `.stk-container:where(:not(.stk--no-background)){ ${ getDefaultColors() } }\n`
8593

8694
css += applyFilters( 'stackable.global-settings.global-color-schemes.default-container-scheme', containercss )

0 commit comments

Comments
 (0)