-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
New Rule: no-ms-high-contrast #17
Comments
Thanks for the suggestion. There really isn't enough information in the description to understand what you're suggesting or why. Can you add more details? |
Sure thing. System color keywordsSystem colors, similar to named colors like a {
color: LinkText;
} Various system colors were used with
The linter rule should ban these values and autofix to the modern equivalent. A possible enhancement is to allow the deprecated values as fallbacks (maybe using a rule option like Beforea {
color: -ms-hotlight;
} Aftera {
color: LinkText;
}
/* or with allowFallback */
a {
color: -ms-hotlight;
color: LinkText;
} Going through the docs to find this table, I stumbled on additional deprecated CSS system colors. So maybe this should be its own dedicated PropertyThis one is fairly straightforward. The Beforeimg {
-ms-high-contrast-adjust: none;
} Afterimg {
forced-color-adjust: none;
}
/* or with allowFallback */
img {
-ms-high-contrast-adjust: none;
forced-color-adjust: none;
} Media queryThe
There is also a prefers-contrast media query but I haven't seen it advocated for much. |
Thanks for the additional detail, this is very helpful. I'm curious how long ago |
For what it's worth, I've had to catch this manually in 5+ PRs over the past year. (But I also work at Microsoft where we're more likely to support high contrast mode.) prefers-forced-colors was added in Chrome 89 three years ago. To be more generalized, this proposal could be split into no-deprecated-system-colors and no-vendor-prefixes. Both of these possible rules can have suggestions or autofixes to use the standardized alternatives. |
And keep in mind, just like JavaScript rules, you can always create your own custom rules to do whatever you want. My goal here is to ensure this plugin has rules that are as widely-applicable as possible. |
Rule details
Auto fix uses of -ms-high-constrast to forced-colors
What type of rule is this?
Warns about a potential problem
Example code
Participation
Additional comments
Additional info: https://blogs.windows.com/msedgedev/2020/09/17/styling-for-windows-high-contrast-with-new-standards-for-forced-colors/
The text was updated successfully, but these errors were encountered: