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

Forced colors #6

Open
EllyLoel opened this issue May 8, 2023 · 3 comments
Open

Forced colors #6

EllyLoel opened this issue May 8, 2023 · 3 comments
Assignees

Comments

@EllyLoel
Copy link

EllyLoel commented May 8, 2023

Just wondering whether the -ms-high-contrast media queries should be updated to forced-colors?

Seems like Microsoft is recommending this:

@media (-ms-high-contrast: active), (forced-colors: active) {}

Along with using the new system colors, I assume something like this would work for fallback (though I haven't tested it):

color: WindowText;
color: CanvasText;
@EllyLoel
Copy link
Author

EllyLoel commented May 8, 2023

This is a quick and dirty update of the high contrast mode styles to include forced colors following the idea above (again haven't yet had the chance to test that this actually works):

@media (-ms-high-contrast: active), (forced-colors: active) {
  code[class*="language-"],
  pre[class*="language-"] {
    color: WindowText;
    color: CanvasText;
    background: Window;
    background: Canvas;
  }

  :not(pre) > code[class*="language-"],
  pre[class*="language-"] {
    background: Window;
    background: Canvas;
  }

  .token.important {
    background: Highlight;
    color: Window;
    color: Canvas;
    font-weight: normal;
  }

  .token.atrule,
  .token.attr-value,
  .token.function,
  .token.keyword,
  .token.operator,
  .token.selector {
    font-weight: bold;
  }

  .token.attr-value,
  .token.comment,
  .token.doctype,
  .token.function,
  .token.keyword,
  .token.operator,
  .token.property,
  .token.string {
    color: Highlight;
  }

  .token.attr-value,
  .token.url {
    font-weight: normal;
  }
}

@ericwbailey
Copy link
Owner

Hey! Sorry for the late reply here, things have been kind of chaotic for me as of late.

We're sill in the weird in-between period where -ms-high-contrast is still technically applicable. Search for "Here are two tables of the current support landscape" in this post for where we're at.

I've been waffling on what to do, but I like your suggestion of using the new system color stack, and think that's worth the extra bandwidth hit? Does that sound good to you? If so I can update and see about getting releases updated in places where it's consumed.

@ericwbailey ericwbailey self-assigned this Jun 12, 2023
@EllyLoel
Copy link
Author

No stress! I appreciate you taking the time.

I'll admit it's been a while since I've looked at or thought about this, but I think a few extra lines wouldn't hurt too bad in terms of bandwidth but I'm no expert.

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

No branches or pull requests

2 participants