Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Change Zellij pane background color based on project path (flakes-dkc4)

StatusDone
TypeFeature
Prioritynormal

Visually distinguish panes belonging to different projects by assigning each project a unique background color in Zellij. Builds on the project-wise pane naming from flakes-1zlj.

Design

Palette

8 subtle Gruvbox-adjacent background tints (base bg is #282828):

IndexHexTint
0#2e1a1aRed
1#1a2e1aGreen
2#1a1a2eBlue
3#2e2e1aYellow
4#2e1a2eMagenta
5#1a2e2eCyan
6#2e241aOrange
7#1a2e24Teal

Color Assignment

  • Hash project name (simple checksum) mod palette size → deterministic color index
  • Same project always gets the same color
  • Known limitation: hash collisions possible, acceptable for now

Behavior

  • Home project (ZELLIJ_SESSION_PROJECT): no color change, stays at terminal default
  • Foreign project: apply palette color via zellij action set-pane-color --bg
  • On return to home project: zellij action set-pane-color --reset
  • Applied on PWD change and shell init

Files Changed

modules/home/programs/fish/init/zellij.fish only.

Tasks

  • Add color palette array
  • Add hash function for project name → palette index
  • Add zellij_update_pane_color function
  • Integrate into PWD hook and init block
  • Reset color when returning to home project

Summary of Changes

Added to modules/home/programs/fish/init/zellij.fish:

  • ZELLIJ_PANE_COLORS: 8 subtle Gruvbox-adjacent bg tints
  • zellij_project_color_index: djb2-style hash mod palette size, returns stable integer index
  • zellij_update_pane_color: applies color for foreign projects, resets for home project
  • Called from PWD hook and init block alongside existing pane/tab name updates