I understand your HP Envy 5540 printer will not print in color,
I'll be glad to help you out, however, for an accurate solution I will need more details:
What operating system used with the printer?
Did you check if genuine HP cartridges are being used?
While you respond to that, here's what you need to do:
Step 1: Use genuine HP ink cartridges
HP recommends that you use genuine HP ink or toner supplies. HP cannot guarantee the quality or reliability of non-HP or refilled cartridges. If you do not use genuine HP cartridges, the steps in this document might not resolve the issue. To check the authenticity of your cartridges, go to hp.com/go/anticounterfeit.
Step 2: Check the estimated ink levels
Low ink can contribute to poor print quality. Check the estimated ink levels on the printer control panel, and then replace any low or empty ink cartridges.
Step 3: Replace any low or empty ink cartridges
Replace any critically low or empty ink cartridges, and then try to print again.