How to Customize Colors and Themes in Fastfetch: Complete Guide
You customize colors in fastfetch by modifying the display.color object in your config.jsonc file or using --color-keys and --color-output flags, while per-module overrides use keyColor and outputColor fields, and the theme module displays desktop themes via configurable format strings.
Fastfetch is a system information tool that offers granular control over terminal colors and appearance. According to the fastfetch-cli/fastfetch source code, the application separates color configuration into global display settings and per-module overrides, allowing you to style everything from key names to ASCII logos. Whether you prefer editing JSONC configuration files or using command-line flags, you can customize colors and themes in fastfetch through a well-defined hierarchy defined in src/options/display.h and src/options/display.c.
Understanding Fastfetch's Color Architecture
Fastfetch implements a two-layer color system that separates global defaults from specific overrides.
Global Display Settings
The global display settings control default colors for keys, values, separators, progress bars, percentages, and temperature readings. These defaults live in the display object within your configuration file or via matching --color-… command-line flags.
According to src/options/display.h, the FFOptionsDisplay struct stores these values in fields like colorKeys, colorOutput, barColor, percentColor, and tempColor. When fastfetch renders output, it injects ANSI escape codes based on these settings using the ffOptionParseColor function.
Per-Module Overrides
You can override global colors for individual modules using per-module overrides. Each module definition supports keyColor, outputColor, and keyIcon fields that temporarily replace global colors during rendering.
The Theme module functions differently—it displays custom text defined by the themeFormat string, which can include placeholders like {gtk} or {qt} for desktop environment themes.
Where Colors Are Parsed in the Source Code
The color parsing pipeline involves several key components:
src/options/display.c: ContainsffOptionsParseDisplayJsonConfigwhich walks thedisplayobject usingyyjson_obj_foreach(around lines 22-70) and populates theFFOptionsDisplaystructcommon/color.h: Defines macros for color codes and ANSI escape sequencesffOptionParseColor: Called fromsrc/options/display.c(lines 46-66) to parse color strings like"red"or"bright_blue"src/options/logo.c: Handles--logo-color-Nflags for ASCII logo customization
When fastfetch reads ~/.config/fastfetch/config.jsonc, it validates against the schema in doc/json_schema.json before applying color settings.
Configuration Methods
JSONC Configuration File
Fastfetch reads configuration from ~/.config/fastfetch/config.jsonc (JSON with Comments). The display.color object supports keys, output, separator, and other elements:
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"display": {
"color": {
"keys": "bright_cyan",
"output": "bright_yellow",
"separator": "dim"
},
"brightColor": true
},
"modules": [
"title",
{
"type": "os",
"keyColor": "magenta"
}
]
}
In this example, display.color sets global defaults while the os module uses keyColor to override only its key color to magenta.
Command-Line Flags
For temporary changes without editing files, use these flags:
--color-keys: Set default color for module keys (labels)--color-output: Set default color for module values (data)--key-color: Override key color for the next module--output-color: Override output color for the next module--logo-color-1,--logo-color-2: Set colors for ASCII logo placeholders
Example overriding specific modules:
fastfetch --color-keys bright_green \
--color-output bright_white \
-M os --key-color red \
-M theme --format "{theme}"
Practical Color Customization Examples
Global Color Configuration
Set comprehensive color defaults for all modules:
{
"display": {
"color": {
"keys": "bright_blue",
"output": "white",
"separator": "dim",
"title": "bright_magenta"
},
"brightColor": true
}
}
This configuration applies to every module unless overridden individually.
Module-Specific Color Overrides
Target specific modules while keeping global defaults for others:
{
"modules": [
{
"type": "cpu",
"keyColor": "bright_red",
"outputColor": "yellow"
},
{
"type": "memory",
"keyColor": "green"
}
]
}
The cpu module uses bright red keys and yellow output, while memory uses green keys but inherits the global output color.
ASCII Logo Colors
Customize logo colors using placeholders that map to --logo-color flags:
fastfetch --logo-color-1 bright_red \
--logo-color-2 bright_blue \
--logo-color-3 green
In custom logos, these correspond to {{color1}}, {{color2}}, and {{color3}} placeholders as defined in src/options/logo.h.
Theme Module Customization
The theme module displays desktop environment themes using format strings:
{
"modules": [
"title",
{
"type": "theme",
"format": "GTK: {gtk} | Qt: {qt} | Icon: {icon}"
}
]
}
Fastfetch replaces {gtk}, {qt}, and {icon} with detected theme names, applying your global outputColor or specific outputColor if set.
Key Source Files Reference
| File | Purpose |
|---|---|
src/options/display.h |
Declares FFOptionsDisplay struct with color fields |
src/options/display.c |
Parses display.* from JSONC and command-line arguments |
src/options/logo.h |
Defines color placeholders for ASCII art |
doc/json_schema.json |
Documents keyColor, outputColor, and themeFormat schemas |
presets/neofetch.jsonc |
Example configuration showing color implementation |
Summary
- Fastfetch uses a hierarchical color system with global defaults in
display.colorand per-module overrides viakeyColor/outputColor - Configuration happens in
~/.config/fastfetch/config.jsoncor via--color-…flags, parsed byffOptionsParseDisplayJsonConfiginsrc/options/display.c - Global colors affect all modules unless overridden:
keys,output,separator,bar,percent, andtemp - Module colors apply only to specific instances using
keyColorandoutputColorfields - Logo colors use
--logo-color-Nflags mapped to{{colorN}}placeholders in ASCII art - Theme module displays desktop themes through customizable
formatstrings with placeholders like{gtk}and{qt}
Frequently Asked Questions
How do I change colors for just one module without affecting the rest?
Use the keyColor and outputColor fields inside that specific module's configuration. According to doc/json_schema.json, these fields override the global display.color settings only for that module instance. For command-line use, place --key-color or --output-color immediately after the -M <module> flag to target that specific module.
Can I use hex color codes or only named colors?
The ffOptionParseColor function in src/options/display.c primarily handles named colors like "red", "bright_blue", and "dim". While the source shows support for standard ANSI color names, hex codes depend on your terminal's support for truecolor sequences. Check the common/color.h file for the specific color macros supported in your version.
What's the difference between the Theme module and color themes?
The Theme module is a specific fastfetch module that displays your desktop environment's GTK, Qt, or icon theme names using the themeFormat field. It does not change fastfetch's colors. Color themes refer to the ANSI color configuration via display.color settings that control how text appears in your terminal output.
Where does fastfetch store its color configuration?
Fastfetch reads colors from ~/.config/fastfetch/config.jsonc (or $XDG_CONFIG_HOME/fastfetch/config.jsonc). The display object in this file maps directly to the FFOptionsDisplay struct defined in src/options/display.h. Command-line flags override file settings for that specific execution.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →