I am looking to implement custom background colors for products, pages and collections using my template editor. Is there a way this can be done?
-
Log in to your Shopify admin and go to Online Store > Themes.
-
Click on the “Customize” button for the theme you want to edit.
-
In the left-hand menu, click on the “Theme settings” option.
-
Scroll down to the “Colors” section and click on the “Background” option.
-
Click on the “Select color” button to choose a color or enter a custom color code in the field provided.
-
If you want to apply the background color to all pages, products, and collections, click on the “Apply to all” checkbox. If you only want to apply the background color to specific pages, products, or collections, you can skip this step.
-
Click on the “Save” button to save your changes
If you want to apply a custom background color to a specific page, product, or collection, you can do so by editing the liquid templates for that page. Here’s how you can do it:
-
In the Shopify admin, go to Online Store > Themes.
-
Click on the “Actions” dropdown for the theme you want to edit and select “Edit code”.
-
Locate the liquid template file for the page, product, or collection you want to edit. For example, the “product-template.liquid” file is used for individual product pages.
-
Open the liquid template file and locate the HTML element that corresponds to the area you want to add the background color to. For example, the “body” tag might be used for the overall page background.
-
Add a “style” attribute to the HTML element and set the “background-color” property to the color you want to use. For example:
html:
<body style="background-color: #F8F8F8;"> -
Save the changes to the liquid template file.
Repeat this process for any other pages, products, or collections that you want to add a custom background color to. Note that if you’re not comfortable editing liquid templates, it’s a good idea to create a backup of your theme before making any changes.
-
I am using the “impulse” theme, and after following your instructions there only appears to be a .json file for the template I am trying to edit.
If you’re using the Impulse theme, you may need to locate and edit the appropriate JSON file to apply custom background colors to your products, pages, and collections. Here’s how you can do it:
- In your Shopify admin, go to Online Store > Themes.
- Click on the “Customize” button for the Impulse theme.
- In the left-hand menu, click on “Theme settings.”
- Click on “Colors.”
- Click on the “Select color” button to choose a color or enter a custom color code in the field provided.
- If you want to apply the background color to all pages, products, and collections, click on the “Apply to all” checkbox. If you only want to apply the background color to specific pages, products, or collections, you can skip this step.
- Click on the “Save” button to save your changes.
If you want to apply a custom background color to a specific page, product, or collection, you can do so by editing the appropriate JSON file in the theme editor.
-
In your Shopify admin, go to Online Store > Themes.
-
Click on the “Actions” dropdown for the Impulse theme and select “Edit code.”
-
In the left-hand menu, click on the folder for the type of template you want to edit. For example, if you want to edit the product template, click on “Sections” and then click on “product.liquid.”
-
Locate the JSON data for the element you want to add the background color to. For example, if you want to add a background color to the product description, you may need to edit the “product-description” JSON data.
-
Add a new key-value pair to the JSON data, like this:
json
"background-color": "#F8F8F8"Replace “#F8F8F8” with the color code you want to use.
-
Save the changes to the JSON file.
-
Preview your changes to make sure the background color is applied correctly.
Repeat this process for any other pages, products, or collections that you want to add a custom background color to. Note that if you’re not comfortable editing JSON data, it’s a good idea to create a backup of your theme before making any changes.
Hello @personalfears
I would like to give you the recommendation to support you so kindly follow steps below:
- Go to your Online store > Themes > Edit code
- Open your theme.liquid file
- Paste the below code before
I hope the above is useful to you.
Best regards,
GemPages Support Team
