# Text highlight (background-color) in Confluence storage

URL: https://goingstellar.ro/reference/confluence-storage-format/background-highlight/

Text highlight is a span with a background-color style, which maps to the ADF backgroundColor mark. The highlight macro survives as a macro. The bgcolor macro is converted to a panel macro by an ADF save.

## Storage format

```xml
<span style="background-color: rgb(254,222,200);">highlight</span>
```

## In the editor

- Use the highlighting feature in the editor toolbar. Per the Atlassian documentation, as the replacement for the Highlight macro.

## As ADF (Confluence Cloud)

The ADF that Confluence Cloud builds for:

```xml
<p><span style="background-color: rgb(254,222,200);">highlight</span></p>
```

```json
{
 "type": "doc",
 "content": [
  {
   "type": "paragraph",
   "content": [
    {
     "text": "highlight",
     "type": "text",
     "marks": [
      {
       "type": "backgroundColor",
       "attrs": {
        "color": "#fedec8"
       }
      }
     ]
    }
   ]
  }
 ],
 "version": 1
}
```

## Examples

Storage format sent:

```xml
<p><span style="background-color: rgb(254,222,200);">highlight</span></p>
```

Inline highlight with an rgb background. The span comes back unchanged and the ADF colour is the hex equivalent.

Rendered view (HTML):

```html
<p><span style="background-color: rgb(254,222,200);">highlight</span></p>
```

Storage format after the round trip through ADF:

```xml
<p><span style="background-color: rgb(254,222,200);">highlight</span></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 hex backgroundColor mark in ADF is stored as an rgb background-color span.

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.

Storage format sent:

```xml
<ac:structured-macro ac:name="highlight"><ac:parameter ac:name="colour">yellow</ac:parameter><ac:rich-text-body><p>highlight body</p></ac:rich-text-body></ac:structured-macro>
```

The legacy highlight macro with a colour parameter. It is kept as a macro and renders as an inline block with a yellow background.

Rendered view (HTML):

```html
<div class="conf-macro output-inline" data-hasbody="true" data-macro-id="<id>" data-macro-name="highlight" style="display: inline-block; background-color: yellow">
    highlight body
</div>
```

Storage format after the round trip through ADF:

```xml
<ac:structured-macro ac:name="highlight" ac:schema-version="1" ac:macro-id="<id>"><ac:parameter ac:name="colour">yellow</ac:parameter><ac:rich-text-body><p>highlight body</p></ac:rich-text-body></ac:structured-macro>
```

Sent to Confluence Cloud on 29 Nov 2026.

Storage format sent:

```xml
<ac:structured-macro ac:name="bgcolor"><ac:parameter ac:name="colour">yellow</ac:parameter><ac:rich-text-body><p>bgcolor body</p></ac:rich-text-body></ac:structured-macro>
```

The legacy bgcolor macro. The view shows a pale green background, and an ADF save rewrites it as a panel macro.

Rendered view (HTML):

```html
<div class="conf-macro output-block" data-hasbody="true" data-macro-id="<id>" data-macro-name="bgcolor" style="background-color: #C0FFC0;">
    bgcolor body
</div>
```

Storage format after the round trip through ADF:

```xml
<ac:structured-macro ac:name="panel" ac:schema-version="1" ac:macro-id="<id>"><ac:parameter ac:name="containerLevel">panel_c1</ac:parameter><ac:parameter ac:name="bgColor">#C0FFC0</ac:parameter><ac:rich-text-body><p>bgcolor body</p></ac:rich-text-body></ac:structured-macro>
```

Sent to Confluence Cloud on 29 Nov 2026.

## What changes in conversion

- background-color on a span maps to the backgroundColor mark. rgb(254,222,200) becomes #fedec8 and is written back in the same rgb form.
- The highlight macro is kept with its colour parameter and body, matching the statement that existing macros stay visible and editable.
- bgcolor does not stay a macro. The ADF save produces a panel macro with containerLevel panel_c1 and a bgColor parameter of #C0FFC0, and the view adds a border.

## Where the documentation differs

Sent to Confluence Cloud, 29 Nov 2026:

```xml
<ac:structured-macro ac:name="bgcolor"><ac:parameter ac:name="colour">yellow</ac:parameter><ac:rich-text-body><p>bgcolor body</p></ac:rich-text-body></ac:structured-macro>
```

The documentation: The removed-macros page says Background color macros are still visible and editable after conversion, without any loss of data.

The actual result: After an ADF save the bgcolor macro no longer exists. It is a panel macro, the colour parameter is gone, and the content is shown in a bordered panel instead of a plain coloured block.

## Pitfalls

- Do not expect a colour name in the bgcolor macro to keep its meaning. The probe with yellow rendered as #C0FFC0, and the converted panel holds that hex value.
- Highlighting through the macro and highlighting through the span are separate things. Searches for one miss the other.

## Questions and answers

### Does the highlight macro survive the Cloud editor?

An existing highlight macro does. It was returned with the same colour parameter and body after an ADF save.

## Related

- [Text color](https://goingstellar.ro/reference/confluence-storage-format/text-color/)
- [Strikethrough](https://goingstellar.ro/reference/confluence-storage-format/strikethrough/)
- [Macros removed from the Cloud editor](https://goingstellar.ro/reference/confluence-storage-format/legacy-macros/)
- [panel macro](https://goingstellar.ro/reference/confluence-storage-format/panel-macro/)
- [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/)
- [Macros that are unavailable or have limited availability in the Cloud editor (Atlassian Support)](https://support.atlassian.com/confluence-cloud/docs/learn-which-macros-are-being-removed/)

