>>> _hex_to_rgb("007fff")
    (0, 127, 255)
489238
def _hex_to_rgb(hex_code):
    
    if len(hex_code) != 6:
        raise ValueError(hex_code + " is not a string of length 6, cannot convert to rgb.")
    return tuple(map(ord, hex_code.decode("hex")))
83398
def rgb_to_hex(color):
    
    rgb = eval(color.replace('rgb', ''))
    # return '#'+''.join(map(chr, rgb)).encode('hex')
    return '#' + ''.join(['{0:02x}'.format(x).upper() for x in rgb])
73362
def color_to_hex(color):
    """"""
    if color is None or colorConverter.to_rgba(color)[3] == 0:
        return 'none'
    else:
        rgb = colorConverter.to_rgb(color)
        return '#{0:02X}{1:02X}{2:02X}'.format(*(int(255 * c) for c in rgb))
390379
def _hex_to_rgb(color: str) -> Tuple[int, ...]:
        
        if color.startswith('#'):
            color = color.lstrip('#')
        return tuple(int(color[i:i + 2], 16) for i in (0, 2, 4))
339958
def fw_int_to_hex(*args):
    
    return binascii.hexlify(
        struct.pack('<{}H'.format(len(args)), *args)).decode('utf-8')
762083
function rgb(hexStr) {
  const hex = hexStr.replace(/^#/, '');
  const fullHex = hex.length === 3
    ? `${hex[0]}${hex[0]}${hex[1]}${hex[1]}${hex[2]}${hex[2]}`
    : hex;

  const num = parseInt(fullHex, 16);
  // eslint-disable-next-line no-bitwise, no-mixed-operators
  return [num >> 16, num >> 8 & 255, num & 255].join(', ');
}
503444
def rgb2term(r: int, g: int, b: int) -> str:
    
    return hex2term_map[rgb2termhex(r, g, b)]
1068650
def rgb_color_list_to_hex(color_list):
    
    color_list_rgb = [[int(x*255) for x in c[0:3]] for c in color_list]
    color_list_hex = ['#{:02X}{:02X}{:02X}'.format(rgb[0], rgb[1], rgb[2]) for rgb in color_list_rgb]
    return color_list_hex
750825
def hex_to_rgb(color):
    
    color = normalize(color)
    color = color[1:]
    # return 'rgb'+str(tuple(ord(c) for c in color.decode('hex')))
    return 'rgb' + str((int(color[0:2], base=16), int(color[2:4], base=16), int(color[4:6], base=16)))
523069
function rgbaToHex(r, g, b, a) {

            var hex = [
                pad2(convertDecimalToHex(a)),
                pad2(mathRound(r).toString(16)),
                pad2(mathRound(g).toString(16)),
                pad2(mathRound(b).toString(16))
            ];

            return hex.join("");
        }
895542
function _0xColorToHex(color, convertToStr) {
        var hexColor = tinycolor(color.replace("0x", "#"));
        hexColor._format = "0x";

        if (convertToStr) {
            return hexColor.toString();
        }
        return hexColor;
    }
105436
def rgb2hex(r: int, g: int, b: int) -> str:
    
    return '{:02x}{:02x}{:02x}'.format(r, g, b)
1172086
function ( hex, parse ) {
            var hex = hex.replace( '#', '' ),
                result = {};
    
            if ( hex.length < 5 ) hex = hex.charAt(0) + hex.charAt(0) + hex.charAt(1) + hex.charAt(1) + hex.charAt(2) + hex.charAt(2);
    
            ( '#' + hex ).replace( this.REG_HEX, function ( str, va, vb, vc ) {
                var r = Number( '0x' + va ).toString( 10 ),
                    g = Number( '0x' + vb ).toString( 10 ),
                    b = Number( '0x' + vc ).toString( 10 );
    
                result = {r: Number(r), g: Number(g), b: Number(b), a: 1};
            });
    
            return parse? result : 'rgb(' + result.r + ', ' + result.g + ', ' + result.b + ')';
        }
994112
def colorRGB(r, g, b):
        
        return (float(r / 255), float(g / 255), float(b / 255))
993013
def hexdump(x, dump=False):
    
    s = ""
    x = bytes_encode(x)
    x_len = len(x)
    i = 0
    while i < x_len:
        s += "%04x  " % i
        for j in range(16):
            if i + j < x_len:
                s += "%02X " % orb(x[i + j])
            else:
                s += "   "
        s += " %s\n" % sane_color(x[i:i + 16])
        i += 16
    # remove trailing \n
    s = s[:-1] if s.endswith("\n") else s
    if dump:
        return s
    else:
        print(s)
56690
def _hexvalue_to_rgb(hexvalue):
        
        r = int(hexvalue[0:2], 16)
        g = int(hexvalue[2:4], 16)
        b = int(hexvalue[4:6], 16)

        return (r, g, b)
91869
def hex_to_rgb(hex_value):
    
    if '#' in hex_value:
        hex_value = hex_value.replace('#', '')
    if len(hex_value) < 6:
        return '0000/0000/0000'
    r = hex_value[:2]
    g = hex_value[2:4]
    b = hex_value[4:]
    return r + '00/' + g + '00/' + b + '00'