fix: DH-21616: use model text color instead of databar color for cell text #2629
fix: DH-21616: use model text color instead of databar color for cell text #2629gzh2003 wants to merge 3 commits intodeephaven:mainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2629 +/- ##
==========================================
+ Coverage 49.48% 49.77% +0.28%
==========================================
Files 772 774 +2
Lines 43738 43777 +39
Branches 11066 11262 +196
==========================================
+ Hits 21643 21788 +145
+ Misses 22077 21971 -106
Partials 18 18
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This was a stylistic choice. However, I agree that explicitly setting a color should override it. Does this code still maintain that choice, if I make a purple, or gradient bar with no explicit text color set, is the color still the same as it was? |
| const textColor = model.colorForCell(modelColumn, modelRow, theme); | ||
| if (textColor && textColor !== theme.textColor) { |
There was a problem hiding this comment.
This isn't really correct, as we may return a green/red colour for positive/negative numbers.
Instead, we should be looking if a colour is set explicitly in the Format. E.g.
const format = model.formatForCell(...);
if (format?.color != null && format?.color != '') {
...
} else if (hasGradient) {
For DH-21616. Previously,
DataBarCellRendererused the databar fill color for both the bar and the text, ignoring any explicit text color set viaTableFormat.color.Now calls
model.colorForCell()to check for an explicit text color. If one is set, it takes precedence over the databar color for text rendering. When no explicit text color is set, the text still inherits the databar color.