Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

nugu/ghostty.nu

Raw
use palette.nu

# Generate a ghostty theme file from nugu palette.
# Ghostty theme files are flat key=value configs with palette indices 0-15.
#
# Mapping follows the same semantic roles as wezterm/nugu/init.lua:
#
# ANSI 0-7 (standard):  content.* + global semantic colors
# ANSI 8-15 (bright):   ui.* + content.important_global
# 16-19:                indexed extras

export def theme [mode: string] {
	let nugu = (palette nugu $mode)
	let p = $nugu.palette

	# ANSI standard 0-7
	let std = [
		$p.content.backdrop    # 0: BLACK (darkest = background)
		$p.error               # 1: RED (error)
		$p.content.focus       # 2: GREEN (active attention)
		$p.warning             # 3: YELLOW (warning)
		$p.content.important_local # 4: BLUE (prominent content)
		$p.content.accent      # 5: MAGENTA (brand identity)
		$p.content.unfocus     # 6: CYAN (deepest visible, dim)
		$p.content.normal      # 7: WHITE (brightest = foreground)
	]

	# ANSI bright 8-15
	let bri = [
		$p.content.minor       # 8:  BRIGHT BLACK (receded content)
		$p.info                # 9:  BRIGHT RED (info)
		$p.ui.unfocus          # 10: BRIGHT GREEN (UI dim borders)
		$p.ui.backdrop         # 11: BRIGHT YELLOW (UI panel backgrounds)
		$p.content.important_global # 12: BRIGHT BLUE (most visible content)
		$p.ui.accent           # 13: BRIGHT MAGENTA (UI brand accent)
		$p.ui.important_local  # 14: BRIGHT CYAN (UI highlights)
		$p.ui.important_global # 15: BRIGHT WHITE (prominent UI)
	]

	# Indexed 16-19: nugu semantic extras
	let idx = [
		$p.debug               # 16: debug
		$p.ui.normal           # 17: ui.normal
		$p.ui.minor            # 18: ui.minor
		$p.ui.focus            # 19: ui.focus
	]

	let palettes = ($std | enumerate | each {|e|
		$"palette=($e.index)=($e.item)"
	}) ++ ($bri | enumerate | each {|e|
		$"palette=(($e.index + 8))=($e.item)"
	}) ++ ($idx | enumerate | each {|e|
		$"palette=(($e.index + 16))=($e.item)"
	})

	let header = [
		$"foreground=($p.content.normal)"
		$"background=($p.content.backdrop)"
		$"cursor-color=($p.ui.accent)"
		$"cursor-text=($p.ui.backdrop)"
		$"selection-foreground=($p.ui.backdrop)"
		$"selection-background=($p.ui.focus)"
	]

	($header ++ $palettes) | str join "\n"
}