I want to change the white background color to any other color in Magento 2.

Magento 2 Luma image

How could I do it?


1 Answer 1


Magento uses the file called view.xml which is maintained at the theme level of the application.

So for example, if you are using the default theme luma you should find the view.xml under vendor/magento/theme-frontend-luma/etc/view.xml

In this file, you would see a node inside the node.

The background color of the images is maintained here under the node.

The id attribute value of the node is referenced in the codebase.

<image id="product_base_image" type="image">
    <background>[255, 0, 0]</background>

Once the values changes have been done, you will have to run

php bin/magento catalog:images:resize

Reference: https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/themes/theme-images.html

  • I did all those things. but not yet changed background color.
    – Priya
    Jan 3, 2019 at 5:35
  • which catalog image you need to update? please share with me view.xml in your them.
    – Sanju
    Jan 3, 2019 at 6:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.