I have block that I would like the client to be able to choose between two colours, which would add a css class to a div. From which I can then use css to change the colour, background-colour and link colors etc. I presume this is possible?
Here’s my block Blueprint:
name: Image | Text
preview: fields
wysiwyg: true
fields:
text: fields/writercustomised
color:
type: color
mode: options
options:
"rgb(243, 239, 228)": "Ecru"
"rgb(33, 18, 24)": "Chocolate"
And here’s my block snippet:
<div class="row <?= $block->color() ?>">
...
</div>
I was hoping it would add the class “ecru” or “chocolate” to my div, but instead it is adding the hex code:
<div class="row #f3efe4">
...
</div>
Is it possible to add a name, rather than the hex code?