Convert hex to rgb
Description:
This function accepts a hexadecimal color value and returns an object containing the separate red, green, and blue component values.
{
"type": "colors",
"action": "hex_to_rgb",
"args": {
"hex": "#ff0000",
"target": "$data.rgb"
}
}
Convert hex to rgba
Description:
This function accepts a hexadecimal color value and returns an object containing the separate red, green, blue and alpha component values.
{
"type": "colors",
"action": "hex_to_rgba",
"args": {
"hex": "#ff0000ff",
"target": "$data.rgb"
}
}
Convert hex to normalized rgba
Description:
Transform a hex color value into an object with properties for the red (r), green (g), blue (b), and alpha (a) channels. However, instead of these values ranging from 0 to 255, they are normalized to a scale of 0 to 1.
{
"type": "colors",
"action": "hex_to_normalised",
"args": {
"hex": "#ff0000ff",
"target": "$data.rgba"
}
}
Convert rgb object to a hex value
Description:
Convert an RGB object into a hexadecimal color value.
{
"type": "colors",
"action": "rgb_to_hex",
"args": {
"r": 255,
"g": 0,
"b": 0,
"target": "$data.hex"
}
}
Convert rgba object to hex value
Description:
Convert RGBA object into a hexadecimal color value.
{
"type": "colors",
"action": "rgba_to_hex",
"args": {
"r": 255,
"g": 0,
"b": 0,
"a": 255,
"target": "$data.rgba"
}
}
Convert rgb text to hex value
Description:
This function converts a string formatted as rgb(255, 255, 255)
or rgba(255, 255, 255, 1)
into a hexadecimal color string.
{
"type": "colors",
"action": "rgb_text_to_hex",
"args": {
"value": "rgb(255, 0, 0)",
"target": "$data.hex"
}
}
Convert css color value to hex
Description:
Retrieve a CSS variable and convert its value to a hexadecimal color string.
{
"type": "colors",
"action": "css_to_hex",
"args": {
"element": "document.body",
"variables": ["--primary-color", "--secondary-color"],
"target": "$data.hex"
}
}
The result of this action is a dictionary where the key is the variable name and the value is the hex value.
Convert css color to normalized
Description:
Extract a CSS variable and transform it into an RGB object with normalized values.
{
"type": "colors",
"action": "css_to_normalized",
"args": {
"element": "document.body",
"variables": ["--primary-color", "--secondary-color"]
}
}
This action yields a dictionary where each key is the name of a CSS variable, and the corresponding value is another dictionary. This nested dictionary contains keys for ‘r’, ‘g’, ‘b’, and ‘a’, each holding normalized values.