inception icon indicating copy to clipboard operation
inception copied to clipboard

Define color rule based on a specific non-visible feature

Open jfiala opened this issue 2 years ago • 3 comments

Coloring rules currently are matched against the displayed label.

However, we have a few coloring rules and that makes the label a bit crowded, as we have to display every field as a value. E.g. we color outdated values grey, but we have to add that field to the label so we can use coloring rules (see value "true"). Here it would be much more convenient to use the fieldname outdated in the coloring rule: outdated="true"

Current sample configuration for coloring rules: grafik

Example of annotated document (Stelleninserat): grafik

jfiala avatar Jun 21 '23 20:06 jfiala

It is not a low hanging fruit and would require quite a bit of refactoring.

The thought that led to the current implementation was that involving the feature names would make the rules quite a bit more complex. If only individual key/value pair rules would be allowed, then the risk of multiple rules theoretically matching a single annotation may be high and might cause a desire for having multi-colored labels (which I think would not be a good direction to go in). Or alternatively, complex conditions with and/or would need to be supported - which would also not be easy to configure or implement. The regex seemed to provide a good compromise.

But yes, for your case, I see how a simple key/value coloring rule mechanism would help, in particular because you do now wish to display the color trigger in the label at all.

reckart avatar Jul 12 '23 21:07 reckart

I think having the option to use expressions with field names would be sufficient. With ordering it simply takes the first matching rule. No need for multiple matches/colors, that would make things too complex.

So adding field names to the regex would be perfect, IMHO that should be quite easy to do?

jfiala avatar Jul 13 '23 08:07 jfiala

It may look easier than it is. At the point in the rendering process where the color is applied, the information about the values of individual features is no longer accessible. This would first need to be changed before a field name could be added to the regex rules.

reckart avatar Jul 16 '23 13:07 reckart