{% comment %} Renders a swatch component. Accepts: - swatch: {Object} a swatch object - shape: {String} swatch shape. Accepts 'square', defaults to circle. Usage: {% render 'swatch', swatch: value.swatch shape: 'square' %} {% endcomment %} {%- liquid assign swatch_value = nil if swatch.image assign image_url = swatch.image | image_url: width: 50 assign swatch_value = 'url(' | append: image_url | append: ')' elsif swatch.color assign swatch_value = 'rgb(' | append: swatch.color.rgb | append: ')' endif -%}