Site logo

Archived topic

Disable Editor color override

5 replies · Started by _blank on February 22, 2019

Viewing posts 1–6 of 6

Hi, I saw that it would be possible in GP 2.3 to disable the theme from picking up the front end colors in the editor. I'm using a dark background which is pretty buggy in the editor. Is there any interim thing one can do to disable the color changes?

There's no issues with Generatepress itself and dark mode is activated as it should be. The issues lies with dark mode itself which I feel needs more work from the Gutenberg team. It's also other issues, mostly related to ACF that becomes way more apparent when you have a dark background.

Anyhow, I saw this in the other thread which I can use as a temp solution:

Try this:
"add_action( 'enqueue_block_editor_assets', function() {
$css = '.editor-post-title__block .editor-post-title__input {text-transform: none;}';
$css .= '.editor-block-list__block a, .editor-block-list__block a:visited {color: #000000;}';

wp_add_inline_style( 'generate-block-editor-styles', $css );
}, 100 );"

Thanks!

Ah ok - thanks for explaining. Yes the Dark UI does need a lot of love. Glad you found a solution.

Hmm, one more quick followup, realised that I still need to disable dark mode, is that possible? I'm willing to change stuff in the parent theme if necessary.

We initiate dark mode using javascript if we detect that your text color is light.

You can try disabling it like this:

add_action( 'enqueue_block_editor_assets', function() {
    wp_add_inline_script( 'generate-block-editor-scripts', 
        "jQuery( window ).on( 'load', function() {
            jQuery( 'body' ).removeClass( 'is-dark-theme' );
        } );"
    );
}, 100 );

Let me know :)

This archived topic is closed to new replies.