as you know the RGB structure each parameter (red, green, and blue) defines the intensity of the color as an integer between 0 and 255., Actually, in Blender, you have that in sRGB, then any traditional convertion to HEX work BECAUSE the Hex in blender is GAMMA CORRECTED.
also in Documentation I can NOT get any reference about how get the HEX TRIPLE FOR COLOR CODE ...
how to get both with python?
I want the hex value or how convert the hex to RGB
AS @dr.Sybren I thougth That was just a straight conversion of the bytes in RGB order converted to hexadecimal notation, and then tried some simple code as @tet_ii
context = bpy.context obj = context.object color_inferior= obj.material_slots['inferior'].material.diffuse_color a = '#%02x%02x%02x' % (int(255.999 * pow(color_inferior.r, 1/2.2)),int(255.999 * pow(color_inferior.g, 1/2.2)),int(255.999 * pow(color_inferior.b, 1/2.2))) print(a)
testing the code I got:
also, I test other codes with the same or worst result:
then. Can I capture the value directly from blender without any convertion? or do a 100% accurate conversion?