badges / shields

Concise, consistent, and legible badges in SVG and raster format
https://shields.io
Creative Commons Zero v1.0 Universal
23.57k stars 5.49k forks source link

Configurable font color #504

Closed diomed closed 3 years ago

diomed commented 9 years ago

I'd like to be able to pick my own font color as well, instead of just picking badge color. There are great color schemes that could be done like that.

espadrine commented 9 years ago

Thanks for the suggestion!

Should we dissociate left / right? We should probably restrict that to custom badges, as vendor badges can have varying colors.

What should the parameter be named? We currently have colorA and colorB (for left / right) and colorscheme (for colorscheme.json). Maybe fontColorA and fontColorB?

diomed commented 9 years ago

Dissociation would be good.

and of course, that would go for custom badges only. Why not colorLeft & colorRight?

Tho I wouldn't mind what name it is as long as it's there.

paulmelnikow commented 5 years ago

/cc @MattIPv4

MattIPv4 commented 5 years ago

@paulmelnikow ty, GH didn't bring this up in related.

mbarkhau commented 5 years ago

To be in line with the new naming, the parameters would now be fontColor and labelFontColor.

hugovk commented 4 years ago

My use case is using badges to link to GitHub labels, and wanting to use the same colours.

GitHub labels automatically use white or black text colour based on the background colour:

image

https://github.com/NaNoGenMo/2019/labels

But the "admin" and "preview" badges are quite hard to read with white text:

image

https://github.com/NaNoGenMo/2019

One option is to use a similar algorithm to GitHub's to select the foreground black/white colour, but I'd be happy enough to be able to select black for these two.

PyvesB commented 4 years ago

@hugovk what you're suggesting has also been proposed in #4661. I'm personally more in favour of just having black and white automatically switching based on contrasts, rather than allowing full colour customisation as initially suggested by this issue. This keeps our badges more consistent and more readable (coloured text often being harder to read), without any user action needed to override the colour.

PyvesB commented 3 years ago

There have been a number of issues and comments about font colours over the years. The most common reason given by users is to allow better readability when the badge uses a light background (#5317, #4661, #5455, https://github.com/badges/shields/issues/504#issuecomment-560118266 and probably others).

This has been fixed by #5467 which automatically switches to a dark font when the background is too light.

At this point in time, we don't think that allowing users to fully customise the font colour is a good idea. The reasoning as to why these new options may add complexity and work against Shields' consistency and readability promises can be found in https://github.com/badges/shields/pull/5467#issuecomment-683924571.

Hopefully the implementation we've come up with will cover a vast majority of uses cases and allow people to happily read badges even with light backgrounds! 🎉