File tree Expand file tree Collapse file tree
plugins/ui/src/js/src/elements/UITable Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -402,21 +402,28 @@ class UITableModel extends IrisGridModel {
402402 negativeColor = this . colorMap . get ( negativeColor ) ?? negativeColor ;
403403 }
404404
405- const formatColor = this . getFormatOptionForCell (
405+ const barColor = value >= 0 ? positiveColor : negativeColor ;
406+ const hasGradient = Array . isArray ( barColor ) && barColor . length > 1 ;
407+ const formatTextColor = this . getFormatOptionForCell (
406408 columnIndex ,
407409 rowIndex ,
408410 'color'
409411 ) ;
410- const textColor =
411- formatColor != null
412- ? this . colorMap . get ( formatColor ) ?? formatColor
413- : undefined ;
412+
413+ let textColor : string ;
414+ if ( formatTextColor != null ) {
415+ textColor = this . colorMap . get ( formatTextColor ) ?? formatTextColor ;
416+ } else if ( hasGradient ) {
417+ textColor = value >= 0 ? barColor [ barColor . length - 1 ] : barColor [ 0 ] ;
418+ } else {
419+ textColor = Array . isArray ( barColor ) ? barColor [ 0 ] : barColor ;
420+ }
414421
415422 return {
416423 columnMin : minRowValue ,
417424 columnMax : maxRowValue ,
418425 axis,
419- color : value >= 0 ? positiveColor : negativeColor ,
426+ color : barColor ,
420427 // @ts -expect-error TODO: bump web version
421428 textColor,
422429 valuePlacement,
You can’t perform that action at this time.
0 commit comments