Shopify themes, liquid, logos, and UX
Hi,
I am trying to add borders around all colour swatches so that lighter colours are more obvious against a light background. I would also like to add a check mark in the selected option so that it is obvious what is selected.
Is this possible?
I have tried contacting the developers but they only suggested changing the White colour to off-white so that it shows up, but this is not an acceptable solution.
Many thanks in advance.
Add borders to all swatches via CSS for visibility, use a selected class with a checkmark (::after), and toggle it dynamically with JavaScript for user interactivity.
Kindly let me know if you need any more further enhancement or guides, I'll be always open to help!
Hi @Chris032009
Please share the link to your store
It would be easier if you could allow me to view your current store url.
However, I tested this with the default Habitat theme and added some custom CSS.
Here are the steps:
.variations
.product-form__input--color
input[type="radio"]:checked
+ label:before {
content: "✓";
position: absolute;
top: -2px;
right: -2px;
background: #2e8b57;
color: #fff;
border-radius: 50%;
display: inline-block;
width: 16px;
height: 16px;
text-align: center;
line-height: 16px;
z-index: 10;
text-indent: 0;
}
Hope this custom code is helpful to you!
Hi,
Thank you so much for this. So it shows on the Preview in the Customisor, but when I hit Save I get the error message 'Online Store editor session can not be published'. Also, the tick mark is cut off slightly:
Actually, the tick now appears in full now that I have added inventory but the borders are not showing and I still can not save the changes:
It seems that the method of adding custom code might be limited. You can try the following approach instead:
<style>
.variations .product-form__input--color input[type=radio]+label {
box-shadow: 0 0 0 1px var(--color-border) inset;
}
.variations
.product-form__input--color
input[type="radio"]:checked
+ label:before {
content: "✓";
position: absolute;
top: -2px;
right: -2px;
background: #2e8b57;
color: #fff;
border-radius: 50%;
display: inline-block;
width: 16px;
height: 16px;
text-align: center;
line-height: 16px;
z-index: 10;
text-indent: 0;
}
</style>
Let me know if you need further assistance!
Thanks!
So I added that in and have the following result (I think the borders are too light against the background):
How can I change the colour of the borders so that they are all black and the selected colour is different? Say, red?
Hi @Chris032009
General Code for All Colors
To set the border color for all color options, you can use the following code:
.variations .product-form__input--color input[type=radio]+label {
box-shadow: 0 0 0 1px var(--color-border) inset;
}
.variations .product-form__input--color input[type=radio]+label {
box-shadow: 0 0 0 1px #000000 inset;
}
Custom Code for Specific Colors
If you need to customize the border for a particular color, add this code:
.variations .product-form__input--color input[type=radio][value=White]+label {
box-shadow: 0 0 0 1px red inset;
}
Hi @Chris032009
Please kindly share the store URL ❤️
Best,
Daisy
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024