omnixient/modules/themes/tokyo-night.nix
Padreug 23f1f31a23 feat(themes): theme system and 12 colorscheme modules
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 09:59:04 +02:00

280 lines
7.8 KiB
Nix

{
config,
pkgs,
lib,
inputs,
...
}:
let
cfg = config.omni;
user = cfg.user;
# Use nix-colors if available, otherwise manual colors
useNixColors = cfg.colorScheme != null;
colorScheme = cfg.colorScheme;
c = {
bg = "#1a1b26";
bgAlt = "#16161e";
bgHighlight = "#33467c";
bgMuted = "#414868";
fg = "#c0caf5";
fgAlt = "#a9b1d6";
red = "#f7768e";
green = "#9ece6a";
yellow = "#e0af68";
blue = "#7aa2f7";
magenta = "#bb9af7";
cyan = "#7dcfff";
black = "#15161e";
orange = "#ff9e64";
};
getColor =
name: fallback:
if useNixColors && colorScheme ? colors && colorScheme.colors ? ${name} then
"#${colorScheme.colors.${name}}"
else
fallback;
in
{
config = {
omni.desktop.wallpaper = ./wallpapers/tokyo-night/1-scenery-pink-lakeside-sunset-lake-landscape-scenic-panorama-7680x3215-144.png;
environment.variables = {
OMNI_THEME = "tokyo-night";
OMNI_THEME_BG = getColor "base00" c.bg;
OMNI_THEME_FG = getColor "base05" c.fg;
OMNI_THEME_ACCENT = getColor "base0D" c.blue;
};
home-manager.users.${user} = {
# Hyprland theme colors — merged into the base settings
wayland.windowManager.hyprland.settings = {
general = {
"col.active_border" = "rgba(7aa2f7ee) rgba(c4a7e7ee) 45deg";
"col.inactive_border" = "rgba(414868aa)";
};
# Hyprland 0.40+ moved `decoration.col.shadow` under the
# nested `decoration.shadow.color` block.
decoration.shadow.color = "rgba(1a1b26ee)";
};
# Waybar theme
programs.waybar.style = lib.mkForce ''
* {
font-family: "JetBrainsMono Nerd Font";
font-size: 13px;
}
window#waybar {
background: rgba(26, 27, 38, 0.9);
color: ${c.fg};
}
#workspaces button {
padding: 0 5px;
background: transparent;
color: ${c.fg};
border-bottom: 3px solid transparent;
}
#workspaces button.active {
background: rgba(122, 162, 247, 0.2);
border-bottom: 3px solid ${c.blue};
}
#clock, #battery, #cpu, #memory, #temperature,
#backlight, #network, #pulseaudio, #tray, #bluetooth {
padding: 0 10px;
margin: 0 5px;
}
#battery.charging { color: ${c.green}; }
#battery.warning:not(.charging) { color: ${c.orange}; }
#battery.critical:not(.charging) {
color: ${c.red};
animation: blink 0.5s linear infinite alternate;
}
@keyframes blink {
to { background-color: ${c.red}; color: ${c.bg}; }
}
'';
# Alacritty
programs.alacritty.settings.colors = {
primary = {
background = getColor "base00" c.bg;
foreground = getColor "base05" c.fg;
};
normal = {
black = getColor "base00" c.black;
red = getColor "base08" c.red;
green = getColor "base0B" c.green;
yellow = getColor "base0A" c.yellow;
blue = getColor "base0D" c.blue;
magenta = getColor "base0E" c.magenta;
cyan = getColor "base0C" c.cyan;
white = getColor "base05" c.fg;
};
bright = {
black = getColor "base03" c.bgMuted;
red = getColor "base08" c.red;
green = getColor "base0B" c.green;
yellow = getColor "base0A" c.yellow;
blue = getColor "base0D" c.blue;
magenta = getColor "base0E" c.magenta;
cyan = getColor "base0C" c.cyan;
white = getColor "base07" c.fg;
};
indexed_colors = [
{
index = 16;
color = getColor "base09" c.orange;
}
{
index = 17;
color = getColor "base0F" "#db4b4b";
}
];
};
# Kitty
programs.kitty = {
themeFile = "Tokyo Night";
settings = {
background = c.bg;
foreground = c.fg;
selection_background = c.bgHighlight;
selection_foreground = c.fg;
cursor = c.fg;
cursor_text_color = c.bg;
color0 = c.black;
color8 = c.bgMuted;
color1 = c.red;
color9 = c.red;
color2 = c.green;
color10 = c.green;
color3 = c.yellow;
color11 = c.yellow;
color4 = c.blue;
color12 = c.blue;
color5 = c.magenta;
color13 = c.magenta;
color6 = c.cyan;
color14 = c.cyan;
color7 = c.fgAlt;
color15 = c.fg;
};
};
# VS Code
programs.vscode.profiles.default.userSettings = {
"workbench.colorTheme" = "Tokyo Night";
"workbench.colorCustomizations" = {
"[Tokyo Night]" = {
"editor.background" = c.bg;
"editor.foreground" = c.fg;
"sideBar.background" = c.bgAlt;
"sideBar.foreground" = c.fgAlt;
"activityBar.background" = c.bgAlt;
"activityBar.foreground" = c.fg;
};
};
};
# GTK
gtk.theme = {
name = "adw-gtk3-dark";
package = pkgs.adw-gtk3;
};
# Starship
programs.starship.settings = {
palette = "tokyo-night";
palettes.tokyo-night = {
bg = c.bg;
fg = c.fg;
black = c.black;
red = c.red;
green = c.green;
yellow = c.yellow;
blue = c.blue;
magenta = c.magenta;
cyan = c.cyan;
white = c.fgAlt;
};
character = {
success_symbol = "[](green)";
error_symbol = "[](red)";
};
directory.style = "blue";
git_branch.style = "magenta";
git_status.style = "red";
};
# Neovim
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = tokyonight-nvim;
type = "lua";
config = "vim.cmd[[colorscheme tokyonight-night]]";
}
];
# Bat
programs.bat.config.theme = "TwoDark";
# btop
programs.btop.settings.color_theme = "tokyo-night";
# Lazygit
programs.lazygit.settings.gui.theme = {
activeBorderColor = [
c.blue
"bold"
];
inactiveBorderColor = [ c.bgMuted ];
selectedLineBgColor = [ c.bgHighlight ];
selectedRangeBgColor = [ c.bgHighlight ];
cherryPickedCommitBgColor = [ c.bgHighlight ];
cherryPickedCommitFgColor = [ c.blue ];
unstagedChangesColor = [ c.red ];
defaultFgColor = [ c.fg ];
};
# Firefox
programs.firefox.profiles.default.userChrome = ''
:root {
--toolbar-bgcolor: ${c.bg} !important;
--toolbar-color: ${c.fg} !important;
--toolbarbutton-hover-background: ${c.bgHighlight} !important;
--toolbarbutton-active-background: ${c.bgMuted} !important;
--urlbar-focused-bg-color: ${c.bg} !important;
--urlbar-focused-color: ${c.fg} !important;
--tab-selected-bgcolor: ${c.bgHighlight} !important;
--tab-selected-color: ${c.fg} !important;
}
'';
# Mako notifications
services.mako.settings = {
background-color = c.bg;
text-color = c.fg;
border-color = c.blue;
progress-color = c.blue;
default-timeout = 5000;
border-radius = 10;
border-size = 2;
font = "JetBrainsMono Nerd Font 10";
padding = "10";
margin = "20";
};
# fzf colors
programs.fzf.defaultOptions = lib.mkForce [
"--height 40%"
"--layout reverse"
"--border"
"--inline-info"
"--color 'fg:${c.fg},fg+:${c.fg},bg:${c.bg},preview-bg:${c.bgAlt},border:${c.bgMuted}'"
];
};
};
}