---
title: "Color"
description: "This article explains what the color field is and how to configure it."
meta_title: "Color"
category: "fields"
audience: developers
lastUpdated: "2025-11-06T01:07:50.000Z"
---

The color field allows content writers to select a color. The field is displayed as a color picker in the [Page Builder](https://prismic.io/docs/guides/page-builder.md).

The color is saved as a hex value, like `#FFFFFF`.

Color field values can be used anywhere hex color values are supported.

**Next.js example:**

```tsx
<span style={{ color: slice.primary.text_color }}>Hello!</span>
```

**Nuxt example:**

```vue-html
<span :style="{ color: slice.primary.text_color }">Hello!</span>
```

**SvelteKit example:**

```svelte
<span style={`color: ${slice.primary.text_color}`}>Hello!</span>
```

# Add a color field to a content model

1. **Open Slice Machine**

   In your Prismic project, start Slice Machine to begin editing content models.

   ```sh
   npx start-slicemachine --open
   ```

2. **Add a color field**

   In Slice Machine, navigate to the slice, page type, or custom type you want to modify. Add a **color** field.

   The **label** determines the label shown to content writers in the [Page Builder](https://prismic.io/docs/guides/page-builder.md). Use an easily understood name.

   The **API ID** determines the property name in the Content API. Use a short, snake-cased name.

# Use color fields

Color fields can be used anywhere hex color values are supported.

In this example, the `text_color` field determines the `<span>`'s color.

**Next.js example:**

```tsx
<span style={{ color: slice.primary.text_color }}>Hello!</span>
```

**Nuxt example:**

```vue-html
<span :style="{ color: slice.primary.text_color }">Hello!</span>
```

**SvelteKit example:**

```svelte
<span style={`color: ${slice.primary.text_color}`}>Hello!</span>
```

# Check if a color field has a value

Use `isFilled.color()` from [`@prismicio/client`](https://prismic.io/docs/technical-reference/prismicio-client/v7.md) to check if a color field has a value.

```ts
import { isFilled } from "@prismicio/client";

if (isFilled.color(slice.primary.my_color_field)) {
  // Do something if `my_color_field` has a value.
}
```

[Learn more about `isFilled`](https://prismic.io/docs/technical-reference/prismicio-client/v7.md#isfilled)

# API response

Here is what a color field looks like from the Content API:

```json
{
  "example_color": "#5B295F"
}
```
