Short answer: the Accent color in Design settings, in themes that read it; code injection for more
How to change Ghost theme colors
In Ghost you change the theme's main color with the Accent color, under Settings, Site, Design & branding, then Customize, in themes that support it; for anything more, add CSS with code injection. To see a palette on your live site before you pick, load it in Recolor (recolor.page) and press Space. You can test your site with the Recolor app in a web browser without editing your theme files or publishing draft changes.
Last updated
| What | Where | What it does |
|---|---|---|
| Accent color | Settings, Site, Design & branding, Customize, Brand | Links, buttons and text colors, in supported themes only |
| Theme Settings | The same Design settings | Theme dependent: Source has a site background color and a header and footer color |
--ghost-accent-color | Written by Ghost into each page's head element | Read by the Source and Casper themes |
| Code injection | Settings, Advanced, Code Injection, or a post's Post Settings | CSS in a style element, on every page or one post |
| A theme's own color setting | config.custom in the theme's package.json | A color picker in Design settings |
The Accent color in Design settings
Ghost's help on design settings says to open Settings, Site, Design & branding, and click Customize. Under the Brand section, the Accent color is the primary color of your site's theme, in supported themes only, for links, buttons and text colors. You should pick one that contrasts well with the theme.
The Theme Settings sections below the brand options depend on the active theme. Ghost's default theme, Source, has a site background color and a header and footer color that can follow the background or the accent.
Which themes use the accent
Ghost writes the accent into every page's head element as --ghost-accent-color on :root, as its
ghost_head helper shows. A theme template reads the same hex as {{@site.accent_color}}, as noted in Ghost's
theme docs on the @site data. Source and Casper, Ghost's own themes, read --ghost-accent-color in their
stylesheets. A theme that never reads it ignores the picker. Ghost's help names the setting, not the variable,
whose name comes from Ghost's code.
Ghost's Source theme writes white text on buttons in the accent color. The hex code #264653 reads
10.08:1 with white text, which gives clear contrast. The hex code #e76f51 reads 3.09:1,
which falls under 4.5:1. For theme authors, the {{contrast_text_color}} helper returns a readable
text color for a background such as @site.accent_color.
More colors with code injection
Ghost's help on adding styles with code injection explains that the tool is under Settings, Advanced, Code
Injection. Code in the Site Header goes into the head element of every page, and a post's own goes in its
Post Settings. Ghost places code injection after its accent style, so a later :root rule wins, on one post
too.
<style>
:root {
--ghost-accent-color: #264653;
}
</style>A theme can add its own color pickers. Ghost's theme docs on custom settings give a color type in
config.custom of the theme's package.json, whose default must be a hex code.
"button_color": {
"type": "color",
"default": "#264653"
}The theme then uses the custom setting directly in its markup or style declarations.
<style>
:root {
{{#if @custom.button_color}}
--button-bg-color: {{@custom.button_color}};
{{/if}}
}
</style>Try the palette on your live site first
Load your published site by its address in Recolor, press Space until a palette fits, and lock the colors you keep. Each swatch shows its contrast with black or white text, marked for 4.5:1 readability. The contrast matrix grades every pair across the palette. A members-only page behind a login goes in as an uploaded file when loading a page. Photos keep their own colors throughout the preview.
No Ghost setting reads Recolor's export names directly. You can copy a hex from the Hex tab in the export
formats into the Accent color picker, or rename --color-1 to --ghost-accent-color by hand
for code injection. You can find more detail in the guide to recolor a website with CSS
variables.
Common questions
Does every Ghost theme use the Accent color?
No. Ghost's help on design settings says the setting works in supported themes only. Source and Casper read it, but themes that omit the variable ignore the picker.
Is --ghost-accent-color in Ghost's help?
No. Ghost's help names the Accent color setting. The variable name comes from Ghost's code and appears in theme stylesheets.
Does code injection override the Accent color?
Yes. Ghost puts code injection after its accent style in the document head, so a later :root rule wins.
Can I paste Recolor's CSS export into code injection as it is?
No. Ghost's themes read --ghost-accent-color instead of --color-1, so you must rename the variable by hand.
Is Recolor free?
Yes. Loading a site, generating palettes and using every export format are free without an account.
Sources
- Ghost's help on design settings ghost.org
- Ghost's help on adding styles with code injection ghost.org
- Ghost's theme docs on the @site data docs.ghost.org
- Ghost's theme docs on custom settings docs.ghost.org
- Ghost's theme docs on contrast_text_color docs.ghost.org
- Ghost's ghost_head helper, in Ghost's code github.com
- Ghost's releases github.com
- Ghost's Source theme github.com