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

Allow to configure color hex values for code coverage badges #9890

Closed
JoshuaKGoldberg opened this issue Jan 9, 2024 · 2 comments
Closed

Comments

@JoshuaKGoldberg
Copy link

JoshuaKGoldberg commented Jan 9, 2024

📋 Description

Thanks for this awesome badge service! I used it actively in almost all of my repos. 🙌

One sticking point is the ability to keep consistent colors across badges in README.mds. It's nice for consistency to, say, have a solid line of the same green backgrounds in all badges. Which is doable with custom colors in all badges I use right now except for the Codecov badge.

Screenshot of six README badges with white text on #289835 green background, except for 'coverage: 95%' with a lime green background

Proposal: can we have a new option for the Codecov badge to specify the colors used at different ranges? E.g. instead of the default colors, we could specify it going along a nice deep #c72828 to #289835 scale?

This is also an accessibility concern, as the #33901C shadow under the default light green #4CC82F for 100% only has 4.08:1 color contrast under white text (let alone the lighter green itself).

Note that this intended as a separate request from #994. That one is about configuring the number ranges, I think. This one is for the color values at those ranges. I wasn't sure if I should file a new request or just tack onto that one.

I'd be happy to send a PR!

@chris48s
Copy link
Member

We don't allow this kind of configuration for a reason.

It is a design goal of shields that if you see one of our coverage badges on any repo, it doesn't matter if that project uses codecov, coveralls, sonar, scrutinizer.. whatever. The colours convey meaning, and they always mean the same thing. So it is not really a matter of "just submit a PR" for this one.

If you really do want to go completely wild, the endpoint badge https://shields.io/badges/endpoint-badge gives you limitless options but it isn't something we really want to make configurable for the standard badges.

The accessibility angle is something we're interested in though. The issue that some of the background/text colour combinations in our standard palette don't have sufficient contrast is something we've talked about in #5497 but we have not really come to a resolution. This probably sounds silly, but one thing I hadn't really considered until you raised this issue is that instead of keeping the background colours and changing the text, we could stick with the white text but adopt a darker palette for the standard colours (although way more of a lift as we use the named CSS colours everywhere). If you have suggestions and would like to have some input on that thread, that would be great.

I'd certainly rather think about ways we can make all of the badges more accessible for everyone than add additional configuration.

@JoshuaKGoldberg
Copy link
Author

Love it! Yes the only motivation for me in suggesting this was to have consistency in my badges. If the baseline/used-everywhere color is accessible then 💯 no issues.

I'll close this out and instead comment over on #5497. Thanks!

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