Skip to content

Commit 1a269d0

Browse files
committed
adding a readme
1 parent 63d3ced commit 1a269d0

File tree

1 file changed

+124
-0
lines changed

1 file changed

+124
-0
lines changed

README.md

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Colorful Times
2+
3+
A Neovim plugin that automatically changes your colorscheme based on time schedules, system appearance settings, or manual toggling.
4+
5+
## Features
6+
7+
- **Time-based colorscheme switching**: Automatically changes colorschemes based on your schedule
8+
- **System appearance detection**: Follows your OS light/dark mode settings
9+
- **Overnight schedule support**: Handles schedules that cross midnight
10+
- **Low startup impact**: Uses lazy loading to minimize Neovim startup time
11+
- **Customizable refresh times**: Control how often system appearance is checked
12+
- **Manual controls**: Toggle the plugin on/off as needed
13+
14+
## Requirements
15+
16+
- Neovim >= 0.5.0
17+
- For testing: [plenary.nvim](https://github.com/nvim-lua/plenary.nvim)
18+
19+
## Installation
20+
21+
Using [packer.nvim](https://github.com/wbthomason/packer.nvim):
22+
23+
```lua
24+
use {
25+
'luxus/colorful-times-nvim',
26+
requires = { 'nvim-lua/plenary.nvim' }, -- Only needed for running tests
27+
}
28+
```
29+
30+
Using [lazy.nvim](https://github.com/folke/lazy.nvim):
31+
32+
```lua
33+
{
34+
'luxus/colorful-times-nvim',
35+
dependencies = { 'nvim-lua/plenary.nvim' }, -- Only needed for running tests
36+
},
37+
```
38+
39+
## Setup and Configuration
40+
41+
Add to your Neovim configuration:
42+
43+
```lua
44+
require('colorful-times').setup({
45+
-- Schedule entries for when to change colorschemes
46+
schedule = {
47+
{
48+
start = "08:00", -- 8 AM
49+
stop = "18:00", -- 6 PM
50+
colorscheme = "morning", -- your light colorscheme
51+
background = "light", -- optional: "light", "dark", or "system"
52+
},
53+
{
54+
start = "18:00", -- 6 PM
55+
stop = "08:00", -- 8 AM (next day)
56+
colorscheme = "evening", -- your dark colorscheme
57+
background = "dark", -- optional
58+
},
59+
},
60+
61+
-- Default settings when no schedule is active
62+
default = {
63+
colorscheme = "default", -- fallback colorscheme
64+
background = "system", -- "light", "dark", or "system" to follow OS settings
65+
},
66+
67+
-- Other options
68+
enabled = true, -- enable/disable the plugin
69+
refresh_time = 5000, -- check system appearance every 5 seconds (in ms)
70+
71+
-- Optional: custom command for Linux system background detection
72+
-- system_background_detection = "gsettings get org.gnome.desktop.interface color-scheme | grep -q 'prefer-dark'"
73+
})
74+
```
75+
76+
## Commands
77+
78+
Add these to your configuration for manual control:
79+
80+
```lua
81+
-- Toggle plugin on/off
82+
vim.api.nvim_create_user_command('ColorfulTimesToggle', function()
83+
require('colorful-times').toggle()
84+
end, {})
85+
86+
-- Reload configuration
87+
vim.api.nvim_create_user_command('ColorfulTimesReload', function()
88+
require('colorful-times').reload()
89+
end, {})
90+
```
91+
92+
## System Appearance Detection
93+
94+
- **macOS**: Automatically detects system appearance
95+
- **Linux**: Requires custom detection command in configuration
96+
- **Windows**: Not yet supported (contributions welcome!)
97+
98+
### Custom Linux Detection Example
99+
100+
For GNOME-based desktops:
101+
```lua
102+
system_background_detection = "gsettings get org.gnome.desktop.interface color-scheme | grep -q 'prefer-dark'"
103+
```
104+
105+
For KDE:
106+
```lua
107+
system_background_detection = "kreadconfig5 --group 'General' --key 'ColorScheme' --file 'kdeglobals' | grep -q 'Dark'"
108+
```
109+
110+
You can also provide a function that returns "light" or "dark":
111+
```lua
112+
system_background_detection = function()
113+
-- Custom detection logic
114+
return "dark" -- or "light"
115+
end
116+
```
117+
118+
## License
119+
120+
MIT
121+
122+
## Contributing
123+
124+
Contributions are welcome! Feel free to submit issues or pull requests.

0 commit comments

Comments
 (0)