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
TablePanel/StatPanel: Fix values not being visible when background transparent #55092
Conversation
const a = tcolor.getAlpha(); | ||
|
||
if (a < 0.3) { | ||
return themeIsDark ? 'rgb(247, 248, 250)' : 'rgb(32, 34, 38)'; |
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.
Isn't the b > 180
basically the same thing as themeIsDark
? I'm asking because this is a breaking change of the getTextColorForBackground
function since the themeIsDark
is required.
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.
As far as I understand, the b
component is strictly related to the background color hex code and does not take into account what the theme settings are. I understand that this is a breaking change. In this case I guess the cleanest solution is to create a new function that takes the transparency component into account and use that internally.
Drone build failed: https://drone.grafana.net/grafana/grafana-enterprise/33372 |
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.
LGTM!
Drone build failed: https://drone.grafana.net/grafana/grafana-enterprise/33925 |
What this PR does / why we need it:
Fixes issue where alpha value of a color was not taken into consideration and caused Table cells and Stat panels to show text colored as the background rendereding it invisible. This happened when the background color was set to transparent and the text color was dark, which triggered the text color to be white. If the Grafana theme was also set to light then both the background and the text would be white and thus invisible.
Which issue(s) this PR fixes:
Fixes #39781