1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-05 21:15:38 -05:00

Feat: wezterm theming support (#705)

* implemented logic for wezterm theming

added matugen configs and dank16 functions, updated matugen worked
scripta

* fixed theme dir

fixed path and moved output location to default wezterm dir
This commit is contained in:
Saurabh
2025-11-14 00:54:47 +11:00
committed by GitHub
parent 9322c79b4e
commit 76a60df88b
6 changed files with 51 additions and 1 deletions

View File

@@ -25,6 +25,7 @@ func init() {
dank16Cmd.Flags().Bool("foot", false, "Output in Foot terminal format")
dank16Cmd.Flags().Bool("alacritty", false, "Output in Alacritty terminal format")
dank16Cmd.Flags().Bool("ghostty", false, "Output in Ghostty terminal format")
dank16Cmd.Flags().Bool("wezterm", false, "Output in Wezterm terminal format")
dank16Cmd.Flags().String("vscode-enrich", "", "Enrich existing VSCode theme file with terminal colors")
dank16Cmd.Flags().String("background", "", "Custom background color")
dank16Cmd.Flags().String("contrast", "dps", "Contrast algorithm: dps (Delta Phi Star, default) or wcag")
@@ -42,6 +43,7 @@ func runDank16(cmd *cobra.Command, args []string) {
isFoot, _ := cmd.Flags().GetBool("foot")
isAlacritty, _ := cmd.Flags().GetBool("alacritty")
isGhostty, _ := cmd.Flags().GetBool("ghostty")
isWezterm, _ := cmd.Flags().GetBool("wezterm")
vscodeEnrich, _ := cmd.Flags().GetString("vscode-enrich")
background, _ := cmd.Flags().GetString("background")
contrastAlgo, _ := cmd.Flags().GetString("contrast")
@@ -84,6 +86,8 @@ func runDank16(cmd *cobra.Command, args []string) {
fmt.Print(dank16.GenerateAlacrittyTheme(colors))
} else if isGhostty {
fmt.Print(dank16.GenerateGhosttyTheme(colors))
} else if isWezterm {
fmt.Print(dank16.GenerateWeztermTheme(colors))
} else {
fmt.Print(dank16.GenerateGhosttyTheme(colors))
}

View File

@@ -124,3 +124,17 @@ func GenerateGhosttyTheme(colors []string) string {
}
return result.String()
}
func GenerateWeztermTheme(colors []string) string {
var result strings.Builder
labels := []string{"ansi", "brights"}
for j, label := range labels {
start := j * 8
colorSlice := make([]string, 8)
for i, color := range colors[start : start+8] {
colorSlice[i] = fmt.Sprintf("'%s'", color)
}
fmt.Fprintf(&result, "%s = [%s]\n", label, strings.Join(colorSlice, ", "))
}
return result.String()
}

View File

@@ -116,7 +116,7 @@ Theme singleton provides Material Design 3 color system, spacing, fonts, and ele
Templates in `scripts/templates/` generate themes for:
- GTK 3/4
- Qt5/Qt6
- Alacritty, Kitty, Foot terminals
- Alacritty, Kitty, Ghostty, Foot, Wezterm terminals
- VSCode/VSCodium
- Firefox

View File

@@ -0,0 +1,3 @@
[templates.dmswezterm]
input_path = 'SHELL_DIR/matugen/templates/wezterm.toml'
output_path = '~/.config/wezterm/colors/dank-theme.toml'

View File

@@ -0,0 +1,10 @@
[colors]
background = '{{colors.background.default.hex}}'
foreground = '{{colors.on_surface.default.hex}}'
cursor_bg = '{{colors.primary.default.hex}}'
cursor_fg = '{{colors.background.default.hex}}'
cursor_border = '{{colors.primary.default.hex}}'
selection_bg = '{{colors.primary_container.default.hex}}'
selection_fg = '{{colors.on_surface.default.hex}}'

View File

@@ -222,6 +222,11 @@ EOF
echo "" >> "$TMP_CONTENT_CFG"
fi
if command -v wezterm >/dev/null 2>&1; then
sed "s|'SHELL_DIR/|'$SHELL_DIR/|g" "$SHELL_DIR/matugen/configs/wezterm.toml" >>"$TMP_CONTENT_CFG"
echo "" >>"$TMP_CONTENT_CFG"
fi
if command -v dgop >/dev/null 2>&1; then
sed "s|'SHELL_DIR/|'$SHELL_DIR/|g" "$SHELL_DIR/matugen/configs/dgop.toml" >> "$TMP_CONTENT_CFG"
echo "" >> "$TMP_CONTENT_CFG"
@@ -321,6 +326,20 @@ EOF
fi
fi
if command -v wezterm >/dev/null 2>&1; then
WEZTERM_CONFIG="$CONFIG_DIR/wezterm/colors/dank-theme.toml"
if [[ ! -f "$WEZTERM_CONFIG" ]]; then
mkdir -p "$(dirname "$WEZTERM_CONFIG")"
touch "$WEZTERM_CONFIG"
fi
OUT=$(dms dank16 "$PRIMARY" $([[ "$mode" == "light" ]] && echo --light) ${SURFACE:+--background "$SURFACE"} --wezterm 2>/dev/null || true)
if [[ -n "${OUT:-}" ]]; then
printf "\n%s\n" "$OUT" >>"$WEZTERM_CONFIG"
fi
fi
if command -v alacritty >/dev/null 2>&1; then
ALACRITTY_CONFIG="$CONFIG_DIR/alacritty/dank-theme.toml"