sylvainjule / kirby-color-palette

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

Any way to get the key of structured field? #5

Closed macx closed 5 years ago

macx commented 5 years ago

I'm using the structured version. Is there any way to get the key (for example "default" or "alternative") of the selected option?

Or is there an option to save the key and not the values? Then I could style my content within the stylesheet as theme instead of using inline styles.

My options:

options:
  default:
    background: '#FFFFFF'
    text: '#3F3F3F'
  alternative:
    background: '#ECEFF1'
    text: '#3F3F3F'
  disruptor:
    background: '#0028DC'
    text: '#FFFFFF'
  laufcampus:
    background: '#25AB1C'
    text: '#FFFFFF'

Stored as:

theme:
  background: '#ECEFF1'
  text: '#3F3F3F'

Would be nice to get:

theme: alternative

If I set the key-value pair under background and text, I get what I want, but it's not automatic

theme:
  background: '#ECEFF1'
  text: '#3F3F3F'
  key: alternative
sylvainjule commented 5 years ago

This is the current way to achieve this (adding a custom key-value pair), I will look into adding the option.

sylvainjule commented 5 years ago

The key of a structured color is now automatically saved alongside its colors.