It's more of a "Colors shouldn't be the only means to convey information".
But use colors sparingly, especially when dealing with accessibility; it could quickly become a huge mess to make it work for colorblind people; and it's pretty common to be colour-blind.
This might sound like a rant, because I'm not sure how to convey that, considering it's something that's very focused on one's different perception (due to brain/eye stuff) of the world.
I'm of the opinion that things, particularly text, items and backgrounds, shouldn't be colored (unless it's tactful).
If you make a warning box (background and/or text) red or orange, who's to say the person is going to see it in that color, or be able to read it even? Same for blue informational boxes, and other colors.
Really, the best way is to not use the color as the means to information, but more as a "hint". And if you do use colors, please don't mix them together, and focus on luminance, not chroma.
For example, an already-visited link being brighter than a non-visited link, is a nice hint. The way "tags" are displayed in this forum are very readable due to good contrast, and white/dark gray being primary elements.
If you wanna emphasize text, there's many ways to decorate the text (bold, changing the font, italic, underlines, ...) but using different colors is most often not a good option.
But if you're gonna have a red background with green text, good luck with getting me to read it (a shop sign near where I live is actually designed like this, and I cannot read it). Prioritise white themes, as they tend to be the most accessible, and will lead to usually more contrasted color choices; then add a dark mode.
Most websites and interfaces tend to be designed in a kind of monochrome way, and it works out for accessibility, but also in terms of not tiring the eyes.
One thing I could suggest is using "colorblind simulators", but I don't know how effective they are. Honestly, the best way is: the simpler, the better. Using unstylised HTML is the best way to be accessible for everyone, at least in terms of colorschemes (but probably also for screenreaders)