base24-themes

Source: github.com/red-oxide/base24-themes

Base24 color schemes for Nix, with a small library of format converters and a module for NixOS and Home Manager.

Usage & configuration options →

Theme gallery →

Features

  • Bundled themes: ships with birdland (dark) and birdland-light (light), with more planned. Every file in themes/ is picked up automatically.
  • Format converters: toYaml (tinted-theming scheme format), toJson, toScss, toQml, toSvg (the palette preview images) and toCardSvg (the gallery cards).
  • Validation: themes are checked for missing or malformed colors, and nix flake check verifies every bundled theme.
  • Module: one module for NixOS and Home Manager that exposes the selected theme as config.lib.base24.

Installation

Add base24-themes as an input in your flake.nix:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    base24-themes.url = "github:chrisppy/base24-themes";
    base24-themes.inputs.nixpkgs.follows = "nixpkgs";
  };

  outputs = { self, nixpkgs, base24-themes, ... }: {
    # Your flake outputs...
  };
}

Birdland

Birdland palette and syntax sample

A dark theme in Baltimore Orioles colors: black and gray from the 2023 City Connect uniforms, cream, Camden Yards green and warehouse-brick orange from the 2026 City Connect uniforms, and the official Orioles orange (#df4601). Every accent reaches at least 4.5:1 contrast on the background.

SlotColorHexUsed for
base00Black0b0b0bBackground
base01Black151515Panels, secondary background
base02Dark gray292929Selection
base03Gray464646Comments, inactive elements
base04Gray8a8a8aMuted foreground
base05Creame5dfd2Foreground
base06Warm whitef2eee5Bright foreground
base07Whitefffdf8Maximum contrast
base08Orioles orangedf4601Variables, errors
base09Bright orangeff7a1aNumbers, constants
base0ABrass (Eutaw Street plaques)d4ad4cClasses, warnings
base0BCamden Yards seat green4f8f6aStrings, success
base0CPale Camden green86b8a4Support, escapes
base0DWarehouse oranged98b45Functions, links
base0EBaltimore brickb8683fKeywords
base0FWarm grayb8b0a3Deprecated, embedded
base10Black070707Darker background
base11Black030303Darkest background
base12Bright Orioles orangeff5a00Bright red
base13Bright brassebc770Bright yellow
base14Bright Camden green6cad86Bright green
base15Bright pale greena6d3c1Bright cyan
base16Bright warehouse orangef0a764Bright blue
base17Bright brickd6875cBright magenta

The blue and magenta slots are deliberately orange and brick to stay within the Orioles colors. For a light variant, see Birdland Light.

Library

Everything lives at lib.base24: the functions, the bundled themes (lib.base24.themes.<name>), their preview images (lib.base24.previews.<name>) and gallery cards (lib.base24.cards.<name>), and the gallery page (lib.base24.gallery). It is system-independent.

let
  base24 = inputs.base24-themes.lib.base24;
  theme = base24.themes.birdland;
in
{
  qml = base24.toQml theme;   # QML singleton
  yaml = base24.toYaml theme; # tinted-theming scheme
  json = base24.toJson theme;
  scss = base24.toScss theme;
  bg = base24.getColorHex theme "base00"; # "#0b0b0b"
}
FunctionReturns
normalizeTheme themeThe theme with all 24 colors filled in and lowercased; throws on invalid input
getColors themeAn attrset of just the 24 colors
getColor theme name / getColorHex theme nameOne color, without or with a leading #
toYaml, toJson, toScss, toQmlThe theme as a string in that format
toSvg themeA preview image: palette swatches plus a highlighted code sample
toCardSvg themeA gallery card: code sample, palette strip and system/variant tags

toQml produces a pragma Singleton file. Register it in a qmldir next to it, for example singleton Theme 1.0 Theme.qml.

The library needs only a nixpkgs lib, so it also works without flakes:

base24 = import "${base24-themes-source}/lib" { inherit (pkgs) lib; };

Defining your own theme

A theme is a flat attrset of base00–base17, plus optional name, author and variant ("dark" or "light", default "dark"). Colors are six hex digits without a leading #.

{
  name = "My Theme";
  author = "me";
  variant = "dark";
  base00 = "181818"; # background
  base01 = "282828";
  base02 = "383838";
  base03 = "585858";
  base04 = "b8b8b8";
  base05 = "d8d8d8"; # foreground
  base06 = "e8e8e8";
  base07 = "f8f8f8";
  base08 = "ab4642"; # red
  base09 = "dc9656"; # orange
  base0A = "f7ca88"; # yellow
  base0B = "a1b56c"; # green
  base0C = "86c1b9"; # cyan
  base0D = "7cafc2"; # blue
  base0E = "ba8baf"; # magenta
  base0F = "a16946"; # brown
  # Base24 extensions
  base10 = "101010"; # darker background (not lighter than base00)
  base11 = "0c0c0c"; # darkest background (not lighter than base10)
  base12 = "d0605c"; # bright red
  base13 = "fbd9a6"; # bright yellow
  base14 = "bbcf88"; # bright green
  base15 = "a3d5cd"; # bright cyan
  base16 = "9cc8da"; # bright blue
  base17 = "d3a9ca"; # bright magenta
}

Base16 themes (only base00–base0F) are accepted too. The missing colors fall back to base00 for base10/base11 and to the matching normal color for base12–base17.

To bundle a theme, add it as themes/<name>.nix. Its key is the file name, and name defaults to it. Bundled themes must define all 24 colors and need a page at docs/<name>.md, a preview image and a gallery card, and the gallery has to be regenerated:

nix eval --raw .#lib.base24.previews.<name> > previews/<name>.svg
nix eval --raw .#lib.base24.cards.<name> > previews/cards/<name>.svg
nix eval --raw .#lib.base24.gallery > docs/gallery.md

nix flake check fails if the page is missing or if any generated file is missing or out of date.

NixOS and Home Manager module

The same module is exported as nixosModules.default and homeManagerModules.default:

{ inputs, config, ... }: {
  imports = [ inputs.base24-themes.homeManagerModules.default ];

  base24.theme = "birdland";
  # or: base24.customTheme = { base00 = "181818"; ... };

  # Use the colors anywhere in your configuration:
  # config.lib.base24.colors.base05     -> "d8d8d8"
  # config.lib.base24.getColorHex "base0D"
  # config.lib.base24.qml               -> QML singleton source
}
OptionDefaultDescription
base24.enabletrueExpose the theme as config.lib.base24
base24.theme"birdland"A bundled theme name
base24.customThemenullAn inline theme; overrides theme

The module only exposes colors. It does not configure any applications itself.