Purpose

The ColorFromName editor allows the definition of regular expressions with colors and transparencies. These expressions are checked against the string from Input String To Filter and - if any of the expressions match - assign a the color to that string. The matching expression, color, and transparencies as well as a status field are available as output fields such that they can easily be used to propagated them to other modules and fields via field connections.

Notes:

  • The first matching expression is used and set in the matching fields.
  • Therefore it is useful to add the specific expressions first and the general expressions at the end of the list.
  • Using ‘.*’ as final expression can be useful to define a default color for all non matching strings.

Windows

Default Panel

../../../Modules/ML/MLColorFromName/mhelp/Images/Screenshots/ColorFromName._default.png

Parameter Fields

Visible Fields

Current Filter Expression

name: currentColorExpression, type: String, default: .*

The editable regular expression objects set in the current selected row by Color Row Index.

Current Color

name: currentColor, type: Color, default: 0 0 0

The editable color set in the current selected row by Color Row Index.

Current Transparency

name: currentTransparency, type: Float, default: 0, minimum: 0, maximum: 1

The editable transparency set in the current selected row by Color Row Index.

Add Color Row

name: addColorRow, type: Trigger

Inserts a new expression with the values from Current Color and Current Transparency at Color Row Index.

Delete Color Row

name: deleteColorRow, type: Trigger

Removes the row indexed by Color Row Index.

Move Row Up

name: moveRowUp, type: Trigger

Moves the selected row one line up, or - if it is at top position - to the end of the list. CTRL-Up is the keyboard accelerator for this.

Move Row Down

name: moveRowDown, type: Trigger

Moves the selected row one line down, or - if it is at last position - to the beginning of the list. CTRL-Down is the keyboard accelerator for this.

Color Row Index

name: colorRowIndex, type: Integer, default: 0

Indexes the currently edited row in expression + color + transparency list.

Expressions And Color List

name: expressionsAndColorList, type: String

The list of regular expressions with editable colors with lines of type ‘expr ## R G B A’ with R,G,B,A from [0,1].

Input String To Filter

name: inputStringToFilter, type: String

The input string to be filtered with the regular expressions and from which the color and transparency shall be determined.

Matching Color Expression

name: matchingColorExpression, type: String

Output string showing the regular expression from the Expressions And Color List if any is matching, otherwise set to an empty string.

Matching Color

name: matchingColor, type: Color, default: 1 1 1

Output field showing the color from the Expressions And Color List if any is matching, otherwise set to white.

Matching Alpha

name: matchingAlpha, type: Float, default: 0

Output field showing the transparency from the Expressions And Color List if any is matching, otherwise set to 0.

Is Valid

name: isValid, type: Bool, default: FALSE

Boolean set to true if any expression from Expressions And Color List is matching, otherwise set to false. It is set after all other matching fields are set.