You can use matplotlib ListedColormap as follows:
import numpy as np import seaborn as sns from matplotlib.colors import ListedColormap data = np.random.randint(-1, 2, (10,10))
which gives:

You can replace the strings with 'green', 'yellow', 'red' hexadecimal colors such as '#FF0000' (equivalent to 'red' ) or rgb colors like (1.,0.,0.) (Also equivalent to 'red' ).
source share