Git Product home page Git Product logo

Comments (4)

zyachel avatar zyachel commented on May 22, 2024 1

I can sort of guess why it is not working.
In index.js, browser preference is being checked before user preference.
I'll fix it tomorrow!

from quetre.

zyachel avatar zyachel commented on May 22, 2024 1

will only be able to fix it once I get time. a bit busy for some weeks.

from quetre.

zyachel avatar zyachel commented on May 22, 2024

it does follow system theme.

here's the relevant code:

  • when JS is disabled:

    // styles to be applied when js is disabled
    &:not([js-enabled]) {
    // if the user prefers dark theme
    @media (prefers-color-scheme: dark) {
    // using dark theme instead of default one
    @include get-themed-vars(dark);
    }
    }

  • when JS is enabled:

    // applying theme preferences in case they exist
    if (browserPrefersDarkTheme) setTheme('dark');
    else if (userPrefersTheme) setTheme(userPrefersTheme);

moreover it also applies theme colours in the URL bar:

meta(name="theme-color", media="(prefers-color-scheme: light)", content="#e3f6f5")
meta(name="theme-color", media="(prefers-color-scheme: dark)", content="#0f0d1c")

in action:

screen.mp4

perhaps you're using a hardened browser(eg: librewolf or firefox with tweaks)?
In those cases, the browser doesn't reveal system theme.

Or maybe you've toggled theme with the button once?
Because if that's the case, your theme preference will be stored in local storage. And next time you visit the website, your toggled preference will be applied, regardless of your system theme.

from quetre.

bbhtt avatar bbhtt commented on May 22, 2024

perhaps you're using a hardened browser(eg: librewolf or firefox with tweaks)?
In those cases, the browser doesn't reveal system theme.

No regular Firefox Nightly, no additional config tweaks.

Or maybe you've toggled theme with the button once?

I clear browser data on quit so that shouldn't be an issue.

when JS is disabled:

It seems to be working only when I disable JS; if JS is enabled it is defaulting to the light theme irrespective of my system theme. Here is a video with Firefox Nightly on Android (with JS enabled, then the theme button and lastly with JS disabled), I can see the same behavior with Nightly on desktop.

screencap.mp4

from quetre.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.