Skip to content

Change Web UI based on prefers-color-scheme #6115

Closed

Description

@mx-psi

What happens

The Web UI has the same theme regardless of the preferred color scheme the user has set on their browser.

What I expected to happen

The Web UI is dark when the prefers-color-scheme property is set to dark or the default one when it is light or no-preference.

Version Information

Syncthing Version: v1.3.0
OS Version: Linux Mint 18.1
Browser Version: Firefox 70.0 64 bit

Activity

  1. AudriusButkevicius commented on Oct 31, 2019

    @AudriusButkevicius
    Member

    Please file a PR for this, this would need some changes what "default" means (which is no preference), and add a white theme explicitly.

  2. added
    enhancement
    ui
    on Oct 31, 2019
  3. Ferroin commented on Oct 31, 2019

    @Ferroin

    From the perspective of an end user, I would expect 'default' as the selected theme to follow what prefers-color-scheme specifies (and have no-preference behave like the current 'default' setting), and a manually set theme to override what the property says.

    I don't think we would need a new 'white' theme though, the current light theme is perfectly acceptable for general usage with prefers-color-scheme: light.

  4. AudriusButkevicius commented on Oct 31, 2019

    @AudriusButkevicius
    Member

    I mean light when I say white, but this does need to change what default means and how asset overriding works.

  5. mx-psi commented on Nov 2, 2019

    @mx-psi
    ContributorAuthor

    @AudriusButkevicius I was going to file a PR but I am not sure on how to proceed. I could implement it in either of two ways:

    My first idea was creating a default theme that imports the appropriate theme depending on a media query, something like:

    @import "path/to/white/theme.css" (prefers-color-scheme: light);
    @import "path/to/dark/theme.css" (prefers-color-scheme: dark);

    I think that would require changing the way assets are served since there is no way to access an asset outside of the current theme folder. The advantage of this setup is that the default theme doesn't need separate maintenance, it just links to the existing themes.

    The second way of doing it is just creating a new CSS default file by adapting the white/dark theme files. This would require no changes to the server code but it would entail maintaining separately a new file.

    Which way do you think would be best? Is any of these what you had in mind?

  6. AudriusButkevicius commented on Nov 2, 2019

    @AudriusButkevicius
    Member

    Not sure, ideally something that does not break people with custom themes now.

  7. AudriusButkevicius commented on Nov 2, 2019

    @AudriusButkevicius
    Member

    My gut feeling was to check current theme, if its default, pass the preferred (from css) scheme in the headers, which would then drive the asset serving.

  8. added 2 commits that reference this issue on Nov 3, 2019
    067d637
    90dbee2
  9. mx-psi commented on Nov 3, 2019

    @mx-psi
    ContributorAuthor

    I have followed the first approach in the end. There is a proposal for passing the preferred color scheme in the HTTP request so that the correct assets could be served at request time (see w3c/csswg-drafts#4162), but as far as I know nothing like this is possible as of now.

  10. added a commit that references this issue on Nov 8, 2019
    9b01e64
  11. added this to the v1.3.2 milestone on Nov 11, 2019
  12. added 3 commits that reference this issue on Nov 11, 2019
    4a09a1b
    5c0b87e
    f206d40
  13. added a commit that references this issue on Nov 24, 2019
  14. added
    frozen-due-to-age
    on Nov 8, 2020
  15. locked and limited conversation to collaborators on Nov 8, 2020
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

    enhancementfrozen-due-to-ageui

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions