2 Commits

Author SHA1 Message Date
Henry Sipp ad2dfc9af3 Fixes 2025-07-28 10:15:50 -05:00
Henry Sipp e3f8ea40cf Update theme system 2025-07-28 09:21:43 -05:00
5 changed files with 44 additions and 28 deletions
+24 -6
View File
@@ -69,21 +69,39 @@ Omarchy-nix includes several predefined themes:
- `gruvbox` - `gruvbox`
- `gruvbox-light` - `gruvbox-light`
You can also generate a custom theme from any wallpaper image: You can also generate themes from wallpaper images using:
- `generated_light` - generates a light color scheme from wallpaper
- `generated_dark` - generates a dark color scheme from wallpaper
Generated themes require a wallpaper path to be specified:
```nix ```nix
{ {
omarchy = { omarchy = {
theme = "custom"; theme = "generated_dark"; # or "generated_light"
customTheme = { theme_overrides = {
wallpaperPath = ./path/to/your/wallpaper.png; wallpaper_path = ./path/to/your/wallpaper.png;
variant = "dark"; # or "light" for light themes
}; };
}; };
} }
``` ```
This will automatically extract colors from your wallpaper and generate a matching color scheme for all Omarchy applications (terminal, editor, launcher, etc.). #### Wallpaper Overrides
Any theme can be customized with a custom wallpaper by specifying `wallpaper_path` in theme_overrides. For predefined themes, this will only change the wallpaper but keep the original color scheme:
```nix
{
omarchy = {
theme = "tokyo-night"; # or any other predefined theme
theme_overrides = {
wallpaper_path = ./path/to/your/wallpaper.png;
};
};
}
```
Generated themes automatically extract colors from the wallpaper and create a matching color scheme for all Omarchy applications (terminal, editor, launcher, etc.).
## License ## License
+7 -10
View File
@@ -17,27 +17,24 @@ lib: {
"nord" "nord"
"gruvbox" "gruvbox"
"gruvbox-light" "gruvbox-light"
"custom" "generated_light"
"generated_dark"
]) lib.types.str; ]) lib.types.str;
default = "tokyo-night"; default = "tokyo-night";
description = "Theme to use for Omarchy configuration"; description = "Theme to use for Omarchy configuration";
}; };
customTheme = lib.mkOption { theme_overrides = lib.mkOption {
type = lib.types.submodule { type = lib.types.submodule {
options = { options = {
wallpaperPath = lib.mkOption { wallpaper_path = lib.mkOption {
type = lib.types.path; type = lib.types.nullOr lib.types.path;
default = null;
description = "Path to the wallpaper image to extract colors from"; description = "Path to the wallpaper image to extract colors from";
}; };
variant = lib.mkOption {
type = lib.types.enum [ "light" "dark" ];
default = "dark";
description = "Color scheme variant to extract (light or dark)";
};
}; };
}; };
default = {}; default = {};
description = "Custom theme configuration when theme is set to 'custom'"; description = "Theme overrides including wallpaper path for generated themes";
}; };
primary_font = lib.mkOption { primary_font = lib.mkOption {
type = lib.types.str; type = lib.types.str;
+3 -3
View File
@@ -21,9 +21,9 @@ config: let
]; ];
}; };
# Handle custom wallpaper path # Handle wallpaper path for generated themes and overrides
wallpaper_path = if cfg.theme == "custom" wallpaper_path = if (cfg.theme == "generated_light" || cfg.theme == "generated_dark") || (cfg.theme_overrides.wallpaper_path != null)
then toString cfg.customTheme.wallpaperPath then toString cfg.theme_overrides.wallpaper_path
else let else let
selected_wallpaper = builtins.elemAt (wallpapers.${cfg.theme}) 0; selected_wallpaper = builtins.elemAt (wallpapers.${cfg.theme}) 0;
in "~/Pictures/Wallpapers/${selected_wallpaper}"; in "~/Pictures/Wallpapers/${selected_wallpaper}";
+8 -8
View File
@@ -8,16 +8,16 @@ inputs: {
themes = import ../themes.nix; themes = import ../themes.nix;
# Handle theme selection - either predefined or custom # Handle theme selection - either predefined or generated
selectedTheme = if config.omarchy.theme == "custom" selectedTheme = if (config.omarchy.theme == "generated_light" || config.omarchy.theme == "generated_dark")
then themes.custom then null
else themes.${config.omarchy.theme}; else themes.${config.omarchy.theme};
# Generate color scheme - either from predefined or from wallpaper # Generate color scheme from wallpaper for generated themes
generatedColorScheme = if config.omarchy.theme == "custom" generatedColorScheme = if (config.omarchy.theme == "generated_light" || config.omarchy.theme == "generated_dark")
then (inputs.nix-colors.lib.contrib { inherit pkgs; }).colorSchemeFromPicture { then (inputs.nix-colors.lib.contrib { inherit pkgs; }).colorSchemeFromPicture {
path = config.omarchy.customTheme.wallpaperPath; path = config.omarchy.theme_overrides.wallpaper_path;
variant = config.omarchy.customTheme.variant; variant = if config.omarchy.theme == "generated_light" then "light" else "dark";
} }
else null; else null;
in { in {
@@ -47,7 +47,7 @@ in {
}; };
home.packages = packages.homePackages; home.packages = packages.homePackages;
colorScheme = if config.omarchy.theme == "custom" colorScheme = if (config.omarchy.theme == "generated_light" || config.omarchy.theme == "generated_dark")
then generatedColorScheme then generatedColorScheme
else inputs.nix-colors.colorSchemes.${selectedTheme.base16-theme}; else inputs.nix-colors.colorSchemes.${selectedTheme.base16-theme};
+2 -1
View File
@@ -6,6 +6,7 @@ inputs: {
palette = config.colorScheme.palette; palette = config.colorScheme.palette;
convert = inputs.nix-colors.lib.conversions.hexToRGBString; convert = inputs.nix-colors.lib.conversions.hexToRGBString;
backgroundRgb = "rgb(${convert ", " palette.base00})"; backgroundRgb = "rgb(${convert ", " palette.base00})";
foregroundRgb = "rgb(${convert ", " palette.base05})";
in { in {
home.file = { home.file = {
".config/waybar/" = { ".config/waybar/" = {
@@ -16,7 +17,7 @@ in {
text = '' text = ''
@define-color background ${backgroundRgb}; @define-color background ${backgroundRgb};
* { * {
color: white; color: ${foregroundRgb};
} }
window#waybar { window#waybar {