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

Improve labels coloring and displaying in dark mode #901

Closed
xplosionmind opened this issue Jun 29, 2022 · 12 comments
Closed

Improve labels coloring and displaying in dark mode #901

xplosionmind opened this issue Jun 29, 2022 · 12 comments
Assignees

Comments

@xplosionmind
Copy link

Labels should be readable regardless of the color and of the theme. In this screenshot, it appears that, for example, that blue labels are not well readable in dark mode.

Screen Shot 2022-06-29 at 10 01 08 AM

@jacksonh
Copy link
Contributor

Thanks @xplosionmind yeah we have a better algorithm on iOS that takes into account the colour + the mode. I noticed GitHub does this too, where it will sometimes invert the text colour.

@rupin90
Copy link
Contributor

rupin90 commented Jun 29, 2022

Do we have predefined colors based on different themes? Is there a mapping of colors according to theme?

@jacksonh
Copy link
Contributor

@rupin90 right now we don't the colour can be user specified, but on iOS I believe @satindar has an algorithm for determining what the font colour should be based on the label colour and the them. You can kind of see how GitHub does this too, but changing themes and seeing how the labels are rendered.

@satindar
Copy link
Contributor

On iOS we calculate the Luminance value and if it's less than 0.5 we consider it a dark color and use a white text color.

This seems like the way to calculate the same with JS:

https://gist.github.com/jfsiii/5641126

@rupin90
Copy link
Contributor

rupin90 commented Jun 29, 2022

Wow, thank you 🙏

@jacksonh
Copy link
Contributor

jacksonh commented Jul 8, 2022

Hey Rupin, your PR improves things a lot but I think we might want to adopt something like GitHub where it switches between filled and outlined based on theme. I'm working out the rules now, but here are two screenshots:
Screen Shot 2022-07-08 at 12 00 27

Screen Shot 2022-07-08 at 12 00 48

@rupin90
Copy link
Contributor

rupin90 commented Jul 8, 2022

@jacksonh - Yeah true. What I understood is

  • in light theme, user selected colors applied as a background instead as a text. If the background is dark then the text color is white, if background is light then text color is black.
  • in dark theme, user selected colors applied as a text (with border and a translucent background). There is definitely a lightness threshold that is brightening the text even more!
    • exception with Black color is that - it is applied as a background with white text.

@rupin90
Copy link
Contributor

rupin90 commented Jul 8, 2022

Final outcome to implement

  1. The label outline -
  • border in dark theme
  • No border in light theme
  1. The background color -
  • Dark theme
    • translucent/low opacity user selected color with brightened border.
  • Light Theme
    • user selected color with full opacity
  1. Foreground color -
  • Dark theme
    • user selected label color is the text color
  • Light theme
    • if user selected dark color then text is white
    • if user selected light color then text is black

@rupin90
Copy link
Contributor

rupin90 commented Jul 10, 2022

Do we already have a way to set the background color? - this is for the light theme.

@jacksonh
Copy link
Contributor

@rupin90 I think for light theme its just as simple as setting the background color to the label color.

@jacksonh
Copy link
Contributor

Duplicated here: #555 -- will close that one out.

@rupin90
Copy link
Contributor

rupin90 commented Jul 14, 2022

I am closing this issue since the PR is merged.

@rupin90 rupin90 closed this as completed Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants