How can I add a border to all color swatches on my product pages?

Topic summary

A user needs to add borders to color swatches on product pages because white swatches are invisible against the white site background, and partially white swatches look unappealing.

Two solutions were provided:

Solution 1 (Made4uo-Ribe):

  • Navigate to Shopify admin → Online Store → Themes → Actions → Edit code
  • Open the Assets folder and locate base.css, style.css, or theme.css
  • Add CSS at the bottom:
.color-swatch:checked + .color-swatch.is-selected {
  border-color: red;
}
.color-swatch.rounded-full {
  border: 1px solid black;
}
  • This adds black borders to all swatches and a red border to selected ones (colors customizable)

Solution 2 (PageFly-Henry):

  • Go to Online Store → Theme → Edit code
  • Search for theme.css file
  • Add at bottom:
a.color-swatch.rounded-full {
  border: 1px solid !important;
}

Both approaches involve adding CSS to apply borders to color swatch elements. The original poster was advised to mark the helpful solution.

Summarized with AI on November 15. AI used: claude-sonnet-4-5-20250929.

Hi guys,

On our product pages, we have colour swatches like shown below, sometimes using html colour codes and sometimes using files (for the multi-coloured products). The white color swatch is invisible because the main background colour of our site is white, and we also don’t like the look of the colour swatches that are half white. How can I add a thin black line to all swatches, not just the selected colour (grey in the example below)?

I would appreciate your help.

URL: https://cradlestudio.de/products/100-baumwolle-piquee-kissen-007-pebble

1 Like

Hi @zieglj

Here a thing, when you selected a color there is a border color black. What I did I colored it red. and the none selected color black border. You can change the color you like.

  • From your Shopify admin dashboard, click on “Online Store” and then “Themes”.
  • Find the theme that you want to edit and click on “Actions” and then “Edit code”.
  • In the “Assets” folder, click on “base.css, style.css or theme.css” file, depending on which file your theme uses to store its CSS styles. At the bottom of the file, add the following CSS code:
:checked+.color-swatch, .color-swatch.is-selected {
    border-color: red;
}
.rounded-full {
    border: 1px solid black;
}

Please don’t forget to Like and Mark Solution to the post that helped you. Thanks!

Hi @zieglj

This is Henry from PageFly - Landing Page Builder App

You can try this code by following these steps:

Step 1: Go to Online Store->Theme->Edit code.

Step 2: Search file theme.css

Step 3: Paste the below code at bottom of the file → Save

a.color-swatch.rounded-full {

border: 1px solid !important;

}

Hope that my solution works for you.

Best regards,

Henry | PageFly