Skip to content

Add dark mode support 🌗 #199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 58 commits into from
Sep 13, 2020
Merged

Conversation

seifsay3d-zz
Copy link
Contributor

@seifsay3d-zz seifsay3d-zz commented Jun 1, 2020

Brief description

This PR addressed issue #187 and adds support to dark mode by adding .dark to the <html> tag.
...

Developer Certificate of Origin

Sample pictures

...
image

Further details

This PR is not ready for merge as I assume I have missed some variable references, I opened it so that we can have a point of discussion as I need some guidance to make sure I'm on the right track.

The goal is to support dark mode using CSS variables and at the same time keep supporting IE 'light mode only' using this mixin.

@mixin color($property, $varName) {
  // IE falls back to light theme always
  #{$property}: #{map-get(map-get($theme-map, 'light'), 'primary')};
  #{$property}: var(--#{$varName});
}

I have some concerns that I'm not sure how to deal with.

1 - this mixin allows for typos that are not spotted by the linter
2- this mixin has a limitation as it requires property and color name, thus struggles when trying to be used in gradients for example

I would love to hear your opinion on these.

...

Phreshhh and others added 27 commits January 29, 2019 14:58
@seifsay3d-zz seifsay3d-zz changed the base branch from master to develop June 1, 2020 21:15
@tomByrer
Copy link

Looks really nice!
Is it easy to switch between the 2?

@rhyneav
Copy link
Member

rhyneav commented Aug 16, 2020

Sounds great, @seifsay3d! Thank you for all of your work on this, and please let me know if I can help out in any way!

@seifsay3d-zz
Copy link
Contributor Author

seifsay3d-zz commented Aug 25, 2020

Hi @rhyneav, I've finally managed to fix the remaining issues, it looks good to me, but I would love to have a second eye just in case something slipped.

@rhyneav
Copy link
Member

rhyneav commented Sep 6, 2020

Awesome! Thank you for taking care of those!

I went through each page to see the changes and double check that there were not any styles that changed using light mode (since it should all be the same after the refactor) and found a couple of minor issues. Totally to be expected with such a major change, I'm impressed that this was all I found!

Please let me know if you need any assistance with getting these last updates!

Alert text

To keep backward compatibility we'll want to keep the text the same dark color.

before:
alert-a

after:
alert-b


Card borders

Similar to the alert text, but the border colors changed. I do like the dark borders, but think that we'll want to keep the old colors for now.

before:
card-a

after:
card-b


Code Styles

It looks like some of the code styles were lost

before:
code-a

after:
code-b


Input Focus

It looks like we lost colors on the input focus

before:
focus-a

after:
focus-b


Link Underline

In some places (but not all for some reason) we lost the link underline

before:
link-a

after:
link-b


Popover borders

Border styles on the popover appear to be less papery, maybe it's the border color?

before:
popover-a

after:
popover-b

@seifsay3d-zz
Copy link
Contributor Author

Thanks for not only noticing these but also for the great report and your very supportive attitude. I've added all the necessary changes to address these.

I've kept the blue in links to secondary to support a better contrast ratio on dark-theme, if you don't like that change then I can introduce another variable with the default chrome blue.

Other than that, I hope we have everything fixed 🤞🏽

@rhyneav
Copy link
Member

rhyneav commented Sep 13, 2020

This is fantastic, thank you again for all of your work in making this happen! I'm personally really excited to see dark mode in PaperCSS! I'm going to merge this in to develop, add some documentation around adding the .dark class, and release this in v1.9.0. I'll try to get that release out today or tomorrow!

@rhyneav rhyneav merged commit 11ea531 into papercss:develop Sep 13, 2020
@rhyneav
Copy link
Member

rhyneav commented Sep 14, 2020

Misspoke in my last comment. This was released yesterday in v1.8.0!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants