Color Chooser

This component lets you pick a specific color. You could control which colors are available through simple yaml definition. Transparent and gradients are available in the same way.

 

Customizing

You'll find the ColorChooser in webresources\jsFields. Feel free to modify it to your needs.

If you want to add or remove some of the color choices you can add and remove them within the dialog definition.

backgroundColor:
  label: "Background Color"
  $type: javascriptField
  fieldScript: /magnolia-central-module/webresources/jsFields/colorSelector.html
  parameters:
    color1: 
      name: "primary"
      color: "#0d6efd"
    color2: 
      name: "secondary"
      color: "#6c757d"
    color3: 
      name: "success"
      color: "#198754"
    color4: 
      name: "info"
      color: "#0dcaf0"
    color5: 
      name: "warning"
      color: "#ffc107"
    color6: 
      name: "danger"
      color: "#dc3545"
    color7: 
      name: "dark"
      color: "#212529"
    color8: 
      name: "gradient"
      color: "linear-gradient(0deg, rgba(34,193,195,1) 0%, rgba(253,187,45,1) 100%)"
    color9: 
      name: "transparent"
      color: "transparent"