@blanchsb the HEX values are everywhere in Blender linear:
Mathematically, 0.5 should be converted to 127 or 0F, but that is probably why 0.5 is added to the values after having been multiplied by 255….But still, pretty much linear.
The RGB color in the Texture Paint Brush is also linear, so there a formula like Brecht uses should work for the conversion, but not when using sRGB, because sRGB is not linear! And sRGB is used in for instance the Shader Editor.
Theoretically, sRGB is equal to RGB to the power of 2.2 (‘Gamma’) but the actual transformation is using a lesser power near Black and something like 2.4 near white values…I do not know what transformation (from linear to sRGB ) Blender uses internally, but that is what gets yourr values off probably…the decimal to Hex conversion is straightforward and doesn’t depend on software.