Coloring rules

10 views
Skip to first unread message

Sebastian Haunss

unread,
May 3, 2022, 5:33:07 AM5/3/22
to incepti...@googlegroups.com
Hi,

I have a question about coloring rules for layers:

I have a layer with several features. Some features are of type Primitive: String.
Is it possible to set a coloring rule so that if one of these string features takes a certain value (e.g. "1") the color of the layer is set to e.g. green (#00ff00)? How would that rule look like?

Best
Sebastian

Richard Eckart de Castilho

unread,
May 3, 2022, 9:27:34 AM5/3/22
to inception-users
Hi Sebastian,

> On 3. May 2022, at 11:33, Sebastian Haunss <sebastia...@uni-bremen.de> wrote:
>
> I have a layer with several features. Some features are of type Primitive: String.
> Is it possible to set a coloring rule so that if one of these string features takes a certain value (e.g. "1") the color of the layer is set to e.g. green (#00ff00)? How would that rule look like?

The coloring rules are simply a list of regular expressions that is applied to the annotation label that is shown above the annotated text.
If you want to match a label that contains a "1" anywhere, you'd use ".*1.*" to match it. If the 1 could appear in different contexts and
you would only want to rule to apply in certain contexts of it appearing, you'd have to write your regular expressions such that it only
matches the "1" in those contexts that matter to you.

The rules are processed from top to bottom. So if you want to color say all annotations containing the "1" green and all others red, you'd say

".*1.*" -> Green
".*" -> Red

Cheers,

-- Richard

Sebastian Haunss

unread,
May 3, 2022, 10:36:20 AM5/3/22
to incepti...@googlegroups.com, Richard Eckart de Castilho
Hi Richard,

very nice, thanks, it works. From the description in the documentation I didn't understand that this is basically a grep pattern on the label. Looks like it is even possible to use the usual positional assumptions like ^ for "start of line"

Best
Sebastian

Am 03.05.22 um 15:27 schrieb Richard Eckart de Castilho:
--

Prof. Dr. Sebastian Haunss
Universität Bremen | SOCIUM - Forschungszentrum Ungleichheit und Sozialpolitik
Mary-Somerville-Str. 5, 28359 Bremen
+49 421 218-58572 | shaunss.ipgovernance.eu | PGP Key ID: 78732002
Office Hours: Wednesdays 11-12 h, Room 7.4530

Selected recent publications:
Reply all
Reply to author
Forward
0 new messages