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

Add color-scheme for dark mode #37710

Closed
2 tasks done
Tracked by #37549
robinheidrich opened this issue Dec 24, 2022 · 8 comments · Fixed by #37734
Closed
2 tasks done
Tracked by #37549

Add color-scheme for dark mode #37710

robinheidrich opened this issue Dec 24, 2022 · 8 comments · Fixed by #37734

Comments

@robinheidrich
Copy link

Prerequisites

Proposal

Bootstrap should make use of color-scheme to display browser elements (scrollbar, select, etc.) in dark mode as well.

Motivation and context

Here's a preview of what scrollbars currently look like in the Bootstrap documentation, and what they would look like if color scheme were used.

image
image

@mdo
Copy link
Member

mdo commented Dec 25, 2022

We just shipped color mode support in v5.3.0.

@mdo mdo closed this as not planned Won't fix, can't repro, duplicate, stale Dec 25, 2022
@coliff
Copy link
Contributor

coliff commented Dec 26, 2022

@mdo I think this is a valid issue and should be re-opened. Dark mode in Bootstrap 5.3 alpha doesn't currently add the colour-scheme CSS property so UI elements are not dark (see screenshots in original post)

https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme

@ffoodd
Copy link
Member

ffoodd commented Dec 26, 2022

Agreed, color-scheme is basically a global accent-color for browser UI, and makes thé overall color modes smoother.

@mdo
Copy link
Member

mdo commented Dec 26, 2022

Oh, my bad! I didn't see the second image, thanks for reopening fam :).

@mdo
Copy link
Member

mdo commented Dec 26, 2022

Do we just need to add color-scheme: dark to the :root for dark mode? I'm unclear of what's in scope for the changes coming from the property's inclusion. I see scrollbars change when I use it, but the <select> menu when shown doesn't change from light to dark. Am I missing something?

@coliff
Copy link
Contributor

coliff commented Dec 27, 2022

Do we just need to add color-scheme: dark to the :root for dark mode? I'm unclear of what's in scope for the changes coming from the property's inclusion. I see scrollbars change when I use it, but the <select> menu when shown doesn't change from light to dark. Am I missing something?

It affects a few other things too, such as browser-based autofill which typically changes the background of a form input to indicate to the user that it was autofilled. Here's a quick example from the docs which autofilled on email address of mine (Edge v108 on macOS). If the CSS had specified color-scheme: dark then the autofill background would have been dark to better match the theme.

Untitled

here's autofill with color-scheme: dark set on the body
Untitled

@julien-deramond
Copy link
Member

Let's try a PR to add color-scheme for light and dark color modes (not 100% sure because haven't tried it yet but probably to the :root).

We must double-check everything in this PR:

  • Behavior with default $color-mode-type and when set to media-query
  • All elements that can be rendered differently: scrollbars, inputs (with autofill and/or options), textareas, selects, etc. (don't have an exhaustive list yet 😄)
  • Browsers/OSs compatibility; some browsers seem to handle it better than others even without color-scheme

@mdo
Copy link
Member

mdo commented Dec 27, 2022

See #37734.

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

Successfully merging a pull request may close this issue.

5 participants