diff --git a/home-manager/fred.nix b/home-manager/fred.nix index 3b505b3..bc10cee 100644 --- a/home-manager/fred.nix +++ b/home-manager/fred.nix @@ -48,6 +48,14 @@ input_path = "${inputs.self}/templates/gtk4-colors.css" output_path = "${config.home.homeDirectory}/.config/gtk-4.0/colors.css" + [templates.zen] + input_path = "${inputs.self}/templates/zen-userChrome.css" + output_path = "${config.home.homeDirectory}/.zen/fraudek5.Default Profile/chrome/userChrome.css" + + [templates.vscodium] + input_path = "${inputs.self}/templates/vscodium-colors.json" + output_path = "${config.home.homeDirectory}/.local/share/matugen/vscodium-colors.json" + [templates.recolor-folders] input_path = "${inputs.self}/templates/recolor-folders.sh" output_path = "${config.home.homeDirectory}/.local/share/matugen/recolor-folders.sh" diff --git a/settings/gnome.nix b/settings/gnome.nix index 3ac24c6..bc127be 100644 --- a/settings/gnome.nix +++ b/settings/gnome.nix @@ -25,6 +25,7 @@ papirus-icon-theme adw-gtk3 matugen + jq ]; # Set cursor theme diff --git a/templates/recolor-folders.sh b/templates/recolor-folders.sh index f097301..a64048f 100644 --- a/templates/recolor-folders.sh +++ b/templates/recolor-folders.sh @@ -87,3 +87,52 @@ done # Update icon cache gtk-update-icon-cache -f "$ICON_DIR" 2>/dev/null || true + +# Map wallpaper palette to closest GNOME accent color +# Primary color RGB: {{colors.primary.default.red}}, {{colors.primary.default.green}}, {{colors.primary.default.blue}} +R={{colors.primary.default.red}} +G={{colors.primary.default.green}} +B={{colors.primary.default.blue}} + +# Simple hue-based mapping to GNOME accent presets +if [ "$R" -gt "$G" ] && [ "$R" -gt "$B" ]; then + if [ "$B" -gt "$((G + 30))" ]; then + ACCENT="purple" + elif [ "$G" -gt "$((R / 2))" ]; then + ACCENT="orange" + else + if [ "$B" -gt "$((R / 3))" ]; then + ACCENT="pink" + else + ACCENT="red" + fi + fi +elif [ "$G" -gt "$R" ] && [ "$G" -gt "$B" ]; then + if [ "$B" -gt "$((R + 20))" ]; then + ACCENT="teal" + else + ACCENT="green" + fi +elif [ "$B" -gt "$R" ] && [ "$B" -gt "$G" ]; then + if [ "$R" -gt "$((B / 2))" ]; then + ACCENT="purple" + else + ACCENT="blue" + fi +else + ACCENT="slate" +fi + +gsettings set org.gnome.desktop.interface accent-color "$ACCENT" + +# Merge VSCodium color customizations into settings.json +VSCODE_SETTINGS="$HOME/.config/VSCodium/User/settings.json" +VSCODE_COLORS="$HOME/.local/share/matugen/vscodium-colors.json" +if [ -f "$VSCODE_SETTINGS" ] && [ -f "$VSCODE_COLORS" ]; then + COLORS=$(cat "$VSCODE_COLORS") + # Remove existing workbench.colorCustomizations and merge new ones + TMP=$(mktemp) + if command -v jq &>/dev/null; then + jq --argjson colors "$COLORS" '. * $colors' "$VSCODE_SETTINGS" > "$TMP" && mv "$TMP" "$VSCODE_SETTINGS" + fi +fi diff --git a/templates/vscodium-colors.json b/templates/vscodium-colors.json new file mode 100644 index 0000000..7ca4db7 --- /dev/null +++ b/templates/vscodium-colors.json @@ -0,0 +1,27 @@ +{ + "workbench.colorCustomizations": { + "titleBar.activeBackground": "{{colors.surface_container.default.hex}}", + "titleBar.activeForeground": "{{colors.on_surface.default.hex}}", + "titleBar.inactiveBackground": "{{colors.surface_container_low.default.hex}}", + "activityBar.background": "{{colors.surface_container.default.hex}}", + "activityBar.foreground": "{{colors.on_surface.default.hex}}", + "sideBar.background": "{{colors.surface_container_low.default.hex}}", + "sideBar.foreground": "{{colors.on_surface.default.hex}}", + "editor.background": "{{colors.surface.default.hex}}", + "editor.foreground": "{{colors.on_surface.default.hex}}", + "statusBar.background": "{{colors.surface_container.default.hex}}", + "statusBar.foreground": "{{colors.on_surface.default.hex}}", + "tab.activeBackground": "{{colors.surface.default.hex}}", + "tab.inactiveBackground": "{{colors.surface_container.default.hex}}", + "tab.activeForeground": "{{colors.on_surface.default.hex}}", + "focusBorder": "{{colors.primary.default.hex}}", + "button.background": "{{colors.primary.default.hex}}", + "button.foreground": "{{colors.on_primary.default.hex}}", + "list.activeSelectionBackground": "{{colors.primary_container.default.hex}}", + "list.activeSelectionForeground": "{{colors.on_primary_container.default.hex}}", + "list.hoverBackground": "{{colors.surface_container_high.default.hex}}", + "terminal.background": "{{colors.surface.default.hex}}", + "terminal.foreground": "{{colors.on_surface.default.hex}}", + "panel.background": "{{colors.surface_container_low.default.hex}}" + } +} diff --git a/templates/zen-userChrome.css b/templates/zen-userChrome.css new file mode 100644 index 0000000..a9086be --- /dev/null +++ b/templates/zen-userChrome.css @@ -0,0 +1,11 @@ +/* Wallpaper-based colors generated by matugen */ +:root { + --zen-primary-color: {{colors.primary.default.hex}} !important; + --zen-colors-primary: {{colors.primary.default.hex}} !important; + --zen-colors-secondary: {{colors.secondary.default.hex}} !important; + --zen-colors-tertiary: {{colors.tertiary.default.hex}} !important; + --zen-colors-border: {{colors.outline_variant.default.hex}} !important; + --toolbar-bgcolor: {{colors.surface.default.hex}} !important; + --lwt-accent-color: {{colors.surface_container.default.hex}} !important; + --lwt-text-color: {{colors.on_surface.default.hex}} !important; +}