-
Notifications
You must be signed in to change notification settings - Fork 22.6k
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
Make system-color a proper data type page #21207
Conversation
Preview URLs Flaws (2)URL:
URL:
External URLs (1)URL:
(this comment was updated 2022-10-03 19:42:02.341463) |
|
||
#### Result | ||
|
||
{{EmbedLiveSample("Using system colors")}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is all good except it would be good to provide links/hints on how to set forced color mode - even better (if possible) would be to make pressing the button force the mode.
Otherwise not much point this being a live example.
I'm going to merge anyway, because this is excellent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied the example from the forced-colors
page: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/forced-colors#examples.
I think you can't make pressing the button enable it, it's an OS setting that's not available to Web pages. The only concrete example I know of is Windows high contrast mode: https://blogs.windows.com/msedgedev/2020/09/17/styling-for-windows-high-contrast-with-new-standards-for-forced-colors/ . I just added a reference to that, it's helpful I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me/don't have any better ideas :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good for me, modulo comment. Did you want to wait on the BCD to go in first before merging @wbamberg ?
Thanks Hamish. The BCD PR just merged but I'm going to wait for a couple of days for it to percolate through to the page, and hope noone makes any merge conflicts in the meantime: 🤞 . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tiny nits
|
||
### Using system colors | ||
|
||
In this example we have a button that normally gets its contrast using the {{cssxref("box-shadow")}} property. In forced colors mode, `box-shadow` is forced to `none`, so the example uses the `forced-colors` media feature to ensure there is a border of the appropriate color (`ButtonBorder` in this case). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this example we have a button that normally gets its contrast using the {{cssxref("box-shadow")}} property. In forced colors mode, `box-shadow` is forced to `none`, so the example uses the `forced-colors` media feature to ensure there is a border of the appropriate color (`ButtonBorder` in this case). | |
The button in this example gets its contrast using the {{cssxref("box-shadow")}} property. In the `forced-colors` mode, `box-shadow` is forced to `none`. The example uses the `forced-colors` media feature to ensure that there is a border of the appropriate color (`ButtonBorder` in this case). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forced-colors
(with code styling and a hyphen) is the name of the media feature, but "forced colors mode" is the name of the abstract feature. So I think "In forced colors mode" is correct here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! 👍
This PR makes "System color kewords" into a proper reference page for the
<system-color>
type, as discussed in #15540 (comment) and following comments.This will also fix the
<system-color>
link in the formal syntax for the<color>
data type: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#formal_syntax.This PR depends on mdn/browser-compat-data#17924.