@@ -31,6 +31,8 @@ interface RangeCellProps {
3131 readonly step : number ;
3232 readonly label ?: string ;
3333 readonly measureLabel ?: string ;
34+ /* The color of the range, fallback to theme.accentColor. */
35+ readonly color ?: string ;
3436}
3537
3638export type RangeCell = CustomCell < RangeCellProps > ;
@@ -50,7 +52,7 @@ const renderer: CustomRenderer<RangeCell> = {
5052 isMatch : ( c ) : c is RangeCell => ( c . data as any ) . kind === "range-cell" ,
5153 draw : ( args , cell ) => {
5254 const { ctx, theme, rect } = args ;
53- const { min, max, value, label, measureLabel } = cell . data ;
55+ const { min, max, value, label, measureLabel, color } = cell . data ;
5456
5557 const x = rect . x + theme . cellHorizontalPadding ;
5658 const yMid = rect . y + rect . height / 2 ;
@@ -75,8 +77,9 @@ const renderer: CustomRenderer<RangeCell> = {
7577 if ( rangeWidth >= rangeHeight ) {
7678 const gradient = ctx . createLinearGradient ( x , yMid , x + rangeWidth , yMid ) ;
7779
78- gradient . addColorStop ( 0 , theme . accentColor ) ;
79- gradient . addColorStop ( fillRatio , theme . accentColor ) ;
80+ const fillColor = color ?? theme . accentColor ;
81+ gradient . addColorStop ( 0 , fillColor ) ;
82+ gradient . addColorStop ( fillRatio , fillColor ) ;
8083 gradient . addColorStop ( fillRatio , theme . bgBubble ) ;
8184 gradient . addColorStop ( 1 , theme . bgBubble ) ;
8285
0 commit comments