Skip to content

Commit 9b3628e

Browse files
committed
Update ConsumerDefinition.cs
Only resolve Colorize when Qualification is set to Custom
1 parent 13cb5a8 commit 9b3628e

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

src/HierarchyGrid.Definitions/ConsumerDefinition.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,6 @@ public ResultSet Process(InputSet inputSet)
7171
{
7272
var data = Consumer is not null ? Consumer(inputSet.Input) : inputSet.Input;
7373

74-
var (background, foreground) = inputSet.CustomColors.Match(
75-
c => c,
76-
() => Colorize?.Invoke(data) ?? (Option<ThemeColor>.None, Option<ThemeColor>.None)
77-
);
78-
7974
/* A cell can't be edited if the whole producer is read-only, or if the IsLocked func returns true. */
8075
var locked = inputSet.IsLocked || (IsLocked != null && IsLocked(inputSet.Input, data));
8176

@@ -102,11 +97,22 @@ public ResultSet Process(InputSet inputSet)
10297
? RightDecor(inputSet.Input, data)
10398
: Option<string>.None;
10499

100+
// Only invoke a defined colorize when qualification is indeed set to Custom
101+
var qualifier = GetQualification(inputSet, data);
102+
var (background, foreground) =
103+
qualifier == Qualification.Custom
104+
? inputSet.CustomColors.Match(
105+
c => c,
106+
() =>
107+
Colorize?.Invoke(data) ?? (Option<ThemeColor>.None, Option<ThemeColor>.None)
108+
)
109+
: (Option<ThemeColor>.None, Option<ThemeColor>.None);
110+
105111
var resultSet = new ResultSet
106112
{
107113
ProducerId = inputSet.ProducerId,
108114
ConsumerId = ConsumerDefinitionId,
109-
Qualifier = GetQualification(inputSet, data),
115+
Qualifier = qualifier,
110116
Result = (Formatter is not null ? Formatter(data) : data.ToString()) ?? string.Empty,
111117
BackgroundColor = background,
112118
ForegroundColor = foreground,

0 commit comments

Comments
 (0)