I have a linear gradient like below: linearGradient
HTML object after created haves:
childNodes: NodeList(7)
0: <stop offset="0%" stop-color="#0080ff">
1: <stop offset="7.142857142857142%" stop-color="#00ff00">
2: <stop offset="21.428571428571427%" stop-color="#ffff00">
3: <stop offset="35.714285714285715%" stop-color="#ffa500">
4: <stop offset="57.14285714285714%" stop-color="#ff0000">
5: <stop offset="78.57142857142857%" stop-color="#8A2BE2">
6: <stop offset="100%" stop-color="#800080">
javascript object like:
myGradient = {
20: "#0080ff",
25: "#00ff00",
35: "#ffff00",
45: "#ffa500",
60: "#ff0000",
75: "#8A2BE2",
90: "#800080"
}
How can i inverse a RGB color back to value like example: RGB(255, 124, 0) => 57?
I have searched but answers were % of linear gradient to rgb. Not rgb back to value. Many thanks!