RGB formula mode can use the “Limit the Color Matching to current Gradient” to restrict placed colours to those in the current gradient.
It’d be cool if the was made a global paint setting so that it could be used anywhere that blending is performed, such as with antialiasing, airbrush, soften, etc. to prevent pollution with unwanted colours.