public function editor_custom_color_variables() { if ( !
$this->
switch_should_render() ) { return;
} $background_color =
get_theme_mod( 'background_color', 'D1E4DD'
);
$should_respect_color_scheme =
get_theme_mod( 'respect_user_color_preference', false
);
if ( $should_respect_color_scheme && Twenty_Twenty_One_Custom_Colors::
get_relative_luminance_from_hex( $background_color ) > 127
) { // Add Dark Mode variable overrides.
wp_add_inline_style( 'twenty-twenty-one-custom-color-overrides',
'.is-dark-theme.is-dark-theme .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); --button--color-text: var(--global--color-background); --button--color-text-hover: var(--global--color-secondary); --button--color-text-active: var(--global--color-secondary); --button--color-background: var(--global--color-secondary); --button--color-background-active: var(--global--color-background); --global--color-border: #9ea1a7; --table--stripes-border-color: rgba(240, 240, 240, 0.15); --table--stripes-background-color: rgba(240, 240, 240, 0.15); }'
);
} wp_enqueue_script( 'twentytwentyone-dark-mode-support-toggle',
get_template_directory_uri() . '/assets/js/dark-mode-toggler.js',
array
(),
'1.0.0',
true
);