Skip to content

Instantly share code, notes, and snippets.

@liamgriffin
Created January 30, 2024 08:41
Show Gist options
  • Save liamgriffin/35d698ed5f998de9cd11d31669cef7f5 to your computer and use it in GitHub Desktop.
Save liamgriffin/35d698ed5f998de9cd11d31669cef7f5 to your computer and use it in GitHub Desktop.
Color Swatches Picker Logic
if value.swatch.image
assign image_url = value.swatch.image | image_url: width: 50
assign swatch_value = 'url(' | append: image_url | append: ')'
elsif value.swatch.color
assign swatch_value = 'rgb(' | append: value.swatch.color.rgb | append: ')'
else
assign swatch_value = nil
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment