# How to use Color Field in template?

**URL:** <https://forum.getkirby.com/t/how-to-use-color-field-in-template/32358>\
**Category:** Questions\
**Created:** [August 30, 2024, 2:51pm UTC](https://forum.getkirby.com/t/how-to-use-color-field-in-template/32358 "2024-08-30T14:51:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![m-e](https://avatars.discourse-cdn.com/v4/letter/m/54ee81/32.png) [@m-e](https://forum.getkirby.com/u/m-e)\
**Post date:** [August 30, 2024, 2:51pm UTC](https://forum.getkirby.com/t/how-to-use-color-field-in-template/32358/1 "2024-08-30T14:51:06Z")

</div>

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:

```auto
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:

```auto
<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:

```auto
<div class="row #f3efe4">
...
</div>

```

Is it possible to add a name, rather than the hex code?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [August 30, 2024, 3:07pm UTC](https://forum.getkirby.com/t/how-to-use-color-field-in-template/32358/2 "2024-08-30T15:07:14Z")

</div>

> [@m-e](#):
>
> Is it possible to add a name, rather than the hex code?

No, you can only get that information from the blueprint: [Accessing blueprints | Kirby CMS](https://getkirby.com/docs/cookbook/unclassified/blueprints-in-frontend)

---

<div class="post-metadata">

**Author:** ![m-e](https://avatars.discourse-cdn.com/v4/letter/m/54ee81/32.png) [@m-e](https://forum.getkirby.com/u/m-e)\
**Post date:** [August 30, 2024, 3:13pm UTC](https://forum.getkirby.com/t/how-to-use-color-field-in-template/32358/3 "2024-08-30T15:13:13Z")

</div>

Okay, will probably use the Radio or Toggle field instead then. Thanks
