PimpMyRice

Palette

A palette defines the core colors for your theme—used for backgrounds, text, accents, and terminal colors. Palettes are the foundation for your style and are referenced throughout your styles, themes, and modules.


Palette structure

Here's how a palette is structured:

  • term: 16 terminal colors (color0color15)
  • normal: background (bg) and foreground (fg) for general UI
  • primary: main accent color (bg and fg)
  • secondary: secondary accent color (bg and fg)

Example:

sample_palette.json
{
    "term": {
        "color0": "#102f4c",
        "color1": "#7fd2ff",
        "color2": "#927fff",
        "color3": "#ff7ffc",
        "color4": "#ff7f92",
        "color5": "#ffd47f",
        "color6": "#bdff7f",
        "color7": "#7fffa7",
        "color8": "#3f6c96",
        "color9": "#a0cde5",
        "color10": "#a9a0e5",
        "color11": "#e5a0e4",
        "color12": "#e5a0aa",
        "color13": "#e5cda0",
        "color14": "#c3e5a0",
        "color15": "#cce6ff"
    },
    "normal": {
        "bg": "#102f4c",
        "fg": "#cce6ff"
    },
    "primary": {
        "bg": "#1d6d99",
        "fg": "#000000"
    },
    "secondary": {
        "bg": "#153f66",
        "fg": "#35a0ff"
    }
}

Global palettes

A global palette is a reusable palette stored in PIMP_CONFIG_DIR/palettes/. You can create your own or use the built-in ones. Global palettes can be referenced in your themes and modes for easy sharing and switching.

You can edit or create a global palette with:

pimp palette edit PALETTE_NAME

Using palettes in themes

Each theme can define its own palette for each mode (e.g. dark, light), or reference a global palette using from_global:

theme.json
"palette": {
    "from_global": "catppuccin_dark"
}

You can also define a palette inline in your theme or mode:

theme.json
"palette": {
    "term": { ... },
    "normal": { ... },
    "primary": { ... },
    "secondary": { ... }
}

Palette generators

Palettes can automatically generate from images using palette generators. This is how pimp gen works: it extracts colors from your wallpaper to create a matching palette.

You can add your own palette generators in PIMP_CONFIG_DIR/palette_generators/. The filename will be the name of the generator/mode.

Use default dark as a starting point.

PIMP_CONFIG_DIR/palette_generators/dark.py
from pathlib import Path
from pimpmyrice.color_extract import extract_colors
from pimpmyrice.colors import Color, Palette
 
 
async def gen_palette(image_path: Path) -> Palette:
    colors_with_count = extract_colors(image_path)
 
    # create palette from extracted colors
 
    palette = ...
 
    return Palette(**palette)

If the name of the custom palette generator is the same as a built-in one (eg: "dark"), the custom generator will be used.


Tips & Tricks

  • Use palette fields in your styles with Jinja references, e.g. {{primary.bg}}, {{term.color4}}.
  • All palette fields are required for a valid palette.
  • You can list available palettes with:
    pimp palette list
  • See theme_dict for how palettes are merged into the final config.

On this page