Hi, I have an image that has a transparent background. I would like to change the background color of that image, with code.
eg.
if (X) = 2;
$w(‘my element’).style.backgroundColor = “#FFFFFF”;
Obviously this code doesnt work with an image, at least my image.
‘my element’ in this case is a transparent .jpg and i can achieve the effect I want by just selecting the format tab and changing the background. I just want this effect to be conditional.
Please help!
Hey! I’m not sure if it’s possible to do this conditionally directly on the image
That being said, if you want to change the colour of the bounding box, you could add the image to a container and set the container to max-c.
Then you can apply the style on the container which should show behind the image.
Be sure to change the background colour of the image to transparent. (It might work better with PNG images which retain transparent backgrounds)
Hi Noah, thank you for the reply. Your suggestion is what I ended up doing and the . style.ba ckgroundColor tags worked fine.