Hex to RGB

Convert a hex color code to RGB values.

Code

Utilities
h = hex.delete('#')
return { r: h[0,2].to_i(16), g: h[2,2].to_i(16), b: h[4,2].to_i(16) }

Parameters

The hex color code.

Server

More Ruby Snippets