{% if include.selector %}
  {% assign selector = include.selector %}
{% endif %}

{% if include.seed %}
  {% assign seed = include.seed %}
{% endif %}

<script src="https://cdnjs.cloudflare.com/ajax/libs/geopattern/1.2.3/js/geopattern.min.js"></script>
<script>
  function setRandomBgImage(selector, seed) {
    var pattern = GeoPattern.generate(seed);
    var element = document.querySelector(selector)
    if (element) {
      element.style.backgroundImage = pattern.toDataUrl();
    }
  }

  setRandomBgImage('{{ selector }}', '{{ seed }}');
</script>

