tr_hex_to_rgb
{* $hexadecimal_color - type: string, example: '#ffffff', needs to have 6 characters *}
{tr_hex_to_rgb($hexadecimal_color)}
Converts HEX to RGB
Takes a 6 characters hexadecimal color as an input and prints a string representation of its RGB format.
For example: {tr_hex_to_rgb('#ffffff')}
, would echo “255, 255, 255”.
One of the use-cases where this would be useful is when our backend returns the color in hexadecimal format, and we want to get its RGB values so we can wrap them in a rgba()
CSS function, to be able to manipulate its alpha value.