-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
web ui: Tweak colors in the dark theme to improve contrast ratio #11068
Conversation
Some colors from the dark theme used in the query editor have a very low contrast ratio with the background. Signed-off-by: Jorge Luis Betancourt Gonzalez <jorge-luis.betancourt@trivago.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, yes that looks much better! Just a nit comment.
should be fixed now, when the input component was focused it applied an additional style via a |
Co-authored-by: Julius Volz <julius.volz@gmail.com> Signed-off-by: Jorge Luis Betancourt Gonzalez <jorge-luis.betancourt@trivago.com>
Signed-off-by: Jorge Luis Betancourt Gonzalez <jorge-luis.betancourt@trivago.com>
966c8f9
to
ca6e147
Compare
|
||
'.cm-matchingBracket, &.cm-focused .cm-matchingBracket': { | ||
color: '#1e293b', | ||
backgroundColor: '#cbd5e1', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. But in dark mode, the cursor is now very low contrast in comparison to the bright background of the parentheses it is on, making it hard to spot. How about making that background color just a tad less bright, like the #767676
one we have for selections?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true, with #767676 the contrast ratio between the highlighted text and the background is a bit too low (not critical IMHO considering that this not really for reading, but more for highlighting a position within the query). We could also make the text color completely white or black to make it easier to read. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point. Looking at how it works for the light mode and playing with that, it would be nice to do the equivalent of that for dark mode:
- Don't override the text color at all (keep it at its default white-ish tone), and the boldness still gets added anyway.
- Set the background color to something subtle relative to the black background, like
#616161
.
So basically remove the color
line above and do backgroundColor: #616161
. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, removing the color
and using the new background color provides a good enough contrast in this case.
Signed-off-by: Jorge Luis Betancourt Gonzalez <jorge-luis.betancourt@trivago.com>
👍 Nice, thanks! |
…metheus#11068) * Tweak colors in the dark theme to improve contrast Some colors from the dark theme used in the query editor have a very low contrast ratio with the background. Signed-off-by: Jorge Luis Betancourt Gonzalez <jorge-luis.betancourt@trivago.com> * Avoid duplicated function call when in dark mode Co-authored-by: Julius Volz <julius.volz@gmail.com> Signed-off-by: Jorge Luis Betancourt Gonzalez <jorge-luis.betancourt@trivago.com> * Apply styles for the matching bracket when focused in dark mode Signed-off-by: Jorge Luis Betancourt Gonzalez <jorge-luis.betancourt@trivago.com> * Improve style of the matching brackets when focused Signed-off-by: Jorge Luis Betancourt Gonzalez <jorge-luis.betancourt@trivago.com> Co-authored-by: Julius Volz <julius.volz@gmail.com>
@@ -239,3 +277,19 @@ export const promqlHighlighter = HighlightStyle.define([ | |||
{ tag: tags.invalid, color: 'red' }, | |||
{ tag: tags.comment, color: '#888', fontStyle: 'italic' }, | |||
]); | |||
|
|||
export const darkPromqlHighlighter = HighlightStyle.define([ | |||
{ tag: tags.name, color: '#000' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, we just found out that this caused #11568. We are accidentally setting the text color to black on black here. Will send a fix.
The color should not be set explicitly at all. That way it simply inherits the theme's default color, as before prometheus#11068. Fixes prometheus#11568 Signed-off-by: Julius Volz <julius.volz@gmail.com> Signed-off-by: Julius Volz <julius.volz@gmail.com>
Some colors from the dark theme used in the query editor have a very low contrast ratio with the background.
For reference these are some of the colors from the
promqlHighlighter
with their respective contrast ratio calculated using the background color from boostrap-dark (#191D21
):The low contrast was more noticeable with the red color(s) used for the label names.
The screenshots shown the result after applying the changes included in this PR. On top of the changes to the colors used in the editor I've also tweaked a couple of additional colors for checkboxes of the top and for the query stats.
before:
![image](https://user-images.githubusercontent.com/1291846/181497225-9bc882f3-4f02-4f10-9e5b-2d53588ab02a.png)
after:
![image](https://user-images.githubusercontent.com/1291846/181498579-5c2c56f3-ea26-4d67-9c40-345fb7ab84c1.png)
Signed-off-by: Jorge Luis Betancourt Gonzalez jorge-luis.betancourt@trivago.com