You can only get and keep the correct hex colours in RGB Color Mode. Basically, the hex colours are RGB colours, only with hex names.
The reason is that when you are in CMYK Color Mode, the RGB colours are changed to the closest match (CMYK) in gamut colour as soon as you blink.
You may try stop blinking.
If you are lucky, the changes do not occur/get apparent before you do something else, such as deselecting/reselecting, saving/reopening, etc.
In any case, they are inevitable, just waiting to jump at you as soon as you relax.
Actually, you get corresponding colour changes when you use CMYK colours in RGB Color Mode.
You will have to work in the right Color Mode, or suffer the consequences. This means that you may have to choose between incorrect RGB/hex colours or incorrect CMYK colours. The decision depends on which is worse.
If your artwork is for both print and web/similar use, you may work in CMYK to get that as correct as possible, and then make a special RGB version with corrected RGB colours; in the latter, the changes in CMYK colours are unavoidable in any case
2 people found this helpful
Said another way:
You have three color values in RGB (each expressed as a decimal number, 0 through 255).
You have three color values in Hexidecimal (each expressed as two characters, 00 through FF).
So there is an unambiguous numerical correlation between RGB and Hex.
There are also three color values in CMY (each expresed as a percentage).
So there is an unambiguous numerical correlation between RGB, Hex, and CMY.
But CMY is inadequate. So in print, we throw in K to broaden the capabilities.
But there are four color values in CMYK. How do you convert three values into four?
Answer: In any of a practically infinite number of ways. So there is no single, unambiguous correlation between the three values of RGB or Hex and the four of CMYK.