RGBtoHex

grizli.utils.RGBtoHex(vals, rgbtype=1)[source]

Converts RGB values in a variety of formats to Hex values.

Parameters
valstuple

An RGB/RGBA tuple

rgb_typeint
Valid valus are:
  • 1 = Inputs are in the range 0 to 1

  • 256 = Inputs are in the range 0 to 255

Returns
hextstrstr

A hex string in the form ‘#RRGGBB’ or ‘#RRGGBBAA’

References

(credit: Rychard @ https://stackoverflow.com/a/48288173)