Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Emulating plotly's contour map color distribution

I have a contour map generated with plotly.js and I am using this as the colorscale:

colorscale: [[“0”, “rgb(0,0,0)”], [“0.3”, “rgb(230,0,0)”], [“0.6”, “rgb(255,210,0)”], [“1”, “rgb(255,255,255)”]]

I have another legacy map not generated with plotly and I want the colors of that to match the plotly map. In the legacy map I have the rangeMin and rangeMax and the binSize (although the binSize is not currently used). It currently determines the color for each value like this, in python:

COLORS = (’#ff9’, ‘#ff0’, ‘#fc0’, ‘#f90’, ‘#f60’, ‘#f00’, ‘#930’, ‘#800000’)
normal = (value - rangeMin) / (value_max - rangeMax)
ordinal = int(normal * len(COLORS))
if ordinal == len(self.COLORS):
ordinal -= 1
color = COLORS[ordinal]

I am looking for some advice on how I can modify this to generate the same colors as plotly would, given the same data set and range and bin size. I am free to modify either the plotly and/or the python code, but I do want the color set currently used in plotly to continue to be used.