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
Contrast calculation for identifier inaccurate #3906
Comments
Let me check — but I think this is because the checker thinks there isn't sufficient difference between the |
Perhaps what the system should do is always, when possible, use the background color at grade 10 for reverse links. |
I am not sure why you would test against a grade 10 color for reverse. The error is giving results that are not based on the actual setting - I don't have base-lightest anywhere. I would think it should be testing the link colors - normal and reverse - relative to the theme-identifier-background-color and if they both fail, throw the error. If not, there would need to be a way to set whether to use a light or dark identifier. |
I'm running into this too after upgrading to
|
OK — I think the issue here is that the link color calculator doesn't respect the value of For now a fix could be to set @sawyerh — I think you could change the color of These are just patches, though... I'll need to work through what the proper system fix should be. Let me know if either of these work, and I'll try to make progress on a real fix. |
Thanks @thisisdano. Those didn't do the trick. In case it's helpful for working through the system fix, here's what I get when trying those two patches: When setting
When setting |
OK, thanks. I'll dig into this. Now I need to understand why this didn't come up as we tested this, since we'd tested nearly these exact cases. More to come! |
@sawyerh can you share your base, primary, and link colors( I didn't get any issues with: $theme-color-emergency: "gold-30v";
$theme-link-reverse-color: "gray-10"; Tried with |
@mejiaj Our project isn't themeing the link colors, but the base/primary are below: // Base colors
$theme-color-base-lightest: #f2f2f2;
$theme-color-base-lighter: #dcdcdc;
$theme-color-base: #707070;
$theme-color-base-dark: #535353;
$theme-color-base-darkest: #141414;
$theme-color-base-ink: #141414;
// Primary colors
$theme-color-primary-lighter: #e8eef4;
$theme-color-primary-light: #8aaac7;
$theme-color-primary: #14558f;
$theme-color-primary-dark: #0e3c64;
$theme-color-primary-darker: #0a2b48; |
@sawyerh thanks for that. Sharing my findings, still working a proper fix. It seems like custom ink grade isn't being set properly. Narrowed it down to: // _uswds-theme-color.scss
$theme-color-base-darkest: #141414;
// _alert-status-styles.scss:26
@include set-link-from-bg($bgcolor, "ink", "base-lighter"); Possible fixes:
I'm sorry about these issues and we'll be more conscious about these settings moving forward. |
@mejiaj Thanks! The following workaround worked for me: $theme-color-base-darkest: "gray-90";
$theme-color-emergency: "gold-30v";
$theme-link-reverse-color: "gray-10"; |
Given the these custom base values:
And trying to set a Error in plugin "sass"
Message:
src/stylesheets/core/mixins/_set-link-from-bg.scss
Error: 'Neither "ink" nor "base-lighter" can be AA contrast links and hovers on a "emergency" background.' If I check the color contrast in this contrast-ratio app ↗. I had thought the fallback link color variable wasn't working in Trying
From https://designsystem.digital.gov/design-tokens/color/overview/#magic-number Looking into how $link-grade is calculated with custom values and why it's returning |
When compiling the sass I get an error stating "Neither "primary" nor "base-lightest" can be AA contrast links and hovers on a "base-darkest" background." This is driven by the link settings in _uswds-theme-colors. Using the default works because "white" is ignored, but any changes cause this error. Below are the setting and clearly the difference between 90 and 5 or 30 is more than 50.
$theme-color-base-lightest: "gray-5";
$theme-color-base-darkest: "gray-90";
$theme-identifier-background-color: "base-darkest";
// Links
$theme-link-color: "primary";
$theme-link-visited-color: "violet-70v";
$theme-link-hover-color: "primary-dark";
$theme-link-active-color: "primary-darker";
$theme-link-reverse-color: "white";
$theme-link-reverse-hover-color: "gold-30";
$theme-link-reverse-active-color: "white";
Using Visual Studio Code and Live Sass Compiler.
I believe the issue may be that set-link-from-bg() doesn't actually test the fallback colors.
The text was updated successfully, but these errors were encountered: