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

Sass Color Scheme mixin incorrectly claims it supports custom schemes #39410

Closed
3 tasks done
Stan-Stani opened this issue Nov 15, 2023 · 1 comment · Fixed by #39417
Closed
3 tasks done

Sass Color Scheme mixin incorrectly claims it supports custom schemes #39410

Stan-Stani opened this issue Nov 15, 2023 · 1 comment · Fixed by #39417

Comments

@Stan-Stani
Copy link

Prerequisites

Describe the issue

https://github.com/twbs/bootstrap/blob/v5.3.2/site/content/docs/5.3/customize/sass.md#color-schemes

@mixin color-scheme($name) {
  @media (prefers-color-scheme: #{$name}) {
    @content;
  }
}

.custom-element {
  @include color-scheme(dark) {
    // Insert dark mode styles here
  }

  @include color-scheme(custom-named-scheme) {
    // Insert custom color scheme styles here
  }
}

Using custom-named-scheme compiles to @media(prefers-color-scheme: custom-named-scheme) { } but schemes with custom names aren't supported by prefers-color-scheme.

Reduced test cases

n/a

What operating system(s) are you seeing the problem on?

Windows, macOS, Android, iOS, Linux

What browser(s) are you seeing the problem on?

Chrome, Safari, Firefox, Microsoft Edge, Opera

What version of Bootstrap are you using?

v.5.3.2

@julien-deramond
Copy link
Member

julien-deramond commented Nov 17, 2023

Thanks for reporting this issue @Stan-Stani
You're right, Media Queries Level 5 mentions that the values are either light or dark.
However, it's also mentioned the following making our color-scheme rather generic enough for the future:

The values for this feature might be expanded in the future (to express a more active preference for light color schemes, or preferences for other types of color schemes like "sepia").

#39417 suggests fixing the description which is wrong in the sense that custom-named-scheme is not custom at all but limited to light and dark values, and will probably limited to fixed values in the future as well (not custom).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants