hex to rgb

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

hex to rgb v12.0.6

Converts a hex color code into rgb/a

In pins 1
  • hex required
    value

    Hex color code to convert. Accepts: rgb, #rgb, rrggbb, #rrggbb, rrggbbaa, #rrggbbaa

Out pins 4
  • success
    condition
  • rgb
    value

    Returns the color code in the following format: rgb()

  • rgba
    value

    Returns the color code in the following format: rgba()

  • rgba
    array

    Returns the color code in the following format: [r, g, b, a]

Strips ALL non-hex characters first (# may appear anywhere), then requires exactly 3, 4, 6 or 8 hex digits (4/8 carry alpha). Alpha is emitted as a 0-1 float rounded to 2 decimals (default 1). On any other digit count condition is false and rgb/rgba/array are NOT written. Example: "#0F08" -> rgba(0,255,0,0.53).

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

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

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