Skip to content

Commit

Permalink
Add dark editor style support
Browse files Browse the repository at this point in the history
This fixes #6451.

This PR enables a new command to themers. They can now add `add_theme_support( 'dark-theme' );` in order to ask the editing canvas to be friendly to dark themes.

What this does is add a body class to the editor, `is-dark-theme`, which enables already present color changes to the side UI and borders, that are friendly to dark themes.
  • Loading branch information
Joen Asmussen committed Sep 7, 2018
1 parent ef722fe commit fd4c2c5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,10 @@ function toggleDropdown() {
* @return string The $classes string, with gutenberg-editor-page appended.
*/
function gutenberg_add_admin_body_class( $classes ) {
// Default to is-fullscreen-mode to avoid jumps in the UI.
return "$classes gutenberg-editor-page is-fullscreen-mode";
if ( current_theme_supports( 'editor-styles' ) && current_theme_supports( 'dark-theme' ) ) {
return "$classes gutenberg-editor-page is-fullscreen-mode is-dark-theme";
} else {
// Default to is-fullscreen-mode to avoid jumps in the UI.
return "$classes gutenberg-editor-page is-fullscreen-mode";
}
}

0 comments on commit fd4c2c5

Please sign in to comment.