Just want to be able to populate the color palette more dynamically with variables rather than do it by hand. I already use Michael Paul Bourne’s script that turns palette colours into variables I can reference but it would be nice to somehow populate the palette for new builds with the things I always use on each site.
1 Like
Great question. Try the following filter if your looking for something that applies to a “Theme” section like in the image. I’ll make a note to add some docs on this, didn’t know about this first one.
add_filter("cs_colors_extend", function() {
return [
[
"title" => __("Accent"),
"value" => "rgb(255, 0, 0)",
"_id" => "accent",
]
];
});

Alternatively if you set the wp_option cornerstone_color_items with JSON that is slashed you can setup values that go into “Palette”. Let me know if this helps!
if (empty(get_option('cornerstone_color_items', null)) {
// Array would be your colors similar to the first example
$stored = wp_slash( json_encode( [] ) );
update_option( 'cornerstone_color_items', $stored );
}
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.