Giter VIP home page Giter VIP logo

Comments (12)

tolking avatar tolking commented on May 23, 2024 1

Thanks, I will optimize my docs.

v1.0.9, defaultTheme work with a postcss plugin css-prefers-color-scheme/postcss.
v1.1.0, i just use html[theme=light] html[theme=dark] replace css-prefers-color-scheme/postcss.

from vuepress-theme-default-prefers-color-scheme.

jrappen avatar jrappen commented on May 23, 2024 1

Maybe my request wasn't clear.

I was not asking for a button. I prefer the dynamic nature of the plugin, as does @spawnia. I guess we both are asking for a way to override the vuepress core default theme while following browser preferences if set.

A solution might be a change in the ranking of the individual settings?

from vuepress-theme-default-prefers-color-scheme.

spawnia avatar spawnia commented on May 23, 2024 1

The name defaultColor is misleading, since it does not change the default but rather overrides any other setting.

I advocate to restore it to its previous behavior of actually functioning as a default. Totally overriding user preference goes exactly against what I want out of this package.

from vuepress-theme-default-prefers-color-scheme.

spawnia avatar spawnia commented on May 23, 2024 1

How about just adding in a second option called overrideTheme to have a way to force a theme and reverting defaultTheme to function as the fallback in case the user has no preference?

from vuepress-theme-default-prefers-color-scheme.

tolking avatar tolking commented on May 23, 2024

You should remove the defaultTheme, The defaultTheme invalidates the prefers-color-scheme

from vuepress-theme-default-prefers-color-scheme.

spawnia avatar spawnia commented on May 23, 2024

Thanks for the response.

I think that this configuration is misleading, I would not expect the defaultTheme to just set the theme. My impression was that the entire point of this plugin was to have the theme be dynamic, overruling that through a setting invalidates its usefulness.

On another note: This was a breaking change, assuming you follow semantic versioning it warrants a major version bump.

from vuepress-theme-default-prefers-color-scheme.

jrappen avatar jrappen commented on May 23, 2024

Assuming the order of preferences is:

  • defaultTheme's default
  • overriding defaultTheme
  • brower preferences

The current behavior as of v1.1.2 is that overriding defaultTheme also overrides the browser preferences contrary to me assuming it should only override the (vuepress core) default light theme (for time slots) not the browser preferences as well.

I also assume @spawnia meant to imply the same above with his comments.


@tolking Where and how do I set a "default" dark theme for old browser's not preferring either a light or dark theme? Looking at the third section of:

https://caniuse.com/?search=prefers-color-scheme

this seems to be the same issue with @spawnia 's Chrome browser not communicating a default theme on Windows with the current release.

from vuepress-theme-default-prefers-color-scheme.

tolking avatar tolking commented on May 23, 2024

@jrappen The defaultTheme overrides the browser preferences, it is true.
It does bring some troubles to use.


I have an idea, it is delete defaultTheme then add a button to control show auto light or dark theme (It should be a built-in plugIn). Will this be better understood than now

from vuepress-theme-default-prefers-color-scheme.

tolking avatar tolking commented on May 23, 2024

I know what you mean. But from the beginning, The defaultTheme overrides the browser preferences, I can't destroy it now.
If need to control the themes when the prefers-color-scheme not working, I can only add one config now. This may cause more trouble

from vuepress-theme-default-prefers-color-scheme.

spawnia avatar spawnia commented on May 23, 2024

But from the beginning, The defaultTheme overrides the browser preferences

That was not the case in 1.0.9, back then the browser preference won over the defaultTheme.

from vuepress-theme-default-prefers-color-scheme.

tolking avatar tolking commented on May 23, 2024

v1.0.9, defaultTheme work with a postcss plugin css-prefers-color-scheme/postcss.
Adding overrideTheme is possible

from vuepress-theme-default-prefers-color-scheme.

spawnia avatar spawnia commented on May 23, 2024

Thank you @tolking for addressing this issue and a great v2

from vuepress-theme-default-prefers-color-scheme.

Related Issues (13)

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.