sylvainjule / kirby-color-palette

A color palette to pick colors from in the panel. Kirby 3 only.
57 stars 9 forks source link

display all options in the template #29

Open Jorckx opened 1 year ago

Jorckx commented 1 year ago

Hi! to start, great plugin! I'm just wondering how to output all options (not the selected one) to a template. I want to create a sample-page for my client who uses different page-colour-options.

MichaelvanLaar commented 1 year ago

Same here. I would like to create custom CSS properties in the head section of the page from all values of a central brand-color field blueprint. This way I could let editors choose brand colors in the panel when needed (e.g. for info box backgrounds), and at the same time have all brand colors available for CSS rules – while only having one central place for defining brand colors to keep everything DRY.

I tried to apply the info from https://getkirby.com/docs/cookbook/templating/fetching-field-options to the following (demo) field setup:

type: color-palette
label:
  en: Brand Colors
  de: Markenfarben
options:
  red:
    lightMode: "#fecaca"
    darkMode: "#991b1b"
    contrastLightMode: "#000000"
    contrastDarkMode: "#ffffff"
  black:
    lightMode: "#000000"
    darkMode: "#ffffff"
    contrastLightMode: "#ffffff"
    contrastDarkMode: "#000000"
  white:
    lightMode: "#ffffff"
    darkMode: "#000000"
    contrastLightMode: "#000000"
    contrastDarkMode: "#ffffff"
display: duo
unselect: true

But I only get the error message Undefined array key "lightMode", even if I just try to var_dumpall info from the optionsof the field.