Start with the warning's background and text size, then check contrast for the actual pair. A dramatic red or yellow may fail on a dark surface or become tiring in small text.
Use a clear label or icon so color is not the only signal. Test normal, hover, and disabled states if the warning is interactive. Keep warning colors consistent across the product so readers do not have to relearn their meaning.
What background and font size will the warning use?