rgb to hex

This block is part of the value group and was last modified in core v12.0.6.

rgb to hex v12.0.6

Converts rgb color codes into hex

In pins 2
  • rgba required
    value

    Accepts the rgba color code in the following format: rgba() or rgb() • Hidden when other fields are filled

  • rgba required
    array

    Accepts the rgba color code in the following format: [r, g, b, a] • Hidden when other fields are filled

Out pins 3
  • success
    condition
  • hex
    value

    Returns the hex color code in the following format: #rrggbb

  • hex (opacity)
    value

    Returns the hex color code in the following format: #rrggbbaa

Prefers the array pin ([r,g,b,a]); otherwise extracts the numbers found in an rgb()/rgba() string. Missing components default to r=0 g=0 b=0 a=1; r/g/b are rounded and clamped to 0-255, alpha is clamped to 0-1. Outputs lowercase "#rrggbb" on value and "#rrggbbaa" on hexopacity; condition is ALWAYS true -- it never signals a parse failure.

A typical wiring for rgb to hex: the condition out pin feeds branch.

Studio canvas example for the rgb to hex block: typical wiring for rgb to hex.

Version history

Introduced in v12.0.6.


Back to value Return to the main group to view all sub-groups Back to value Return to the group to view all blocks within this group