From 6812ae050b258892629af59012f3cf41845e1191 Mon Sep 17 00:00:00 2001 From: Dinesh Salunke Date: Sat, 19 Oct 2024 08:08:01 +0530 Subject: [PATCH] refactor: switch theme based on system appearence --- terminal.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/terminal.lua b/terminal.lua index f2280d1..3d36d2d 100644 --- a/terminal.lua +++ b/terminal.lua @@ -8,9 +8,24 @@ M.colors = { transparent = "rgba(0,0,0,0)", } +local function get_appearance() + if term.gui then + return term.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 + function M.options(config) config.status_update_interval = 1000 - config.color_scheme = "Catppuccin Mocha" + config.color_scheme = scheme_for_appearance(get_appearance()) config.animation_fps = 240 config.max_fps = 240