How set Hex in RGB Node? (Python) Currently looking at the blender API I haven't seen anything of all about the Hex input.
This is frustrating me enough as it seems strange to me that there is no such input function (when Blender natively has it, where it is enough to simply copy and paste).

Now, the point of the situation is that all the scripts I tried, incorrectly convert Hex to RGB (Including some answers those present in other questions about blender.stackexchange).

Basically the conversion from Hex to RGB produces a Hex value different from the Input value, and this is not good, I need absolute precision on these Hex values

I see that it is gamma corrected, now, I don't know much about Hex, so I don't want to comment too much, but I just wish that what I get is the same thing I get by copying an Hex in the RGB node

The most beautiful thing would be to be able to directly input the Hex input value in the RGB node, that gives me exactly the result I want.
Hex values are interpreted in the sRGB color space, while Blender uses a linear RGB color space internally.  The conversion functions can be found on the sRGB Wikipedia page.  The hex channel values themselves (0-255) should be divided by 255 before application of the formulas.  A pure Python implementation looks like this:

def srgb_to_linearrgb(c):
    if   c &lt; 0:       return 0
    elif c &lt; 0.04045: return c/12.92
    else:             return ((c+0.055)/1.055)**2.4

def hex_to_rgb(h,alpha=1):
    r = (h &amp; 0xff0000) &gt;&gt; 16
    g = (h &amp; 0x00ff00) &gt;&gt; 8
    b = (h &amp; 0x0000ff)
    return tuple([srgb_to_linearrgb(c/0xff) for c in (r,g,b)] + [alpha])


and using it like so:

bpy.data.materials["Material"].node_tree.nodes["RGB"].outputs[0].default_value = \
    hex_to_rgb(0x123456)


seems to work correctly.