-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚀 feat(core): Add colorscheme.lua file for theme management
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
local function daylight() | ||
local h = tonumber(os.date('%H')) | ||
if h > 8 and h < 17 then | ||
return 'light' | ||
else | ||
return 'dark' | ||
end | ||
end | ||
|
||
local loading_theme | ||
|
||
local function randomscheme() | ||
math.randomseed(os.time()) | ||
local themes = { | ||
'starry.nvim', | ||
'aurora', | ||
'starry.nvim', | ||
'aurora', | ||
'catppuccin', | ||
'galaxy', | ||
} | ||
local style = daylight() | ||
|
||
if style == 'light' then | ||
-- vim.o.background = "light" | ||
themes = { 'starry.nvim', 'catppuccin' } | ||
end | ||
|
||
-- themes = { "starry.nvim", "starry.nvim", "aurora", "galaxy", "catppuccin", "tokyonight.nvim" } | ||
themes = { 'starry.nvim', 'aurora', 'galaxy' } | ||
-- themes = { 'galaxy' } | ||
local v = math.random(1, #themes) | ||
|
||
loading_theme = themes[v] | ||
return loading_theme | ||
end | ||
|
||
local function load_colorscheme(theme) | ||
if not theme then | ||
theme = randomscheme() | ||
end | ||
lprint('loading theme: ' .. theme) | ||
if theme == 'galaxy' then | ||
require('modules.ui.galaxy').shine() | ||
else | ||
require('lazy').load({ plugins = { theme } }) | ||
end | ||
end | ||
|
||
return { | ||
randomscheme = randomscheme, | ||
load_colorscheme = load_colorscheme, | ||
current_theme = loading_theme, | ||
} |