Posted on: 02/08/2020
I prefer using a light colored theme during the day, and a dark colored theme during the night. If you think about it, it more closely resembles your natural environment right? It complements a blue light filter as well.
This is simply done with Vim using a timer:
function DynamicColorThemeSwitch()
let l:hour = strftime('%H')
if (l:hour < 15) && (l:hour > 3)
set background=light
else
set background=dark
endif
endfunction
"run every 10 mins repeatedly
call timer_start(1000 * 60 * 10, function('s:set_bg'), {'repeat': -1})
call DynamicColorThemeSwitch()
Based off with help from: https://vi.stackexchange.com/questions/24670/how-can-i-run-a-function-action-every-period-of-time-once-an-hour
If you have any suggestions for similar things like these, please let me know in the comments, I’d love to hear about them!
Comments
No comments, yet!
Submit a comment