Skip to content

fix(linter): skip contrast check for translucent colors - #201

Open
a-kio wants to merge 1 commit into
google-labs-code:mainfrom
a-kio:fix-translucent-contrast-check
Open

a-kio wants to merge 1 commit into
google-labs-code:mainfrom
a-kio:fix-translucent-contrast-check

Conversation

@a-kio

@a-kio a-kio commented Nov 29, 2026

Copy link
Copy Markdown

The contrast-ratio rule compared a translucent backgroundColor as if it were opaque. A 10% tint of #f2b33d was reported as 1.00:1 against its own text, while composited over the declared surface the real ratio is above 7:1. A rule that warns on correct designs is worse than no warning.

When either the background or text color has alpha below 1, the rule now skips the pair: the actual contrast depends on the backdrop beneath the component, which the rule does not know. A regression test covers a tinted alert matching the reported example. Tests could not be run locally because the JS dependencies are not installed.

@google-cla

google-cla Bot commented Nov 29, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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

Successfully merging this pull request may close these issues.

1 participant