Kirby-color-palette – Color choice for image captions

Hi- I’ve just installed ‘kirby-color-palette’ and I’m trying to use this plugin to give options for text colors on image captions (for legibility). For each individual image in the carousel, you have the option to choose 1 color for the caption out of 3 color choices.

I’ve put these configurations in the file blueprint, but now need to reference it somehow?
Am I missing something important? Is this actually possible to do, or is there another way to achieve what I’m after?
I have a very basic understanding of php so any advice on this would be ace…

Thanks so much!

Hi @serenachen, welcome to our forum :wave:!

If you have this information in the file blueprint, then you can access it via the file object, in your example within the loop with $media:

$palette = $media->palette()->yaml();
$color   = $palette['text'] ?? '';

On a side note: It greatly helps if you could post code as code snippet rather than as screenshot, because then we can copy/paste and change more easily. Thank you!

Super helpful thank you!

And thanks for the tip on including examples as code snippets, will do for future posts :slight_smile:

1 Like