colorpicker.html 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. {% comment %}
  2. {% assign id = include.id | default: 'default' %}
  3. {% assign alpha = include.alpha | default: false %}
  4. {% assign format = include.format | default: false %}
  5. <input type="text" class="form-control d-block{% if include.class %} {{ include.class }}{% endif %}" id="colorpicker-{{ id }}" value="{{ include.value }}" />
  6. {% capture_global scripts %}
  7. <script>
  8. // @formatter:off
  9. document.addEventListener("DOMContentLoaded", function () {
  10. {% if env == 'development' %}
  11. window.tabler_colorpicker = window.tabler_colorpicker || {};
  12. {% endif %}
  13. window.Coloris && ({% if env == 'development' %}window.tabler_colorpicker["colorpicker-{{ id }}"] = {% endif %}Coloris({
  14. el: "#colorpicker-{{ id }}",
  15. selectInput: false,
  16. alpha: {% if alpha %}true{% else %}false{% endif %},
  17. {% if format %}format: "{{ format }}",{% endif %}
  18. {% if include['swatches-only'] %}swatchesOnly: true,{% endif %}
  19. swatches: [
  20. "#0054a6",
  21. "#45aaf2",
  22. "#6574cd",
  23. "#a55eea",
  24. "#f66d9b",
  25. "#fa4654",
  26. "#fd9644",
  27. "#f1c40f",
  28. "#7bd235",
  29. "#5eba00",
  30. "#2bcbba",
  31. "#17a2b8",
  32. ],
  33. }))
  34. })
  35. // @formatter:on
  36. </script>
  37. {% endcapture_global %}
  38. {% endcomment %}