Hackfetch Gets Real Colors
New thing today: hackfetch now emits 24-bit color when your terminal supports it, and spreads gradients smoothly across each row instead of cycling through the palette one character at a time.
Before and after
Old behavior: for a per-char scheme like rainbow, each character got exactly one palette entry, wrapping around every N characters. On a 30-column row with a 3-color palette, that looked like ten cycles of red, green, blue, red, green, blue… basically RGB static.
New behavior: the palette spreads across the row once, and characters between palette entries get interpolated in-between colors. Same 3-color palette on a 30-column row now shows red, olive, green, teal, blue, magenta, back to red.
Why the rebuild
Terminals speak two color modes:
-
256-color (
\x1b[38;5;Nm): pick from a fixed palette of 256 preset RGB values.
-
24-bit / truecolor (
\x1b[38;2;R;G;Bm): specify any of ~16 million RGB values directly.
The old code always used 256-color. That meant every character had to snap to one of the palette entries. No in-betweens possible.
The new code checks $COLORTERM (set to truecolor by iTerm2, kitty, WezTerm, Alacritty, GNOME Terminal, and most modern terminals) and emits 24-bit escapes when supported. When it’s not, it falls back to the old cycled-palette behavior automatically.
You can force it either way with HACKFETCH_TRUECOLOR=1 or =0.
Where you’ll notice it
The built-in rainbow scheme has 23 palette stops, so the difference on that one is small. You just see a smoother color distribution and less banding.
The change is dramatic on:
-
custom themes with few stops (try 3 colors in your
~/.config/hackfetch/colors.json for the wildest gradient)
-
the
stardance palette (11 stops, per-char), where sparkles now flow through the spectrum in order instead of landing on random-looking colors
-
any per-line scheme (
pride, trans, bi, pan, sunset, ocean, forest) since they now emit exact RGB values instead of nearest-256-color
Bonus: the SVG, PNG, and JPG export paths use the smooth interpolation too, so exported cards look better regardless of your terminal.
Ship
Landed in v1.8.0.
brew update
brew upgrade hackfetch
Or on the Arch family:
yay -Syu hackfetch-bin
Try hackfetch rocket forest and just watch.