Skip to content

Feature request / how-to request: Dark mode #27

Closed

Description

@Lewiscowles1986

Hello 👋 this is a really cool way to package Gutenberg outside of WordPress.

I've been messing around with adding it to my Trilium Notes as a custom note-type:

image

As you may notice from the above screenshot, Gutenberg is rendering in light-mode.

My computer, and app are set to dark-mode, so if it were using CSS preferences, then that would work, but likely be buggy.

If the page that Gutenberg is rendered on, has a light-mode theme, or does not support dark-mode, or is on an OS / browser where the app ignores preferences and allows the user to set independently; I guess this might be a set of use-cases you may also be interested in?

If there is any guidance anyone can offer, my page is sort-of the same as your index.html, apart from rendering Gutenberg to a textarea (present iteration only, I will eventually dispense with the HTML element backing) on-load instead of on button-click / toggle.

One other edit I made is to expose OnChange (preparation for getting rid of the textarea, and integration into Trilium). I Do not believe this should have any effects on Dark-mode support.

prop passed to <IsolatedBlockEditor> component

onChange={ (blocks, _settings, _loader, _options) => saveBlocks( serialize( blocks ), textarea ) }

Activity

  1. Lewiscowles1986 commented on Aug 15, 2022

    @Lewiscowles1986
    Author

    I'm noticing a defaultEditorStyles property on EditorSettings... I'll try to see if the browser-extension covers any of this.

  2. Lewiscowles1986 commented on Aug 15, 2022

    @Lewiscowles1986
    Author

    For now, I've opted to use CSS filter with an invert(.85), this seems to work well enough and is powered from:

    'dark' === window.getComputedStyle(document.documentElement)?.getPropertyValue('--theme-style')?.trim();
    

    Preview

    image

  3. johngodley commented on Oct 13, 2022

    @johngodley
    Member

    I think this is something that needs to come from Gutenberg itself. Does that have dark mode support?

  4. Lewiscowles1986 commented on Oct 14, 2022

    @Lewiscowles1986
    Author

    Hey John,

    would you mind adding more detail to the question?

    It’s unclear to me if you are asking if Gutenberg has dark mode support, inferring that blocks this, or communicating in a way that is too subtle or nuanced for me to understand the meaning.

    best

  5. johngodley commented on Oct 14, 2022

    @johngodley
    Member

    I am asking if Gutenberg has dark mode support. I'm sure a lot of CSS could be added to implement it here, but I think it's something that would be best to come from Gutenberg itself. There seems to be various attempts at this but I don't think anything has made it out yet:

    https://github.com/WordPress/gutenberg/search?q=dark+mode&type=issues

  6. Lewiscowles1986 commented on Oct 15, 2022

    @Lewiscowles1986
    Author

    Yeah I guess until it gets dark mode, im happy enough with this hack I guess.

  7. Lewiscowles1986 commented on Oct 22, 2022

    @Lewiscowles1986
    Author

    Sorry, but it's not completed. Not by any stretch of the imagination. It's the opposite. It's won't / can't fix (and that is fine), but the closed as completed is incorrect, misleading, all sorts of problematic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions