-
-
Notifications
You must be signed in to change notification settings - Fork 82
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
Make text of light tags legible #558
Conversation
2953940
to
7f5e2f6
Compare
Thanks for the contribution! I'll do a proper review in a couple of days/weeks, as soon as I finish a few other things and also release v3.5.1 of this project. |
No worries. I'm sure you can easily fix my mistake that's preventing compilation, the rgb parsing works in JS, just not TS. 🙃 |
7ba7f19
to
9191b0e
Compare
Preview environmenthttps://shlinkio.github.io/shlink-web-client/tag-legibility/ |
9191b0e
to
b727a70
Compare
Codecov Report
@@ Coverage Diff @@
## develop #558 +/- ##
===========================================
+ Coverage 78.53% 78.58% +0.05%
===========================================
Files 174 174
Lines 2082 2092 +10
Branches 321 324 +3
===========================================
+ Hits 1635 1644 +9
+ Misses 187 186 -1
- Partials 260 262 +2
Continue to review full report at Codecov.
|
I have pushed a couple of fixes for the linting issues, and added the missing tests. I have also changed the CSS classes to use BEM, as that's the approach used in this project. Thanks again for the contribution 🙂 |
Thanks for cleaning it up, I never expected it to go in as-is. Another option for reducing excessive contrast could be to add up to two classes, one for tags lighter than, say 160, and one for those lighter than 96, instead of only one for the 128 midpoint. The first would only get dark text in the light theme, and the second would get dark text in the dark theme. |
The theme doesn't really affect this. It's more like deciding where to put the "switch". Currently it's 50-50, but maybe it would look better with 60-40, or whatever. I don't know. I'll probably do some checks with middle colors at some point, but for now, it works. |
No, it really does. The perception of how dark or light something is is relative to its surroundings. See this classic example for proof. The two-class option would mean only switching to the other text colour when absolutely necessary. |
I found that many tags are difficult to read due to lack of contrast between the white text specified in the CSS and the random background colours, e.g.:
These could be improved by dynamically assessing the brightness of the tag colour, and applying a different text colour, e.g.:
Here's an untested draft of my idea to fix it. Feedback would be appreciated as I don't know TypeScript.