First, "colour codes", aka hex values, have no absolute meaning. The values, whether stored in hexadecimal, integer, or float, represent an encoded value with respect to a given colourspace. Frequently, with display referred imagery downloaded from the web, this is sRGB. In a plethora of many other contexts however, it is not sRGB, hence the values have no absolute meaning.
Second, it sounds like you are having issues with a understanding the conversion of a display referred image to a display linear version, via an inversion of the encoded values transfer curve. There are a few posts here regarding that. The TL;DR is that the RGB values will represent linearized (display linear in cases where you are using an encoded PNG or JPEG, for example) values.
Third, bear in mind that while some values are labeled "Diffuse Colour" in shaders for example, they represent nothing of the sort, but rather a float ratio from zero to one of reflectance with angle math, also known as an albedo. Here, "Diffuse Colour" is a misleading term, and may have imagers conflating an albedo for an intensity triplet.
Finally, bear in mind that file formats are not created equally, nor are their implementations consistent across applications and libraries. A file format can store a variety of different imaging alpha channel encodes, colour spaces, and encoding formats.
The solution would be to take your encoded colour values and linearize them. If you are using an emission shader, bear in mind that in scene referred terms, there is no ceiling value and the dynamic range is from zero to infinity.