Skip to content

[Feat] Dark mode #187

Closed
Closed

Description

@iShawnWang

Since macOS Mojave 10.14 introduce Drak Mode
It is happy to see paper css also support dark mode, it's awesome ~

Activity

  1. changed the title [-][Feat] Drak(Night) Mode[/-] [+][Feat] Dark mode[/+] on Apr 11, 2019
  2. rhyneav commented on Aug 18, 2019

    @rhyneav
    Member

    As a dark mode user, this would be awesome. Here's a good primer on how this could be introduced. It looks like just a simple media query:

    @media (prefers-color-scheme: dark) {
    
    }
    ``
  3. seifsay3d-zz commented on Apr 21, 2020

    @seifsay3d-zz
    Contributor

    I have recently started to use papercss and I would like to have a dark-mode in my project so I thought that's a nice issue to tackle.

    I have a couple of questions/assumptions that I would like to get clarity on.

    1- Do we want to generate paper-dark-min.css and let the user load different builds using @media (prefers-color-scheme: dark)

    2- If not, then I assume we would rely on css variables to dynamically change the variables, then how do we approach IE? would something like this be sufficient?

    .paper {
      background-color: $main-background;
      background-color: var(--color-main-background);
    }
    

    Currently, I'm thinking of a solution that would be something along these lines

    1- create dark mode variable list with appropriate defaults

    $dark-mode-primary: #41403e !default;
    $dark-mode-secondary: #0071de !default;
    

    2- Add sass variables as css variables to html element based on @media (prefers-color-scheme: dark) or html.dark{}

    3- update all usages for scss vars to css variables with IE fallback

  4. rhyneav commented on May 17, 2020

    @rhyneav
    Member

    Hey @seifsay3d sorry for the delay! You bring up a good point about IE (the problem child). Going against my own comment above, I think a solution without using media queries might be the best way to tackle this for now.

    I really like your idea of having a simple .dark class that could be put on the <html> tag. That way we can leave it up to the user of PaperCSS if they want a dark theme or not. It's easy to make it dynamic for the user's preferences using a few lines of JavaScript. Plus once IE browser support is there, it'll be easy to move this over to using css variables.

    So a modified version of your plan would look like:

    1. Create dark mode variable list with appropriate defaults
    2. Add sass variables as css variables to html element based on html.dark
    3. Update color references to use some new color mixin (to get light vs dark colors)
    4. ???
    5. Profit!

    What are your thoughts on that?

  5. seifsay3d-zz commented on May 18, 2020

    @seifsay3d-zz
    Contributor

    Sounds awesome, I'll give it a shot then 🕺

  6. rhyneav commented on May 18, 2020

    @rhyneav
    Member

    That sounds great, thank you for taking it on! Let me know if I can help you in any way!

  7. rhyneav commented on Sep 13, 2020

    @rhyneav
    Member

    Just released in v1.8.0!

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions