06-02-2018 11:43
06-02-2018 11:43
Changing the fill attribute on a rect element works fine:
if (data.colorBackground) {
bGround.style.fill = data.colorBackground;
}But I cannot find an equivalent for changing a gradient-color[1/2] attribute of a gradientRect element:
if (data.colorBackground) {
bGroundGrade.style.gradientColor1 = data.colorBackground;
}Produces: Unhandled TypeError: Cannot set property 'gradientColor1' of undefined
Meanwhile,
if (data.colorBackground) {
bGroundGrade.gradientColor1 = data.colorBackground;
}doesn't throw an error, but neither does it change my background gradient color.
Any help would be appreciated, thanks!
Answered! Go to the Best Answer.
Best Answer06-05-2018 17:40
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
06-05-2018 17:21
06-05-2018 17:21
Hey, I'm going through the same thing and will definitely find an answer somehow. I'll let you know what I discover, if anything. Do you have any idea how to change the viewport-fill of an SVG by chance? Pretty similar problem.
Best Answer06-05-2018 17:40
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
06-05-2018 17:40
Try:
bGroundGrade.gradient.colors.c1 = data.colorBackground;
06-05-2018 18:14
06-05-2018 18:14
That worked wonderfully, thank you. Any hints on changing the viewport fill color?
Best Answer06-05-2018 19:08
06-05-2018 19:08
I decided that I can just use a rect across the entire background and change its .style.fill property instead.
Best Answer