Re: color_darken no longer working with variables. Anyone else?

color_darken no longer working with variables. Anyone else?

cate_
Visitor
1 0 1

I had a snippet in my code:

 

style="background-color: {{ collection.metafields.custom_fields.color | color_darken: 4 }};"

 

that had been working perfectly up until yesterday evening. Now, I only see a color if I remove "color_darken: 4". I've tested and color_darken still works, but only so long as I only use it with a hex string, and not a variable that evaluates to a hex string.

Has anyone else noticed this change in functionality? Or is it a bug that I might be able to fix?

Reply 1 (1)

willryanuk
Shopify Partner
5 0 0
For darken_color to work, I needed to pass a color string, not a colour object (from the metafield). Seems mad, but that's what works.
 
{% capture my_color %}{{ product.metafields.test.accent_colour }}{% endcapture %}
{% assign my_darkened_color %}{{my_color | color_darken: 4 }}{% endcapture %}