sylvainjule / kirby-color-palette

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

Structured color themes and Query option #10

Closed jesuismaxime closed 5 years ago

jesuismaxime commented 5 years ago

Is there a way to achieve a structured color theme using the query option ?

Even try to use a collection to convert my data to a valid YAML but doesnt work

// $kirby->collection("settings/palettes");

return function ($site) {

    $return = [];

    $palettes = $site
        ->find('configuration')
        ->children()
        ->find('settings')
        ->site_palettes()
        ->toStructure();

    foreach( $palettes as $palette ):

        $return[$palette->handle()->value()]['background_color'] = $palette->background_color()->value();
        $return[$palette->handle()->value()]['text_color'] = $palette->text_color()->value();

    endforeach;

    return YAML::encode($return);
};
sylvainjule commented 5 years ago

Unfortunately I don't think there's a way for now, Kirby automatically discards non-scalar values. I'll open an idea ticket.