-- protected call if the them is not present it just tells you about-- local colorscheme = "OceanicNextLight"-- local colorscheme = "tokyonight"functionisDayOrNight()-- Get the current timelocalcurrentTime=os.date("*t")-- Extract the hour from the current timelocalcurrentHour=currentTime.hour-- Define the hours that represent daytimelocalstartDaytimeHour=6localendDaytimeHour=18-- Check if the current hour is within the daytime rangeifcurrentHour>=startDaytimeHourandcurrentHour<endDaytimeHourthen-- return "day"return"OceanicNextLight"else-- return "night"return"tokyonight"endendlocalcolorscheme=isDayOrNight()-- vim.notify("Selected colorscheme: " .. colorscheme) -- Debugging message-- local colorscheme = "tokyonight"localstatus_ok,_=pcall(vim.cmd,"colorscheme "..colorscheme)ifnotstatus_okthenvim.notify("colorscheme "..colorscheme.." not found!")returnend
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.