Skip to content

Instantly share code, notes, and snippets.

@dpw1
Created March 6, 2024 22:44
Show Gist options
  • Save dpw1/157e9ab00467e7d31102a03f633484a0 to your computer and use it in GitHub Desktop.
Save dpw1/157e9ab00467e7d31102a03f633484a0 to your computer and use it in GitHub Desktop.
{% if settings.enable_ezfy_badges_color %}
<style>
{% comment %}EZFY Variables Liquid [start]{% endcomment %}
{% assign sales_badge_background_color = settings.sales_badge_background_color %}
{% assign sales_badge_text_color = settings.sales_badge_text_color %}
{% assign sales_badge_text_size_desktop = settings.sales_badge_text_size_desktop %}
{% assign sales_badge_text_size_mobile = settings.sales_badge_text_size_mobile %}
{% assign sold_out_badge_background_color = settings.sold_out_badge_background_color %}
{% assign sold_out_badge_text_color = settings.sold_out_badge_text_color %}
{% assign sold_out_text_size_desktop = settings.sold_out_text_size_desktop %}
{% assign sold_out_badge_text_size_mobile = settings.sold_out_badge_text_size_mobile %}
{% assign sales_badge_background_color_all_pages = settings.sales_badge_background_color_all_pages %}
{% assign sales_badge_text_color_all_pages = settings.sales_badge_text_color_all_pages %}
{% assign sales_badge_text_size_desktop_all_pages = settings.sales_badge_text_size_desktop_all_pages %}
{% assign sales_badge_text_size_mobile_all_pages = settings.sales_badge_text_size_mobile_all_pages %}
{% assign sold_out_badge_background_color_all_pages = settings.sold_out_badge_background_color_all_pages %}
{% assign sold_out_badge_text_color_all_pages = settings.sold_out_badge_text_color_all_pages %}
{% assign sold_out_text_size_desktop_all_pages = settings.sold_out_text_size_desktop_all_pages %}
{% assign sold_out_badge_text_size_mobile_all_pages = settings.sold_out_badge_text_size_mobile_all_pages %}
{% comment %}EZFY Variables Liquid [end]{% endcomment %}
/* ## Collection page and sections (change badges color/font size)
https://ezfycode.com/blog/dawn-theme-how-to-customize-badges-color-and-size
================================== */
.card .badge[class*="accent"],
.card .badge[class*="inverse"],
.product .badge[class*="sale"],
.product .badge[class*="sold"] {
border-color: transparent !important;
}
/* Sale badge (collections) on desktop */
.card .badge[class*="accent"]:not([class*="inverse"]) {
background: {{sales_badge_background_color_all_pages}} !important;
color: {{sales_badge_text_color_all_pages}} !important;
font-size: {{ sales_badge_text_size_desktop_all_pages }}px !important;
}
/* Sold out badge (collections) on desktop */
.card .badge[class*="inverse"]:not([class*="accent"]) {
background: {{sold_out_badge_background_color_all_pages}} !important;
color: {{sold_out_badge_text_color_all_pages}} !important;
font-size: {{ sold_out_text_size_desktop_all_pages }}px !important;
}
@media (max-width: 749px) {
/* Sale badge (collections) on mobile */
.card .badge[class*="accent"]:not([class*="inverse"]) {
font-size: {{ sales_badge_text_size_mobile_all_pages }}px !important;
}
/* Sold out badge (collections) on mobile */
.card .badge[class*="inverse"]:not([class*="accent"]) {
font-size: {{ sold_out_badge_text_size_mobile_all_pages }}px !important;
}
}
/* ## Product page (change badges color/font size)
https://ezfycode.com/blog/dawn-theme-how-to-customize-badges-color-and-size
================================== */
/* Sale badge (product page) on desktop */
.product .badge[class*="sale"] {
background: {{sales_badge_background_color}} !important;
color: {{sales_badge_text_color}} !important;
font-size: {{ sales_badge_text_size_desktop }}px !important;
}
/* Sold out badge (product page) on desktop */
.product .badge[class*="sold"] {
background: {{sold_out_badge_background_color}} !important;
color: {{sold_out_badge_text_color}} !important;
font-size: {{ sold_out_text_size_desktop }}px !important;
}
@media (max-width: 749px) {
/* Sale badge (product page) on mobile */
.product .badge[class*="sale"] {
font-size: {{ sales_badge_text_size_mobile }}px !important;
}
/* Sold out badge (product page) on mobile */
.product .badge[class*="sold"] {
font-size: {{ sold_out_badge_text_size_mobile }}px !important;
}
}
</style>
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment