I have an integer which I need to convert to a color in javascript. I am using an MVC model and am trying to replicate a model in a software for a web interface. I have the color in integer format from the database. It needs to be converted to a color in javascript.
For example: integers like -12525360, -5952982
I have the code like this :
items[x].barStyle = "stroke: Black; fill = Red";
So instead of giving the fill:Red, I need to give it the exact color corresponding to the integer value.
This is the code I have written in C#. I need the same thing in javascript. Here resourcecolor= the integer input.
var bytes = BitConverter.GetBytes(resourcecolor);
ti.color = Color.FromArgb(bytes[3], bytes[2], bytes[1], bytes[0]);