Anatole: Can I set dark mode in theme as default in config?

Created on 16 Jul 2020  ·  4Comments  ·  Source: lxndrblz/anatole

Link above.

enhancement question

All 4 comments

Hello Piotr, thanks for your inquiry.

Right now there is no simple way of setting the dark theme as the standard in the the config. However, it can still be accomplished with some manual tweaking.

You would need to patch this condition in the anatole-header.js.

    if (theme === null) {
        if(userPrefersDark){
            setTheme('dark');
        }
        else{
            setTheme('light');
        }
    }

To something more like this:

  if (theme === null) {
            setTheme('dark');
    }

What is different here is that the original function takes in account if a user has darkmode enabled prefers the light version of the theme.

I’m not planning on changing this to be configured through the config.toml, but it’s a great suggestion and contributions are always welcome!

Hello @lxndrblz ! Thanks a lot for really quick and expanded answer! :) I'm not planning to hack it manually :) Thanks again!

@PiotrWachulec I will reopen this issue and it to the project roadmap. I think a lot of users could benefit from this if they were able to configure the mode through the config file rather than hacking the javascript.

Really great! ;) Thanks @lxndrblz ;)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GhostBasenji picture GhostBasenji  ·  5Comments

abraithwaite picture abraithwaite  ·  4Comments

PiotrWachulec picture PiotrWachulec  ·  6Comments

jakevossen5 picture jakevossen5  ·  6Comments

cwpearson picture cwpearson  ·  5Comments