Skip to content

Commit

Permalink
feat(nvim/wezterm): auto-change dark/light based on time
Browse files Browse the repository at this point in the history
  • Loading branch information
scottames committed Aug 3, 2023
1 parent f7a10c6 commit 8fd5d09
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
9 changes: 9 additions & 0 deletions home/private_dot_config/nvim/lua/config/options.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
-- Options are automatically loaded before lazy.nvim startup
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
-- Add any additional options here

local opt = vim.opt

local time = os.date("*t")
local hr = time.hour

if hr > 6 and hr < 20 then
opt.background = "light"
end
18 changes: 17 additions & 1 deletion home/private_dot_config/wezterm/wezterm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ if w.config_builder then
c = w.config_builder()
end

c.color_scheme = "Catppuccin Mocha"
c.default_cursor_style = "BlinkingBar"
c.font = w.font("FiraCode Nerd Font Mono")
c.font_size = 13.5
Expand All @@ -19,4 +18,21 @@ c.window_decorations = "RESIZE"
c.window_background_opacity = 0.90
c.window_close_confirmation = "AlwaysPrompt"

local function get_appearance()
if w.gui then
return w.gui.get_appearance()
end
return "Dark"
end

local function scheme_for_appearance(appearance)
if appearance:find("Dark") then
return "Catppuccin Mocha"
else
return "Catppuccin Latte"
end
end

c.color_scheme = scheme_for_appearance(get_appearance())

return c

0 comments on commit 8fd5d09

Please sign in to comment.