Going Stellar

Home/Confluence storage format reference

Confluence storage format

Text color (span style color) in Confluence storage format

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

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

As ADF (Confluence Cloud)

The ADF that Confluence Cloud builds for:

<p><span style="color: rgb(255,0,0);">red text</span></p>
{
 "type": "doc",
 "content": [
  {
   "type": "paragraph",
   "content": [
    {
     "text": "red text",
     "type": "text",
     "marks": [
      {
       "type": "textColor",
       "attrs": {
        "color": "#ff0000"
       }
      }
     ]
    }
   ]
  }
 ],
 "version": 1
}

Examples

Storage format sent

<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)

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

Storage format after the round trip through ADF

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

Sent to Confluence Cloud on .

Storage format sent

<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)

<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

<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 .

Storage format sent

<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)

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

Storage format after the round trip through ADF

<p>font tag</p>

Sent to Confluence Cloud on .

Storage format sent

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)

<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

<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 .

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).

Sources

  1. Confluence storage format (Atlassian Documentation)
  2. Atlassian Document Format: document structure (Atlassian Developer)

Markdown version · All storage format pages