Changing background color of page template, Enterprise theme

I would like some help in changing the background color of my page templates, I need the main page and product/collection pages to keep their white background but would like other pages to have an all black one. I see no option to do this other than changing everything to black in theme settings so I assume it needs a custom CSS.

https://www.thenutritionsuperstore.com/pages/the-protein-shakery (site is still mostly a WIP)

Thank you

Hi @christarver2102

Here is the step to achieve it:

1: on your theme.liquid search for <body and you would see something like this: <body class="… make is like this <body class"template_{{ template }} …

  1. right above body you will see the right above the head add the below code

#000 represents black colour and you can replace it with any cooler you need.

Thanks

@christarver2102

Please add the following CSS to your assets/main.css bottom of the file.

body {background-color: #000 !important; color:#fff !important;}
.font-body {color: #fff !important;}
.text-theme-text {color: #fff !important;}

Thanks!

Hello @christarver2102 ,

You can try to follow these steps:

Go to Online Store → Themes → Actions → Edit code

Go to Assets folder → base.css file or theme.scss.liquid file

Add this following code at the bottom of page

body.template-index,
body.template-product,
body.template-collection { 
  background-color: #fff;
}

body.template-page.your-page-handle {
  background-color: #000;
}

Save and preview

Hope this can help.

Transcy

do i replace “your-page-handle” with the name of the page i want to change?

also I cannot find base.css file or theme.scss.liquid in the assets folder

this changed the entire site to black, not the specific pages

I cant locate anything that says <body class in the theme.liquid folder

ok I did find the above the <body part but when i added the code you put it just changed every background on the site to black, i dont think my templates are named in the way you typed.