Changeset 49320 for trunk/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-custom-colors.php
- Timestamp:
- 10/27/2020 01:58:37 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-custom-colors.php
r49247 r49320 121 121 wp_add_inline_style( 'twenty-twenty-one-custom-color-overrides', $this->generate_custom_color_variables( 'editor' ) ); 122 122 } 123 124 $should_respect_color_scheme = get_theme_mod( 'respect_user_color_preference', true ); // @phpstan-ignore-line. Passing true instead of default value of false to get_theme_mod.125 if ( $should_respect_color_scheme && self::get_relative_luminance_from_hex( $background_color ) > 127 ) {126 // Add dark mode variable overrides.127 wp_add_inline_style( 'twenty-twenty-one-custom-color-overrides', '@media (prefers-color-scheme: dark) { :root .editor-styles-wrapper { --global--color-background: var(--global--color-dark-gray); --global--color-primary: var(--global--color-light-gray); --global--color-secondary: var(--global--color-light-gray); } }' );128 }129 123 } 130 124 … … 176 170 $background_color = get_theme_mod( 'background_color', 'D1E4DD' ); 177 171 if ( 127 > self::get_relative_luminance_from_hex( $background_color ) ) { 178 $classes[] = ' is-background-dark';172 $classes[] = 'has-background-dark'; 179 173 } else { 180 $classes[] = ' is-background-light';174 $classes[] = 'has-background-light'; 181 175 } 182 176
Note: See TracChangeset
for help on using the changeset viewer.