Skip to content

Core styling module + alacritty example - #184

Open
kmein wants to merge 3 commits into
Lassulus:mainfrom
kmein:stylix
Open

Core styling module + alacritty example#184
kmein wants to merge 3 commits into
Lassulus:mainfrom
kmein:stylix

Conversation

@kmein

@kmein kmein commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Inspired by the great stylix I wanted to explore how wrappers could be used to achieve a similar thing.

This PR adds a core module styling (supporting base16 colour schemes, fonts, opacity and cursor settings) and an example styling implementation for alacritty.

kmein added 2 commits August 18, 2026 21:25
Wrapper modules are evaluated independently of each other, so there is no
shared configuration a theme can live in. Every theme-adjacent option today
is program-local pass-through: rofi takes rasi, yazi and helix take TOML,
waybar and swaync take raw CSS, and the four terminals take colour keys in
four different formats. Sharing one palette means writing the same hex
strings into a dozen incompatible files by hand.

Add a styling module, in the spirit of stylix, imported into every wrapper
alongside wrapper and meta. It holds one colour scheme, font, opacity and
cursor definition that programs derive their own configuration from, and
wlib.applyStyle maps a single definition over as many modules as wanted.

styling.scheme takes a base16 scheme by name from pkgs.base16-schemes, by
path or derivation, or inline. It seeds styling.palette, which stays
settable per slot so a scheme is a starting point rather than a cage.
styling.colors exposes the palette under semantic names plus the standard
base16 mapping onto the 16 ANSI colours, so terminals do not each have to
invent their own.

Scheme loading is a small line based parser rather than a YAML tool: that
keeps it pure, which matters because CI is nix flake check. The parser is
tested against all 303 schemes nixpkgs ships.

styling.enable turns on as soon as a scheme is set, so one definition
themes everything, and can be switched off per wrapper. With no scheme
configured it is false and no existing wrapper changes behaviour.

The namespace is styling rather than style because swayosd already
declares a style option, and theme and themes are taken by rofi, yazi,
helix and jjui. An always-imported module cannot collide with any of them.

No program module consumes this yet. The README documents the pattern they
will follow, and checks/styling-enable.nix pins the priority contract it
rests on: derived values must be defaults, or a settings definition at
priority 100 silently outranks the user's own value.

Assisted-by: Claude Opus 5
Add a styling.nix deriving colours, font and opacity from the styling
module, as the worked example the README points at, and a check.nix,
which alacritty did not have before. The check asserts on the generated
config rather than the built wrapper, so it does not build alacritty.

Assisted-by: Claude Opus 5
@kmein kmein changed the title Stylix Core styling module + alacritty example Aug 18, 2026
@zimward

zimward commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

implements #22

The parser carried a lowercasing table and an older flat layout branch that
nothing in pkgs.base16-schemes uses: all 303 schemes there write the canonical
`base0A` under a `palette:` block. Parse that shape only; a file spelling a
slot otherwise is reported as missing it.

Drop the attrset form of `styling.scheme`. It was redundant with
`styling.palette.<slot>`, which outranks the scheme anyway, and with it go
normalizePalette, normalizeColor and bySlug. Also drop the unread `name` from
a parsed scheme; `variant` stays, since polarity reads it.

Define `styling.colors` as one read only option computed from the palette
rather than 37 individual alias options.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants