Skip to content
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

Implement dark mode via light-dark() fn #8559

Merged
merged 3 commits into from
May 17, 2024
Merged

Conversation

Turbo87
Copy link
Member

@Turbo87 Turbo87 commented Apr 29, 2024

This implements a dark mode for the user interface, based on the system theme setting. The color-scheme CSS attribute could eventually be overridden if the user does not want to use the system setting.

Examples

Screen Shot 2024-04-29 at 14 34 30
Screen Shot 2024-04-29 at 14 34 42
Screen Shot 2024-04-29 at 14 34 51
Screen Shot 2024-04-29 at 14 35 16
Screen Shot 2024-04-29 at 14 35 42
Screen Shot 2024-04-29 at 14 35 49
Screen Shot 2024-04-29 at 14 36 02

@Turbo87 Turbo87 added C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works A-frontend 🐹 labels Apr 29, 2024
@Turbo87 Turbo87 requested a review from a team April 29, 2024 12:48
@Turbo87
Copy link
Member Author

Turbo87 commented Apr 29, 2024

looks like I might have to double check that the PostCSS plugin is working correctly (see Percy), but this should still be available for review. I hope I didn't forget any pages...

also, do we require a user override button to ship this or can we ship this without one?

@eth3lbert
Copy link
Contributor

I would expect a color scheme toggle button to be included with this PR. This would allow users who don't want this change to simply switch back to the light theme.

@Turbo87 Turbo87 marked this pull request as draft April 29, 2024 15:56
@bors
Copy link
Contributor

bors commented Apr 30, 2024

☔ The latest upstream changes (presumably 16b9eab) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Apr 30, 2024

☔ The latest upstream changes (presumably 748e265) made this pull request unmergeable. Please resolve the merge conflicts.

@eth3lbert
Copy link
Contributor

I've implemented a simple dark mode toggle that can switch between light, dark, and system. Feel free to cherry-pick or modify it as needed if you find it helpful in any way. eth3lbert@0dc59e4

image
image

This implements a dark mode for the user interface, based on the system theme setting. The `color-scheme` CSS attribute could eventually be overridden if the user does not want to use the system setting.
@Turbo87
Copy link
Member Author

Turbo87 commented May 17, 2024

@eth3lbert thanks! I've cherry-picked the UI from your commit, but simplified the implementation a little bit :)

edit: I've also set the default to the "light" color scheme for now in case we find any issues with the dark mode.

Turbo87 and others added 2 commits May 17, 2024 14:27
@Turbo87 Turbo87 marked this pull request as ready for review May 17, 2024 14:46
@Turbo87 Turbo87 merged commit cc02040 into rust-lang:main May 17, 2024
7 checks passed
@Turbo87 Turbo87 deleted the dark-mode branch May 17, 2024 14:46
@eth3lbert
Copy link
Contributor

That's great! Adding an icon as a visual cue to the dropdown menu is a much better implementation. I love this! I've tested it locally on the landing page without any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend 🐹 C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants