Skip to main content
Participant
January 21, 2022
Answered

Change color outside the stage on Canvas HTML document?

  • January 21, 2022
  • 1 reply
  • 225 views

I'm wondering if it's possible to change the standard white background outside the stage when publishing as a Canvas HTML5 doc?

 

This topic has been closed for replies.
Correct answer JoãoCésar17023019

Hi.

 

That's the body's background color. You can change its color using JavaScript or CSS.

 

Here are two ways of changing it using JS (you can place the code in the first frame of the main timeline):

document.body.style.backgroundColor = "red"; // any valid css color

// OR

document.body.style.backgroundColor = lib.properties.color; // if you want the body to have the same background color as the stage

 

If you want/need to change the color before your content loads, then you're gonna need to use CSS and for this you have to either modify the published HTML file or use a publish template.

 

I hope this helps.

 

Regards,

JC

1 reply

JoãoCésar17023019
Community Expert
JoãoCésar17023019Community ExpertCorrect answer
Community Expert
January 21, 2022

Hi.

 

That's the body's background color. You can change its color using JavaScript or CSS.

 

Here are two ways of changing it using JS (you can place the code in the first frame of the main timeline):

document.body.style.backgroundColor = "red"; // any valid css color

// OR

document.body.style.backgroundColor = lib.properties.color; // if you want the body to have the same background color as the stage

 

If you want/need to change the color before your content loads, then you're gonna need to use CSS and for this you have to either modify the published HTML file or use a publish template.

 

I hope this helps.

 

Regards,

JC