From 8cdd8621337d4be3435e3967c887fca36e46721d Mon Sep 17 00:00:00 2001 From: Ade Attwood Date: Fri, 25 Jul 2025 11:26:36 +0100 Subject: [PATCH] feat(core): make wezterm nushell and nvim adapt theme Now all the terminal themes will adapt with the system theme. Like other apps it will not do this automatically, however needing to restart the terminal session is not to much is an issue. --- site-modules/core/files/nushell/config.nu | 5 +++++ site-modules/core/files/vim/plugin/colors.vim | 14 ++++++++------ site-modules/core/files/wezterm.lua | 16 ++++++++++++++-- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/site-modules/core/files/nushell/config.nu b/site-modules/core/files/nushell/config.nu index b45a170..21ebe1d 100644 --- a/site-modules/core/files/nushell/config.nu +++ b/site-modules/core/files/nushell/config.nu @@ -25,3 +25,8 @@ $env.config = { $env.config.show_banner = false $env.config.shell_integration.osc133 = false + +if $env.OS_THEME == "Light" { + use std/config light-theme + $env.config.color_config = (light-theme) +} diff --git a/site-modules/core/files/vim/plugin/colors.vim b/site-modules/core/files/vim/plugin/colors.vim index f43355d..69839da 100644 --- a/site-modules/core/files/vim/plugin/colors.vim +++ b/site-modules/core/files/vim/plugin/colors.vim @@ -1,9 +1,11 @@ -" Set color theme -lua << EOF - require("nord").setup({}) -EOF - -colorscheme nord +" Set color theme based on the OS theme +if $OS_THEME ==# 'Dark' + set background=dark + colorscheme tairiki +else + set background=light + colorscheme tairiki +end " Set tailing white space to errors match ErrorMsg '\s\+$' diff --git a/site-modules/core/files/wezterm.lua b/site-modules/core/files/wezterm.lua index 35d7965..c5f3b62 100644 --- a/site-modules/core/files/wezterm.lua +++ b/site-modules/core/files/wezterm.lua @@ -1,7 +1,15 @@ local wezterm = require "wezterm" +function scheme_for_appearance(appearance) + if appearance:find 'Dark' then + return 'Tomorrow Night' + else + return 'Tomorrow' + end +end + local scheme = wezterm.get_builtin_color_schemes() -local theme = scheme["Poimandres"] +local theme = scheme[scheme_for_appearance(wezterm.gui.get_appearance())] function collect_executables(process) local executables = {} @@ -58,8 +66,12 @@ return { family = "Hasklug Nerd Font Mono", }, + set_environment_variables = { + OS_THEME = wezterm.gui.get_appearance() + }, + -- -- The nord theme to fit with everyting else - color_scheme = "Poimandres", + color_scheme = scheme_for_appearance(wezterm.gui.get_appearance()), colors = { tab_bar = { background = theme.background,