I select colour #0033ff and get colour #3d58a7 in a CMYK Photoshop file. What could be happening?
I am working on this CMYK file and until today all colours could be selected and everything was working fine. Today I decide to give it a bright blue background, and select shade #0033ff.
I see a little warning sign near the 'new' colour in the colour picker window: it says out of gamut for printing, and offers me random dark blues like #3e5aa9 or #3d5ba9 in a tiny square below the warning sign.
What is happening? This had never happened before, how can I prevent this?
To put it simply, #0033ff is outside of the range of colours CMYK is able to represent. Because of this, Photoshop can't store that colour in your image which uses a CMYK colour space.
It has therefore substituted it with a suitable alternative approximate colour prior to applying it to your CMYK document.
If you need to preserve the colour #0033ff in the document, the document would need to be RGB. Specifically, HTML/CSS colours are represented in the sRGB colour space, so sRGB would be able to reproduce all colours that could be specified as HTML/CSS hex colours.
If you need to store the document as CMYK, understand that the limited gamut of CMYK, particularly in deeply saturated reds and blues, means you won't be able to store precisely this colour in it.
Here is a comparison of an RGB and CMYK colour gamut - that is, the range of colours each can represent:
Notice how there are some deep red, deep green and deep blue colours that cannot be represented in the CMYK gamut. But on the other hand, the CMYK does extend further into some other areas like yellow/orange and cyan/blue-green, that RGB doesn't extend to.
Note: The image is only a rough approximation. Also, because you're viewing this on an RGB display, you cannot actually see any colours outside the RGB gamut, so realise that the colours in that diagram aren't intended as accurate.