From 2ccb0d71139eb7e8e46e1de8433017f7723b2a86 Mon Sep 17 00:00:00 2001 From: Henry Sipp Date: Tue, 1 Jul 2025 22:15:24 -0500 Subject: [PATCH] Update themes to use nix-colors base16 --- flake.nix | 1 + modules/home-manager/alacritty.nix | 44 ++-- modules/home-manager/btop.nix | 70 +++--- modules/home-manager/default.nix | 5 + modules/home-manager/hyprland/looknfeel.nix | 20 +- modules/home-manager/hyprlock.nix | 14 +- modules/home-manager/mako.nix | 10 +- modules/home-manager/vscode.nix | 2 +- modules/home-manager/waybar.nix | 12 +- modules/home-manager/wofi.nix | 22 +- modules/nixos/system.nix | 2 + modules/themes.nix | 248 +------------------- 12 files changed, 95 insertions(+), 355 deletions(-) diff --git a/flake.nix b/flake.nix index a0020ee..9f0074c 100644 --- a/flake.nix +++ b/flake.nix @@ -26,6 +26,7 @@ imports = [ (import ./modules/nixos/default.nix inputs) ]; + options.omarchy = (import ./config.nix lib).omarchyOptions; config = { nixpkgs.config.allowUnfree = true; diff --git a/modules/home-manager/alacritty.nix b/modules/home-manager/alacritty.nix index ade8d53..7b438fb 100644 --- a/modules/home-manager/alacritty.nix +++ b/modules/home-manager/alacritty.nix @@ -2,11 +2,7 @@ config, pkgs, ... -}: let - cfg = config.omarchy; - themes = import ../themes.nix; - theme = themes.${cfg.theme}; -in { +}: { programs.alacritty = { enable = true; settings = { @@ -42,28 +38,26 @@ in { # Colors colors = { - primary.background = theme.background; - primary.foreground = theme.foreground; + primary.background = "#${config.colorScheme.palette.base00}"; + primary.foreground = "#${config.colorScheme.palette.base05}"; - normal.black = theme.black; - normal.red = theme.red; - normal.green = theme.green; - normal.yellow = theme.yellow; - normal.blue = theme.blue; - normal.magenta = theme.magenta; - normal.cyan = theme.cyan; - normal.white = theme.white; + normal.black = "#${config.colorScheme.palette.base00}"; + normal.red = "#${config.colorScheme.palette.base08}"; + normal.green = "#${config.colorScheme.palette.base0B}"; + normal.yellow = "#${config.colorScheme.palette.base0A}"; + normal.blue = "#${config.colorScheme.palette.base0D}"; + normal.magenta = "#${config.colorScheme.palette.base0E}"; + normal.cyan = "#${config.colorScheme.palette.base0C}"; + normal.white = "#${config.colorScheme.palette.base05}"; - bright.black = theme.bright_black; - bright.red = theme.bright_red; - bright.green = theme.bright_green; - bright.yellow = theme.bright_yellow; - bright.blue = theme.bright_blue; - bright.magenta = theme.bright_magenta; - bright.cyan = theme.bright_cyan; - bright.white = theme.bright_white; - - selection.background = theme.primary; + bright.black = "#${config.colorScheme.palette.base03}"; + bright.red = "#${config.colorScheme.palette.base09}"; + bright.green = "#${config.colorScheme.palette.base01}"; + bright.yellow = "#${config.colorScheme.palette.base02}"; + bright.blue = "#${config.colorScheme.palette.base04}"; + bright.magenta = "#${config.colorScheme.palette.base06}"; + bright.cyan = "#${config.colorScheme.palette.base0F}"; + bright.white = "#${config.colorScheme.palette.base07}"; }; }; }; diff --git a/modules/home-manager/btop.nix b/modules/home-manager/btop.nix index 5789262..704c205 100644 --- a/modules/home-manager/btop.nix +++ b/modules/home-manager/btop.nix @@ -4,90 +4,78 @@ ... }: let cfg = config.omarchy; - themes = import ../themes.nix; - theme = themes.${cfg.theme}; + palette = config.colorScheme.palette; in { home.file = { ".config/btop/themes/${cfg.theme}.theme" = { text = '' - # Main bg - theme[main_bg]="${theme.background}" - # Main text color - theme[main_fg]="${theme.foreground_muted}" + theme[main_fg]="${palette.base05}" # Title color for boxes - theme[title]="${theme.foreground_muted}" + theme[title]="${palette.base05}" # Highlight color for keyboard shortcuts - theme[hi_fg]="${theme.primary_variant}" + theme[hi_fg]="${palette.base0D}" # Background color of selected item in processes box - theme[selected_bg]="${theme.surface}" + theme[selected_bg]="${palette.base01}" # Foreground color of selected item in processes box - theme[selected_fg]="${theme.foreground_muted}" + theme[selected_fg]="${palette.base05}" # Color of inactive/disabled text - theme[inactive_fg]="${theme.inactive}" + theme[inactive_fg]="${palette.base04}" # Misc colors for processes box including mini cpu graphs, details memory graph and details status text - theme[proc_misc]="${theme.primary_variant}" + theme[proc_misc]="${palette.base0D}" # Cpu box outline color - theme[cpu_box]="${theme.inactive}" + theme[cpu_box]="${palette.base0B}" # Memory/disks box outline color - theme[mem_box]="${theme.inactive}" + theme[mem_box]="${palette.base09}" # Net up/down box outline color - theme[net_box]="${theme.inactive}" + theme[net_box]="${palette.base0E}" # Processes box outline color - theme[proc_box]="${theme.inactive}" + theme[proc_box]="${palette.base0C}" # Box divider line and small boxes line color - theme[div_line]="${theme.inactive}" + theme[div_line]="${palette.base04}" # Temperature graph colors - theme[temp_start]="${theme.success}" - theme[temp_mid]="${theme.warning}" - theme[temp_end]="${theme.error}" + theme[temp_start]="${palette.base0B}" + theme[temp_mid]="${palette.base0A}" + theme[temp_end]="${palette.base08}" # CPU graph colors - theme[cpu_start]="${theme.success}" - theme[cpu_mid]="${theme.warning}" - theme[cpu_end]="${theme.error}" + theme[cpu_start]="${palette.base0B}" + theme[cpu_mid]="${palette.base0A}" + theme[cpu_end]="${palette.base08}" # Mem/Disk free meter - theme[free_start]="${theme.success}" - theme[free_mid]="${theme.warning}" - theme[free_end]="${theme.error}" + theme[free_start]="${palette.base0B}" # Mem/Disk cached meter - theme[cached_start]="${theme.success}" - theme[cached_mid]="${theme.warning}" - theme[cached_end]="${theme.error}" + theme[cached_start]="${palette.base0A}" # Mem/Disk available meter - theme[available_start]="${theme.success}" - theme[available_mid]="${theme.warning}" - theme[available_end]="${theme.error}" + theme[available_start]="${palette.base09}" # Mem/Disk used meter - theme[used_start]="${theme.success}" - theme[used_mid]="${theme.warning}" - theme[used_end]="${theme.error}" + theme[used_start]="${palette.base08}" # Download graph colors - theme[download_start]="${theme.success}" - theme[download_mid]="${theme.warning}" - theme[download_end]="${theme.error}" + theme[download_start]="${palette.base0E}" + theme[download_mid]="${palette.base0D}" + theme[download_end]="${palette.base0C}" # Upload graph colors - theme[upload_start]="${theme.success}" - theme[upload_mid]="${theme.warning}" - theme[upload_end]="${theme.error}" + theme[upload_start]="${palette.base0E}" + theme[upload_mid]="${palette.base0D}" + theme[upload_end]="${palette.base0C}" ''; }; }; diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index 0ee8836..1135ca1 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -4,6 +4,9 @@ inputs: { ... }: let packages = import ../packages.nix {inherit pkgs;}; + + themes = import ../themes.nix; + selectedTheme = themes.${config.omarchy.theme}; in { imports = [ (import ./hyprland.nix inputs) @@ -25,6 +28,8 @@ in { home.packages = packages.homePackages; + colorScheme = inputs.nix-colors.colorSchemes.${selectedTheme.base16-theme}; + dconf.settings = { "org/gnome/desktop/interface" = { color-scheme = "prefer-dark"; diff --git a/modules/home-manager/hyprland/looknfeel.nix b/modules/home-manager/hyprland/looknfeel.nix index 24f699e..80185bf 100644 --- a/modules/home-manager/hyprland/looknfeel.nix +++ b/modules/home-manager/hyprland/looknfeel.nix @@ -3,21 +3,11 @@ pkgs, ... }: let - cfg = config.omarchy; - themes = import ../../themes.nix; - theme = themes.${cfg.theme}; - - # Convert hex color to rgba format for hyprland hexToRgba = hex: alpha: let - cleanHex = builtins.substring 1 6 hex; # Remove the # prefix - in "rgba(${cleanHex}${alpha})"; + in "rgba(${hex}${alpha})"; - # Special handling for tokyo-night gradient - # Probably shouldn't be here. - activeBorder = - if cfg.theme == "tokyo-night" - then "${hexToRgba theme.accent "ee"} ${hexToRgba theme.success "ee"} 45deg" - else hexToRgba theme.foreground "ff"; + inactiveBorder = hexToRgba config.colorScheme.palette.base09 "aa"; + activeBorder = hexToRgba config.colorScheme.palette.base0D "aa"; in { wayland.windowManager.hyprland.settings = { general = { @@ -27,7 +17,7 @@ in { border_size = 2; "col.active_border" = activeBorder; - "col.inactive_border" = hexToRgba theme.surface_variant "aa"; + "col.inactive_border" = inactiveBorder; resize_on_border = false; @@ -43,7 +33,7 @@ in { enabled = true; range = 2; render_power = 3; - color = hexToRgba theme.background "ee"; + # color = hexToRgba config.colorScheme.palette.base00 "ee"; }; blur = { diff --git a/modules/home-manager/hyprlock.nix b/modules/home-manager/hyprlock.nix index 2131050..35a2cd4 100644 --- a/modules/home-manager/hyprlock.nix +++ b/modules/home-manager/hyprlock.nix @@ -4,14 +4,14 @@ inputs: { lib, ... }: let - cfg = config.omarchy; - themes = import ../themes.nix; - theme = themes.${cfg.theme}; - backgroundRgb = "rgb(${inputs.nix-colors.lib.conversions.hexToRGBString ", " (builtins.substring 1 6 theme.background)})"; - surfaceRgb = "rgb(${inputs.nix-colors.lib.conversions.hexToRGBString ", " (builtins.substring 1 6 theme.surface)})"; - foregroundRgb = "rgb(${inputs.nix-colors.lib.conversions.hexToRGBString ", " (builtins.substring 1 6 theme.foreground)})"; - foregroundMutedRgb = "rgb(${inputs.nix-colors.lib.conversions.hexToRGBString ", " (builtins.substring 1 6 theme.foreground_muted)})"; + palette = config.colorScheme.palette; + convert = inputs.nix-colors.lib.conversions.hexToRGBString; + + backgroundRgb = "rgb(${convert ", " palette.base00 })"; + surfaceRgb = "rgb(${convert ", " palette.base02 })"; + foregroundRgb = "rgb(${convert ", " palette.base0B })"; + foregroundMutedRgb = "rgb(${convert ", " palette.base04 })"; in { programs.hyprlock = { enable = true; diff --git a/modules/home-manager/mako.nix b/modules/home-manager/mako.nix index 3509b75..44d7cc0 100644 --- a/modules/home-manager/mako.nix +++ b/modules/home-manager/mako.nix @@ -4,17 +4,15 @@ ... }: let cfg = config.omarchy; - themes = import ../themes.nix; - theme = themes.${cfg.theme}; in { services.mako = { enable = true; settings = { - background-color = theme.background; - text-color = theme.foreground; - border-color = theme.accent; - progress-color = theme.primary; + background-color = "#${config.colorScheme.palette.base00}"; + text-color = "${config.colorScheme.palette.base05}"; + border-color = "${config.colorScheme.palette.base04}"; + progress-color = "${config.colorScheme.palette.base0D}"; width = 420; height = 110; diff --git a/modules/home-manager/vscode.nix b/modules/home-manager/vscode.nix index 722ca7f..a620de7 100644 --- a/modules/home-manager/vscode.nix +++ b/modules/home-manager/vscode.nix @@ -12,7 +12,7 @@ in { profiles.default = { userSettings = { - "workbench.colorTheme" = theme.vscode_theme; + "workbench.colorTheme" = theme.vscode-theme; "vim.useCtrlKeys" = false; "editor.minimap.enabled" = false; } diff --git a/modules/home-manager/waybar.nix b/modules/home-manager/waybar.nix index 4eaa404..aab4e15 100644 --- a/modules/home-manager/waybar.nix +++ b/modules/home-manager/waybar.nix @@ -2,11 +2,7 @@ config, pkgs, ... -}: let - cfg = config.omarchy; - themes = import ../themes.nix; - theme = themes.${cfg.theme}; -in { +}: { home.file = { ".config/waybar/" = { source = ../../config/waybar; @@ -15,8 +11,8 @@ in { ".config/waybar/theme.css" = { text = '' * { - color: ${theme.foreground}; - background-color: ${theme.background}; + color: #${config.colorScheme.palette.base05}; + background-color: #${config.colorScheme.palette.base00}; } ''; }; @@ -75,7 +71,7 @@ in { on-click = "alacritty -e btop"; }; clock = { - format = "{:%A %H:%M}"; + format = "{:%A %I:%M %p}"; format-alt = "{:%d %B W%V %Y}"; tooltip = false; }; diff --git a/modules/home-manager/wofi.nix b/modules/home-manager/wofi.nix index de25aab..91b89af 100644 --- a/modules/home-manager/wofi.nix +++ b/modules/home-manager/wofi.nix @@ -2,11 +2,7 @@ config, pkgs, ... -}: let - cfg = config.omarchy; - themes = import ../themes.nix; - theme = themes.${cfg.theme}; -in { +}: { home.file = { ".config/wofi/style.css" = { text = '' @@ -18,7 +14,7 @@ in { window { margin: 0px; padding: 20px; - background-color: ${theme.background}; + background-color: #${config.colorScheme.palette.base00}; opacity: 0.95; } @@ -26,28 +22,28 @@ in { margin: 0; padding: 0; border: none; - background-color: ${theme.background}; + background-color: #${config.colorScheme.palette.base00}; } #outer-box { margin: 0; padding: 20px; border: none; - background-color: ${theme.background}; + background-color: #${config.colorScheme.palette.base00}; } #scroll { margin: 0; padding: 0; border: none; - background-color: ${theme.background}; + background-color: #${config.colorScheme.palette.base00}; } #input { margin: 0; padding: 10px; border: none; - background-color: ${theme.background}; + background-color: #${config.colorScheme.palette.base00}; color: @text; } @@ -60,11 +56,11 @@ in { #text { margin: 5px; border: none; - color: ${theme.foreground_muted} + color: #${config.colorScheme.palette.base06}; } #entry { - background-color: ${theme.background}; + background-color: #${config.colorScheme.palette.base00}; } #entry:selected { @@ -73,7 +69,7 @@ in { } #entry:selected #text { - color: ${theme.primary_variant}; + color: #${config.colorScheme.palette.base02}; } #entry image { diff --git a/modules/nixos/system.nix b/modules/nixos/system.nix index 20dcb26..324e8ad 100644 --- a/modules/nixos/system.nix +++ b/modules/nixos/system.nix @@ -38,4 +38,6 @@ in { noto-fonts-emoji nerd-fonts.caskaydia-mono ]; + + } diff --git a/modules/themes.nix b/modules/themes.nix index 5abb596..c87ab71 100644 --- a/modules/themes.nix +++ b/modules/themes.nix @@ -1,255 +1,25 @@ { "tokyo-night" = { - # Base colors - background = "#1a1b26"; - foreground = "#a9b1d6"; - surface = "#414868"; - surface_variant = "#565f89"; - - # Primary colors - primary = "#7aa2f7"; - primary_variant = "#7dcfff"; - secondary = "#bb9af7"; - accent = "#33ccff"; - - # Status colors - success = "#9ece6a"; - warning = "#e0af68"; - error = "#f7768e"; - info = "#7aa2f7"; - - # Terminal colors - black = "#32344a"; - red = "#f7768e"; - green = "#9ece6a"; - yellow = "#e0af68"; - blue = "#7aa2f7"; - magenta = "#ad8ee6"; - cyan = "#449dab"; - white = "#787c99"; - - # Bright terminal colors - bright_black = "#444b6a"; - bright_red = "#ff7a93"; - bright_green = "#b9f27c"; - bright_yellow = "#ff9e64"; - bright_blue = "#7da6ff"; - bright_magenta = "#bb9af7"; - bright_cyan = "#0db9d7"; - bright_white = "#acb0d0"; - - # UI elements - border = "#33ccff"; - selection = "#7aa2f7"; - inactive = "#565f89"; - foreground_muted = "#cfc9c2"; - - # VSCode theme - vscode_theme = "Tokyo Night"; + base16-theme = "tokyo-night-dark"; + vscode-theme = "Tokyo Night"; }; "catppuccin-macchiato" = { - # Base colors - background = "#24273a"; - foreground = "#cad3f5"; - surface = "#51576d"; - surface_variant = "#838ba7"; - - # Primary colors - primary = "#8caaee"; - primary_variant = "#8aadf4"; - secondary = "#f5bde6"; - accent = "#c6d0f5"; - - # Status colors - success = "#a6d189"; - warning = "#e5c890"; - error = "#ed8796"; - info = "#8caaee"; - - # Terminal colors - black = "#494d64"; - red = "#ed8796"; - green = "#a6da95"; - yellow = "#eed49f"; - blue = "#8aadf4"; - magenta = "#f5bde6"; - cyan = "#8bd5ca"; - white = "#b8c0e0"; - - # Bright terminal colors - bright_black = "#5b6078"; - bright_red = "#ed8796"; - bright_green = "#a6da95"; - bright_yellow = "#eed49f"; - bright_blue = "#8aadf4"; - bright_magenta = "#f5bde6"; - bright_cyan = "#8bd5ca"; - bright_white = "#a5adcb"; - - # UI elements - border = "#c6d0f5"; - selection = "#f4dbd6"; - inactive = "#838ba7"; - foreground_muted = "#c6d0f5"; - - # Special colors - orange = "#f5a97f"; - rosewater = "#f4dbd6"; - - # VSCode theme - vscode_theme = "Catppuccin Macchiato"; + vscode-theme = "Catppuccin Macchiato"; }; "kanagawa" = { - # Base colors - background = "#1f1f28"; - foreground = "#dcd7ba"; - surface = "#2d4f67"; - surface_variant = "#727169"; - - # Primary colors - primary = "#7e9cd8"; - primary_variant = "#7fb4ca"; - secondary = "#957fb8"; - accent = "#938aa9"; - - # Status colors - success = "#76946a"; - warning = "#c0a36e"; - error = "#c34043"; - info = "#7e9cd8"; - - # Terminal colors - black = "#090618"; - red = "#c34043"; - green = "#76946a"; - yellow = "#c0a36e"; - blue = "#7e9cd8"; - magenta = "#957fb8"; - cyan = "#6a9589"; - white = "#c8c093"; - - # Bright terminal colors - bright_black = "#727169"; - bright_red = "#e82424"; - bright_green = "#98bb6c"; - bright_yellow = "#e6c384"; - bright_blue = "#7fb4ca"; - bright_magenta = "#938aa9"; - bright_cyan = "#7aa89f"; - bright_white = "#dcd7ba"; - - # UI elements - border = "#938aa9"; - selection = "#2d4f67"; - inactive = "#727169"; - foreground_muted = "#c8c093"; - - # Special colors - orange = "#ffa066"; - peach = "#ff5d62"; - - # VSCode theme - vscode_theme = "Kanagawa"; + base16-theme = "kanagawa"; + vscode-theme = "Kanagawa"; }; "everforest" = { - # Base colors - background = "#2d353b"; - foreground = "#d3c6aa"; - surface = "#3d484d"; - surface_variant = "#475258"; - - # Primary colors - primary = "#7fbbb3"; - primary_variant = "#83c092"; - secondary = "#d699b6"; - accent = "#e67e80"; - - # Status colors - success = "#a7c080"; - warning = "#dbbc7f"; - error = "#e67e80"; - info = "#7fbbb3"; - - # Terminal colors - black = "#475258"; - red = "#e67e80"; - green = "#a7c080"; - yellow = "#dbbc7f"; - blue = "#7fbbb3"; - magenta = "#d699b6"; - cyan = "#83c092"; - white = "#d3c6aa"; - - # Bright terminal colors (same as normal for this theme) - bright_black = "#475258"; - bright_red = "#e67e80"; - bright_green = "#a7c080"; - bright_yellow = "#dbbc7f"; - bright_blue = "#7fbbb3"; - bright_magenta = "#d699b6"; - bright_cyan = "#83c092"; - bright_white = "#d3c6aa"; - - # UI elements - border = "#3d484d"; - selection = "#3d484d"; - inactive = "#2d353b"; - foreground_muted = "#d3c6aa"; - - # VSCode theme - vscode_theme = "Everforest Dark"; + base16-theme = "everforest"; + vscode-theme = "Everforest Dark"; }; "gruvbox" = { - # Base colors - background = "#282828"; - foreground = "#d4be98"; - surface = "#3c3836"; - surface_variant = "#504945"; - - # Primary colors - primary = "#7daea3"; - primary_variant = "#89b482"; - secondary = "#d3869b"; - accent = "#d8a657"; - - # Status colors - success = "#a9b665"; - warning = "#d8a657"; - error = "#ea6962"; - info = "#7daea3"; - - # Terminal colors - black = "#3c3836"; - red = "#ea6962"; - green = "#a9b665"; - yellow = "#d8a657"; - blue = "#7daea3"; - magenta = "#d3869b"; - cyan = "#89b482"; - white = "#d4be98"; - - # Bright terminal colors (same as normal for this theme) - bright_black = "#3c3836"; - bright_red = "#ea6962"; - bright_green = "#a9b665"; - bright_yellow = "#d8a657"; - bright_blue = "#7daea3"; - bright_magenta = "#d3869b"; - bright_cyan = "#89b482"; - bright_white = "#d4be98"; - - # UI elements - border = "#504945"; - selection = "#504945"; - inactive = "#665c54"; - foreground_muted = "#bdae93"; - - # VSCode theme - vscode_theme = "Gruvbox Dark"; + vscode-theme = "Gruvbox Dark"; }; "catppuccin-mocha" = { @@ -302,7 +72,7 @@ rosewater = "#f5e0dc"; # VSCode theme - vscode_theme = "Catppuccin Mocha"; + vscode-theme = "Catppuccin Mocha"; }; # "nord" = {};