Markdown color text

Standard Markdown has no color syntax. Where HTML is allowed a span with a style works; GitHub strips styles, so you need a workaround there.

<span style="color:#c2410c">Orange text via HTML</span>

```diff
+ green line in a diff block
- red line in a diff block
```

> [!NOTE]
> GitHub renders this as a blue note callout.

HTML span (most renderers)

<span style="color:#c2410c">text</span> works in static site generators, Obsidian, VS Code preview and here. Pick colours with enough contrast (at least 4.5:1 against the background, per WCAG).

On GitHub

GitHub removes style attributes, so spans don’t colour. Options that do render:

  • Math: $\color{red}{\textsf{text}}$ uses GitHub’s LaTeX support. It’s a hack: it renders as an image-like formula, is not selectable as normal text and may break.
  • Diff blocks: lines starting with + are green and - red inside a ```diff block.
  • Alerts: > [!NOTE], [!TIP], [!IMPORTANT], [!WARNING], [!CAUTION] give coloured callouts.
  • Emoji: 🟢 🟡 🔴 for status columns.

Highlight

Some renderers support ==highlight==; everywhere HTML is allowed, <mark>text</mark> works.

Centre text

Same limitation: use <p align="center"> on GitHub or a style elsewhere.

Quick answers

How do I change text color in Markdown?
Use an HTML span with a style, where your renderer allows HTML: <span style="color:red">text</span>.
Can I color text in a GitHub README?
Not with HTML styles. Use diff blocks, alert callouts, emoji, or the LaTeX \color hack.