Here's the lowdown of how dark mode works in the editor at the moment (hat tip: @jasmussen):
- WordPress does not support Dark Mode™ yet.
- Themes might.
- Whether Dark Mode or not, a theme might simply have a dark background.
- On a dark background, an empty paragraph needs to have white placeholder text, or it won’t be legible.
The current solution is a boolean opt-in, that inverts the UI. This opt-in, add_theme_support( 'dark-editor-style' );, simply outputs is-dark-theme as a class in the body tag. This same class is also used in Cover to tell the editor UI to be inverted if Cover detects a dark background.
Can we refactor the is-dark-theme class name to be output based on the luminosity chosen by the background color of the root element in Global Styles, dynamically?
Here's the lowdown of how dark mode works in the editor at the moment (hat tip: @jasmussen):
The current solution is a boolean opt-in, that inverts the UI. This opt-in,
add_theme_support( 'dark-editor-style' );, simply outputsis-dark-themeas a class in the body tag. This same class is also used in Cover to tell the editor UI to be inverted if Cover detects a dark background.Can we refactor the
is-dark-themeclass name to be output based on the luminosity chosen by the background color of the root element in Global Styles, dynamically?