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:
@@ -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))
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
3
quickshell/matugen/configs/wezterm.toml
Normal file
3
quickshell/matugen/configs/wezterm.toml
Normal file
@@ -0,0 +1,3 @@
|
||||
[templates.dmswezterm]
|
||||
input_path = 'SHELL_DIR/matugen/templates/wezterm.toml'
|
||||
output_path = '~/.config/wezterm/colors/dank-theme.toml'
|
||||
10
quickshell/matugen/templates/wezterm.toml
Normal file
10
quickshell/matugen/templates/wezterm.toml
Normal 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}}'
|
||||
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user