I want to split the linear-gradient value into object with key and value.
I have it:
linear-gradient(10deg,#111,rgba(111,111,11,0.4),rgba(255,255,25,0.1))
And I want it to be like this:
linear-gradient: { angle: '10deg', color1: '#111', color2: 'rgba(111,11,11,0.4)', color3: 'rgba(255,255,25,0.1)', }
EDITED: I tried my code without success:
var str = 'linear-gradient(10deg,#111,rgba(111,111,11,0.4),rgba(255,255,25,0.1))'; str = str.match("gradient\((.*)\)"); str = str[1].split(','); console.log( str );