badges / shields

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

Simple Icons logo color #5752

Open adamalston opened 3 years ago

adamalston commented 3 years ago

Are you experiencing an issue with...

Description

The color for Simple Icons seems to be inconsistent in its application. For some badges, I need to specify the logoColor and for other I dont.

Working examples

  1. simpleicons.org/swift

    https://img.shields.io/badge/-Swift-fff?&logo=Swift

    The color of the Swift logo is FA7343 and it seems to be applied correctly without needing to specify the logoColor.

  2. simpleicons.org/docker

    Docker https://img.shields.io/badge/-Docker-fff?&logo=Docker

    Again, I didn’t have to specify the logoColor for the logo to show up correctly.

Non-working examples

  1. simpleicons.org/java

    https://img.shields.io/badge/-Java-fff?&logo=Java

    The color of the Java logo is 007396. The logo on this badge is white instead of its intended color. We can see this by changing the badge’s color: https://img.shields.io/badge/-Java-000?&logo=Java

    So to get the Java logo to show up correctly i have to specify the logoColor: https://img.shields.io/badge/-Java-fff?&logo=Java&logoColor=007396

  2. simpleicons.org/typescript

    Logo without logoColor: https://img.shields.io/badge/-TypeScript-fff?&logo=TypeScript

    Logo with logoColor: https://img.shields.io/badge/-TypeScript-fff?&logo=TypeScript&logoColor=007ACC

I’m unsure if this is a bug or if it is by design. Why do I have to specify the logoColor for some logos, and for others I do not?

chris48s commented 3 years ago

It is by design, but I agree the behaviour is not ideal in this situation.

The default behaviour is that we try to select a logo colour that will work with the default backgrounds. If we think the suggested colour from simpleicons will work, we use that otherwise we re-colour it so that we don't end up showing a dark logo on a dark background or light logo on a light background. This is useful for the common case.

For the main badge styles (flat, flat-square, for-the-badge, plastic) we're assuming the background is going to be darkgrey and for the social badge we're assuming it is whitesmoke. If you've customised the background colour, then we don't adapt. Unfortunately in this case, because you've customised the background of the default badge style to a light colour, this means the logic is basically doing the exact opposite of what you want.

https://github.com/badges/shields/pull/2833 is the PR where we introduced this. The logic might have moved on a bit since then, but if you read the discussion there, that's how we arrived at the current tradeoff..