Skip to content

Colour Predicate Format

ioblackshaw edited this page Jul 5, 2025 · 7 revisions

Colour Predicates are used in some tests in the when part of a Colour Override Definition. They can be used for more powerful colour checks such as; matching against a range of colours, matching against sign text colours, etc.

Below is an example of the eg_text_customiser:sign_dye colour predicate specified as the color test in the when part:

"color": {
    "type": "eg_text_customiser:sign_dye",
    "dye": "orange"
}

JSON Format

Colour Predicates are defined with a type field, alongside additional fields specified by the predicate type

Field Format Examples
type The resource location of a colour predicate type "eg_text_customiser:sign_dye" "eg_text_customiser:simple"
<type specific fields> Additional fields specified by the colour predicate type

Colour Predicate Types

Below are all the currently supported colour predicate types

eg_text_customiser:simple

Performs a simple equality check on a colour

JSON Format

Additional Fields Format Examples Notes
value A hexadecimal colour string, RGB integer list in 0-255 range, or Named colour "#ff00ff" [255,128,0] "red"
match_named_colors Boolean value (defaults to true) true If true, named colours are converted to hex before comparison. This means "#ffffff" and "white", for example, will match the same pieces of text. If false, named colours are not converted before comparison, meaning "#ffffff" and "white" will not match the same pieces of text

eg_text_customiser:sign_dye

Matches specifically against text on a sign. All fields are optional, any omitted fields will always match.

This predicate type will never match if used in shadow_color. It is technically possible to specify it in shadow_color, however this is not recommended and is a bit pointless

JSON Format

Additional Fields Format Examples Notes
dye A dye colour name "brown" "red" If this field is omitted, the predicate will match against any dye colour
glowing Boolean value (defaults to false) true If true, matches if the sign is glowing with a glow ink sac applied. If false, matches if the sign is not glowing
is_glowing_outline Boolean value (defaults to false) true If true, matches only the text outline if the sign is glowing. If false, matches the inner non-outline part of text

eg_text_customiser:range

Matches against a range of colours.

This predicate works per colour channel, for example "min": [0, 0, 20], and "max": [255, 0, 40] will match any colour whose red channel is between 0 and 255, green channel is 0, and blue channel is between 20 and 40. This works the same for hexadecimal strings, however it is recommended to use RGB integer lists as they are slightly easier to understand in this context

JSON Format

Additional Fields Format Examples Notes
min A hexadecimal colour string or RGB integer list in 0-255 range "#ff00ff" [255,128,0]
max A hexadecimal colour string or RGB integer list in 0-255 range "#ff00ff" [255,128,0]
match_named_colors Boolean value (defaults to true) true If true, named colours are converted to hex and included in the comparison. If false, named colours are not converted or included in the comparison