Going Stellar

Home/Jira formatting reference

Jira text formatting

Text color in Jira: {color:red} in wiki markup and ADF

The color macro wraps text in a color name or hex value. Jira Cloud stores it as the ADF textColor mark with a hex value, so color names come back as hex codes. The wiki help describes it for a block of text, and it also works inline.

Wiki markup

{color:red}text{color}
{color:#ff5630}text{color}

Stored as ADF (REST API v3)

The ADF document Jira Cloud stores for {color:#ff5630}hex red{color}:

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

Examples

Wiki markup (API v2)

{color:red}look ma, red text!{color}

The example from the wiki help. The v2 render keeps the name, and the ADF round trip turns it into hex.

Rendered by Jira (HTML)

<p><font color="red">look ma, red text!</font></p>

Back to wiki after the round trip

{color:#ff0000}look ma, red text!{color}

Sent to Jira Cloud on .

Wiki markup (API v2)

{color:#ff5630}hex red{color}

A hex value. It is the one form that survives unchanged.

Rendered by Jira (HTML)

<p><font color="#ff5630">hex red</font></p>

Back to wiki after the round trip

{color:#ff5630}hex red{color}

Sent to Jira Cloud on .

Wiki markup (API v2)

{color:rgb(0,128,0)}rgb green{color}

A CSS rgb() value. The v2 render shows a color error, yet the stored ADF holds the converted hex value.

Rendered by Jira (HTML)

<div class="error"><span class="error">color: Color value is invalid</span> <p>rgb green</p></div>

Back to wiki after the round trip

{color:#008000}rgb green{color}

Sent to Jira Cloud on .

Wiki markup (API v2)

{color:purple}word{color} inline

A color name around one word inside a sentence.

Rendered by Jira (HTML)

<p><font color="purple">word</font> inline</p>

Back to wiki after the round trip

{color:#800080}word{color} inline

Sent to Jira Cloud on .

Wiki markup (API v2)

{color:red}
line one
line two
{color}

The block form from the help, with the macro on its own lines. ADF stores one coloured run per line.

Rendered by Jira (HTML)

<p><font color="red"><br/>
line one<br/>
line two</font></p>

Back to wiki after the round trip

{color:#ff0000}line one{color}
{color:#ff0000}line two{color}

Sent to Jira Cloud on .

Wiki markup (API v2)

{color:red}*bold red*{color}

Color around bold text. Both effects are kept.

Rendered by Jira (HTML)

<p><font color="red"><b>bold red</b></font></p>

Back to wiki after the round trip

{color:#ff0000}*bold red*{color}

Sent to Jira Cloud on .

Wiki markup (API v2)

{color:red}unclosed color

A color macro without a closing tag. The color is dropped when the text is stored.

Rendered by Jira (HTML)

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

Back to wiki after the round trip

unclosed color

Sent to Jira Cloud on .

What changes in conversion

  • Color names are converted to hex when stored: red becomes #ff0000, purple becomes #800080. Reading back through v2 gives the hex form.
  • A multi-line block is split by line. The ADF holds a coloured text node, a hard break and another coloured text node, so wiki written back repeats the color macro on each line.
  • A color macro that is never closed is dropped without a message: the stored text has no color.
  • Per the ADF documentation, textColor cannot combine with the code mark or the link mark. There is no Markdown syntax for text color.

Pitfalls

  • rgb() values showed a color error in the v2 render even though the stored ADF was valid. Use a hex value.
  • Always close the macro. An unclosed {color:red} loses its color.
  • Do not rely on color alone to carry meaning in a comment. Pair it with a word or a status.

Sources

  1. Text Formatting Notation Help (Jira, in-product help)
  2. Atlassian Document Format: document structure (Jira Cloud platform)

Markdown version · All formatting pages