# Text color (span style color) in Confluence storage format

URL: https://goingstellar.ro/reference/confluence-storage-format/text-color/

Text colour is a span with a color style. The documentation uses rgb(255,0,0). Hex input is stored as rgb, a colour name is stored as a name until an ADF save turns it into rgb, and the old font tag does not survive an ADF save.

## Storage format

```xml
<span style="color: rgb(255,0,0);">red text</span>
```

## As ADF (Confluence Cloud)

The ADF that Confluence Cloud builds for:

```xml
<p><span style="color: rgb(255,0,0);">red text</span></p>
```

```json
{
 "type": "doc",
 "content": [
  {
   "type": "paragraph",
   "content": [
    {
     "text": "red text",
     "type": "text",
     "marks": [
      {
       "type": "textColor",
       "attrs": {
        "color": "#ff0000"
       }
      }
     ]
    }
   ]
  }
 ],
 "version": 1
}
```

## Examples

Storage format sent:

```xml
<p><span style="color: rgb(255,0,0);">red text</span></p>
```

The documented form. The view swaps the inline style for a legacy colour class.

Rendered view (HTML):

```html
<p><span class="legacy-color-text-red2">red text</span></p>
```

Storage format after the round trip through ADF:

```xml
<p><span style="color: rgb(255,0,0);">red text</span></p>
```

Sent to Confluence Cloud on 29 Nov 2026.

Storage format sent:

```xml
<p><span style="color: #ff5630;">hex</span> <span style="color: red;">name</span></p>
```

A hex colour and a colour name in one paragraph. Both are normalised to rgb values on the way through ADF.

Rendered view (HTML):

```html
<p><style>[data-colorid=ezh6gvm4nr]{color:#ff5630} html[data-color-mode=dark] [data-colorid=ezh6gvm4nr]{color:#cf2600}</style><span data-colorid="ezh6gvm4nr">hex</span> <span style="color: red;">name</span></p>
```

Storage format after the round trip through ADF:

```xml
<p><span style="color: rgb(255,86,48);">hex</span> <span style="color: rgb(255,0,0);">name</span></p>
```

Sent to Confluence Cloud on 29 Nov 2026.

Storage format sent:

```xml
<p><font color="red">font tag</font></p>
```

The old font element. Storage keeps it, and the ADF round trip removes it and leaves plain text.

Rendered view (HTML):

```html
<p><font color="red">font tag</font></p>
```

Storage format after the round trip through ADF:

```xml
<p>font tag</p>
```

Sent to Confluence Cloud on 29 Nov 2026.

Storage format sent:

```xml
ADF:{"content": [{"content": [{"marks": [{"type": "strong"}], "text": "b", "type": "text"}, {"text": " ", "type": "text"}, {"marks": [{"type": "underline"}], "text": "u", "type": "text"}, {"text": " ", "type": "text"}, {"marks": [{"type": "strike"}], "text": "s", "type": "text"}, {"text": " ", "type": "text"}, {"marks": [{"type": "code"}], "text": "c", "type": "text"}, {"text": " ", "type": "text"}, {"marks": [{"attrs": {"type": "sup"}, "type": "subsup"}], "text": "sup", "type": "text"}, {"text": " ", "type": "text"}, {"marks": [{"attrs": {"color": "#ff5630"}, "type": "textColor"}], "text": "red", "type": "text"}, {"text": " ", "type": "text"}, {"marks": [{"attrs": {"color": "#fedec8"}, "type": "backgroundColor"}], "text": "hl", "type": "text"}], "type": "paragraph"}], "type": "doc", "version": 1}
```

A colour set in ADF as a hex textColor mark. Storage writes it as an rgb style, and the view adds a dark mode value.

Rendered view (HTML):

```html
<p><style>[data-colorid=ygsqugo5p0]{color:#ff5630} html[data-color-mode=dark] [data-colorid=ygsqugo5p0]{color:#cf2600}</style><strong>b</strong> <u>u</u> <del>s</del> <code>c</code> <sup>sup</sup> <span data-colorid="ygsqugo5p0">red</span> <span style="background-color: rgb(254,222,200);">hl</span></p>
```

Storage format after the round trip through ADF:

```xml
<p><strong>b</strong> <u>u</u> <del>s</del> <code>c</code> <sup>sup</sup> <span style="color: rgb(255,86,48);">red</span> <span style="background-color: rgb(254,222,200);">hl</span></p>
```

Sent to Confluence Cloud on 29 Nov 2026.

## What changes in conversion

- The span color maps to the ADF textColor mark with a hex value. rgb(255,0,0) becomes #ff0000 and returns as rgb(255,0,0).
- A hex value is rewritten on save, so #ff5630 is stored as rgb(255,86,48). The colour name red is stored as typed, then becomes rgb(255,0,0) after an ADF save.
- The view renders colours differently from storage. Pure red gets a legacy class, other colours get a data attribute with a style block that includes a separate dark mode colour.
- The font element with a color attribute is stored and rendered, but it has no ADF form, so an ADF save keeps the text and drops the colour.

## Pitfalls

- Do not use font for new content. The next editor save removes the colour.
- A hex colour is stored as rgb, so code that compares colours should normalise both forms.
- The view adds a dark mode colour of its own for hex-style colours. The stored style holds only the single colour that was set.

## Questions and answers

### Does a named colour like red work in storage format?

It is stored as typed and renders, and after an ADF save it is written as rgb(255,0,0).

## Related

- [Text highlight](https://goingstellar.ro/reference/confluence-storage-format/background-highlight/)
- [<strong>, <em>, <b> and <i>](https://goingstellar.ro/reference/confluence-storage-format/bold-italic/)
- [<small>, <big> and font size](https://goingstellar.ro/reference/confluence-storage-format/small-big-font-size/)
- [HTML that storage format drops](https://goingstellar.ro/reference/confluence-storage-format/unsupported-html/)
- [Cell background colours](https://goingstellar.ro/reference/confluence-storage-format/table-cell-colours/)

## Sources

- [Confluence storage format (Atlassian Documentation)](https://confluence.atlassian.com/doc/confluence-storage-format-790796544.html)
- [Atlassian Document Format: document structure (Atlassian Developer)](https://developer.atlassian.com/cloud/jira/platform/apis/document/structure/)

