Skip to content

Commit f7733a9

Browse files
committed
Make databar and text color independent of eachother
1 parent 0cab21d commit f7733a9

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

packages/grid/src/DataBarCellRenderer.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,8 @@ class DataBarCellRenderer extends CellRenderer {
146146

147147
context.save();
148148
context.textAlign = textAlign;
149-
if (hasGradient) {
150-
const color =
151-
value >= 0 ? dataBarColor[dataBarColor.length - 1] : dataBarColor[0];
152-
context.fillStyle = color;
153-
} else {
154-
context.fillStyle = Array.isArray(dataBarColor)
155-
? dataBarColor[0]
156-
: dataBarColor;
157-
}
149+
context.fillStyle =
150+
model.colorForCell(modelColumn, modelRow, theme) || theme.textColor;
158151
context.textBaseline = 'middle';
159152
context.font = theme.font;
160153

@@ -230,6 +223,10 @@ class DataBarCellRenderer extends CellRenderer {
230223
context.restore(); // Restore gradient translate/scale
231224
} else {
232225
// Draw normal bar
226+
const barColor = Array.isArray(dataBarColor)
227+
? dataBarColor[0]
228+
: dataBarColor;
229+
context.fillStyle = barColor;
233230
context.beginPath();
234231
context.roundRect(dataBarX, dataBarY, dataBarWidth, rowHeight, 1);
235232
context.fill();

0 commit comments

Comments
 (0)