Skip to content

Commit b79b54e

Browse files
committed
Merge branch 'master' into feat/use-new-neovim-apis-add-healthcheck
2 parents c8a1de5 + 02ef955 commit b79b54e

File tree

2 files changed

+121
-117
lines changed

2 files changed

+121
-117
lines changed

README.md

Lines changed: 58 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# auto-dark-mode.nvim
2+
23
A Neovim plugin for macOS, Linux, and Windows that automatically changes the
34
editor appearance based on system settings.
45

@@ -28,78 +29,82 @@ editor appearance based on system settings.
2829

2930
<!-- panvimdoc-ignore-end -->
3031

31-
## Installation
32-
33-
### Using [vim-plug](https://github.com/junegunn/vim-plug)
34-
35-
```vim
36-
Plug 'f-person/auto-dark-mode.nvim'
37-
```
32+
## 📋 Requirements
33+
Your operating system needs to be:
3834

39-
## Requirements
40-
* macOS, a Linux environment that implements
35+
- a Linux desktop environment that implements
4136
[`org.freedesktop.appearance.color-scheme`](https://github.com/flatpak/xdg-desktop-portal/issues/629),
42-
Windows 10+ or WSL
43-
* Neovim
37+
such as
38+
- [Gnome](https://gnome.org)
39+
- [KDE](https://kde.org)
40+
- [darkman](https://gitlab.com/WhyNotHugo/darkman) for window managers
41+
- macOS Mojave or newer
42+
- Windows 10 or newer (or WSL)
4443

45-
## Configuration
46-
You need to call `setup` for initialization.
47-
`setup` accepts a table with options – `set_dark_mode` function,
48-
`set_light_mode` function, and `update_interval` integer.
44+
## 📦 Installation
4945

50-
`set_dark_mode` is called when the system appearance changes to dark mode, and
51-
`set_light_mode` is called when it changes to light mode.
52-
By default, they just change the background option, but you can do whatever you like.
46+
Install the plugin with your preferred package manager:
5347

54-
`update_interval` is how frequently the system appearance is checked.
55-
The value needs to be larger than whatever time your system takes to query dark mode.
56-
Otherwise you risk freezing neovim on shutdown.
57-
The value is stored in milliseconds.
58-
Defaults to `3000`.
48+
### [lazy.nvim](https://github.com/folke/lazy.nvim)
5949

6050
```lua
61-
local auto_dark_mode = require('auto-dark-mode')
62-
63-
auto_dark_mode.setup({
64-
update_interval = 1000,
65-
set_dark_mode = function()
66-
vim.api.nvim_set_option_value('background', 'dark', {})
67-
vim.cmd('colorscheme gruvbox')
68-
end,
69-
set_light_mode = function()
70-
vim.api.nvim_set_option_value('background', 'light', {})
71-
vim.cmd('colorscheme gruvbox')
72-
end,
73-
})
51+
-- Lua
52+
{
53+
"f-person/auto-dark-mode.nvim",
54+
opts = {
55+
-- your configuration comes here
56+
-- or leave it empty to use the default settings
57+
-- refer to the configuration section below
58+
}
59+
}
60+
```
61+
62+
### [vim-plug](https://github.com/junegunn/vim-plug)
63+
64+
```vim
65+
Plug 'f-person/auto-dark-mode.nvim'
7466
```
7567

76-
### Using [lazy](https://github.com/folke/lazy.nvim)
68+
## ⚙️ Configuration
69+
70+
**auto-dark-mode** comes with the following defaults:
7771

7872
```lua
79-
return {
80-
"f-person/auto-dark-mode.nvim",
81-
opts = {
82-
update_interval = 1000,
73+
{
8374
set_dark_mode = function()
84-
vim.api.nvim_set_option_value("background", "dark", {})
85-
vim.cmd("colorscheme gruvbox")
75+
vim.api.nvim_set_option_value("background", "dark", {})
8676
end,
8777
set_light_mode = function()
88-
vim.api.nvim_set_option_value("background", "light", {})
89-
vim.cmd("colorscheme gruvbox")
78+
vim.api.nvim_set_option_value("background", "light", {})
9079
end,
91-
},
80+
update_interval = 3000,
81+
fallback = "dark"
9282
}
9383
```
9484

95-
#### Disable
85+
`set_dark_mode` and `set_light_mode` are the hooks called when the system
86+
appearance changes. By default, they change the
87+
[background](https://neovim.io/doc/user/options.html#'background') option,
88+
overriding the function allows for further customization.
89+
90+
`update_interval` is how frequently the system appearance is checked, in
91+
milliseconds. The value needs to be higher than the amount of milliseconds it
92+
takes to query your system for the dark mode state. Otherwise, you risk
93+
freezing neovim on shutdown.
94+
95+
`fallback` specifies the theme to use when the auto-detection fails. This can
96+
be particularly useful to specify a default version when remotely connecting
97+
via SSH, or when using neovim on a tty.
98+
99+
## 🚀 Usage
100+
101+
### Disabling at runtime
102+
96103
You can disable `auto-dark-mode.nvim` at runtime via `lua require('auto-dark-mode').disable()`.
97104

98-
## Thanks To
99-
* [@nekowinston](https://github.com/nekowinston) for implementing Linux support and other contributions! <3
100-
* [@adityamwagh](https://github.com/adityamwagh) for implementing Windows support
105+
## 💖 Contributors
106+
[![](https://contrib.rocks/image?repo=f-person/auto-dark-mode.nvim)](https://github.com/f-person/auto-dark-mode.nvim/graphs/contributors)
101107

102-
# Support
103-
If you enjoy the plugin and want to support what I do
104108

105-
<a href="https://www.buymeacoffee.com/fperson" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>
109+
👩‍🎤 Special thanks to [@nekowinston](https://github.com/nekowinston) for
110+
maintaining the plugin 👩‍🎤

doc/auto-dark-mode.txt

Lines changed: 63 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
Table of Contents *auto-dark-mode-table-of-contents*
55

66
1. auto-dark-mode.nvim |auto-dark-mode-auto-dark-mode.nvim|
7-
- Installation |auto-dark-mode-auto-dark-mode.nvim-installation|
8-
- Requirements |auto-dark-mode-auto-dark-mode.nvim-requirements|
9-
- Configuration |auto-dark-mode-auto-dark-mode.nvim-configuration|
10-
- Thanks To |auto-dark-mode-auto-dark-mode.nvim-thanks-to|
11-
2. Support |auto-dark-mode-support|
12-
3. Links |auto-dark-mode-links|
7+
- 📋 Requirements |auto-dark-mode-auto-dark-mode.nvim-📋-requirements|
8+
- 📦 Installation |auto-dark-mode-auto-dark-mode.nvim-📦-installation|
9+
- ⚙️ Configuration|auto-dark-mode-auto-dark-mode.nvim-⚙️-configuration|
10+
- 🚀 Usage |auto-dark-mode-auto-dark-mode.nvim-🚀-usage|
11+
- 💖 Contributors |auto-dark-mode-auto-dark-mode.nvim-💖-contributors|
12+
2. Links |auto-dark-mode-links|
1313

1414
==============================================================================
1515
1. auto-dark-mode.nvim *auto-dark-mode-auto-dark-mode.nvim*
@@ -18,100 +18,99 @@ A Neovim plugin for macOS, Linux, and Windows that automatically changes the
1818
editor appearance based on system settings.
1919

2020

21-
INSTALLATION *auto-dark-mode-auto-dark-mode.nvim-installation*
21+
📋 REQUIREMENTS *auto-dark-mode-auto-dark-mode.nvim-📋-requirements*
2222

23+
Your operating system needs to be:
2324

24-
USING VIM-PLUG ~
25-
26-
>vim
27-
Plug 'f-person/auto-dark-mode.nvim'
28-
<
25+
- a Linux desktop environment that implements
26+
`org.freedesktop.appearance.color-scheme` <https://github.com/flatpak/xdg-desktop-portal/issues/629>,
27+
such as
28+
- Gnome <https://gnome.org>
29+
- KDE <https://kde.org>
30+
- darkman <https://gitlab.com/WhyNotHugo/darkman> for window managers
31+
- macOS Mojave or newer
32+
- Windows 10 or newer (or WSL)
2933

3034

31-
REQUIREMENTS *auto-dark-mode-auto-dark-mode.nvim-requirements*
35+
📦 INSTALLATION *auto-dark-mode-auto-dark-mode.nvim-📦-installation*
3236

33-
- macOS, a Linux environment that implements
34-
`org.freedesktop.appearance.color-scheme` <https://github.com/flatpak/xdg-desktop-portal/issues/629>,
35-
Windows 10+ or WSL
36-
- Neovim
37+
Install the plugin with your preferred package manager:
3738

3839

39-
CONFIGURATION *auto-dark-mode-auto-dark-mode.nvim-configuration*
40+
LAZY.NVIM ~
4041

41-
You need to call `setup` for initialization. `setup` accepts a table with
42-
options – `set_dark_mode` function, `set_light_mode` function, and
43-
`update_interval` integer.
42+
>lua
43+
-- Lua
44+
{
45+
"f-person/auto-dark-mode.nvim",
46+
opts = {
47+
-- your configuration comes here
48+
-- or leave it empty to use the default settings
49+
-- refer to the configuration section below
50+
}
51+
}
52+
<
4453

45-
`set_dark_mode` is called when the system appearance changes to dark mode, and
46-
`set_light_mode` is called when it changes to light mode. By default, they just
47-
change the background option, but you can do whatever you like.
4854

49-
`update_interval` is how frequently the system appearance is checked. The value
50-
needs to be larger than whatever time your system takes to query dark mode.
51-
Otherwise you risk freezing neovim on shutdown. The value is stored in
52-
milliseconds. Defaults to `3000`.
55+
VIM-PLUG ~
5356

54-
>lua
55-
local auto_dark_mode = require('auto-dark-mode')
56-
57-
auto_dark_mode.setup({
58-
update_interval = 1000,
59-
set_dark_mode = function()
60-
vim.api.nvim_set_option_value('background', 'dark', {})
61-
vim.cmd('colorscheme gruvbox')
62-
end,
63-
set_light_mode = function()
64-
vim.api.nvim_set_option_value('background', 'light', {})
65-
vim.cmd('colorscheme gruvbox')
66-
end,
67-
})
57+
>vim
58+
Plug 'f-person/auto-dark-mode.nvim'
6859
<
6960

7061

71-
USING LAZY ~
62+
⚙️ CONFIGURATION *auto-dark-mode-auto-dark-mode.nvim-⚙️-configuration*
63+
64+
**auto-dark-mode** comes with the following defaults:
7265

7366
>lua
74-
return {
75-
"f-person/auto-dark-mode.nvim",
76-
opts = {
77-
update_interval = 1000,
67+
{
7868
set_dark_mode = function()
79-
vim.api.nvim_set_option_value("background", "dark", {})
80-
vim.cmd("colorscheme gruvbox")
69+
vim.api.nvim_set_option_value("background", "dark", {})
8170
end,
8271
set_light_mode = function()
83-
vim.api.nvim_set_option_value("background", "light", {})
84-
vim.cmd("colorscheme gruvbox")
72+
vim.api.nvim_set_option_value("background", "light", {})
8573
end,
86-
},
74+
update_interval = 3000,
75+
fallback = "dark"
8776
}
8877
<
8978

79+
`set_dark_mode` and `set_light_mode` are the hooks called when the system
80+
appearance changes. By default, they change the |background| option, overriding
81+
the function allows for further customization.
9082

91-
DISABLE
83+
`update_interval` is how frequently the system appearance is checked, in
84+
milliseconds. The value needs to be higher than the amount of milliseconds it
85+
takes to query your system for the dark mode state. Otherwise, you risk
86+
freezing neovim on shutdown.
9287

93-
You can disable `auto-dark-mode.nvim` at runtime via `lua
94-
require('auto-dark-mode').disable()`.
88+
`fallback` specifies the theme to use when the auto-detection fails. This can
89+
be particularly useful to specify a default version when remotely connecting
90+
via SSH, or when using neovim on a tty.
9591

9692

97-
THANKS TO *auto-dark-mode-auto-dark-mode.nvim-thanks-to*
93+
🚀 USAGE *auto-dark-mode-auto-dark-mode.nvim-🚀-usage*
9894

99-
- @nekowinston <https://github.com/nekowinston> for implementing Linux support and other contributions! <3
100-
- @adityamwagh <https://github.com/adityamwagh> for implementing Windows support
10195

96+
DISABLING AT RUNTIME ~
97+
98+
You can disable `auto-dark-mode.nvim` at runtime via `lua
99+
require('auto-dark-mode').disable()`.
102100

103-
==============================================================================
104-
2. Support *auto-dark-mode-support*
105101

106-
If you enjoy the plugin and want to support what I do
102+
💖 CONTRIBUTORS *auto-dark-mode-auto-dark-mode.nvim-💖-contributors*
107103

104+
<https://github.com/f-person/auto-dark-mode.nvim/graphs/contributors>
108105

106+
👩‍🎤 Special thanks to @nekowinston <https://github.com/nekowinston> for
107+
maintaining the plugin 👩‍🎤
109108

110109
==============================================================================
111-
3. Links *auto-dark-mode-links*
110+
2. Links *auto-dark-mode-links*
112111

113-
1. *@nekowinston*:
114-
2. *@adityamwagh*:
112+
1. **: https://contrib.rocks/image?repo=f-person/auto-dark-mode.nvim
113+
2. *@nekowinston*:
115114

116115
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>
117116

0 commit comments

Comments
 (0)