Skip to content

Commit

Permalink
feat(policy): add 'single' policy (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
linrongbin16 authored Dec 7, 2023
1 parent 5211c28 commit da537b4
Show file tree
Hide file tree
Showing 4 changed files with 169 additions and 92 deletions.
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ You can use command `Colorbox` to control the colorschemes player:
```lua
require('colorbox').setup({
-- builtin policy
--- @alias colorbox.BuiltinPolicyConfig "shuffle"|"in_order"|"reverse_order"|"single_cycle"
--- @alias colorbox.BuiltinPolicyConfig "shuffle"|"in_order"|"reverse_order"|"single"
---
-- by filetype policy: buffer filetype => color name
--- @alias colorbox.ByFileTypePolicyConfig {implement:colorbox.BuiltinPolicyConfig|table<string, string>}
Expand Down Expand Up @@ -266,14 +266,24 @@ Timing and policy configs have to work together.

- `timing`: 'startup' (on nvim start), 'interval' (fixed interval seconds), 'filetype' (by buffer filetype, todo).
- `policy`:
- Builtin policies (see `colorbox.BuiltinPolicyConfig`): 'shuffle' (random select), 'in_order' ('A-Z' color names), 'reverse_order' ('Z-A' color names), 'single_cycle' (don't change, todo).
- Builtin policies (see `colorbox.BuiltinPolicyConfig`): 'shuffle' (random select), 'in_order' ('A-Z' color names), 'reverse_order' ('Z-A' color names), 'single' (don't change).
- Fixed interval policies (see `colorbox.ByFileTypePolicyConfig`): todo.
- By buffer filetype policies (see ``)

To choose a colorscheme on nvim start, please use:
To choose a fixed colorscheme on nvim start, please use:

```lua
require('colorbox').setup({
policy = 'single',
timing = 'startup',
})
```

To choose a random colorscheme on nvim start with dark background, please use:

```lua
require('colorbox').setup({
background = 'dark',
policy = 'shuffle',
timing = 'startup',
})
Expand Down
Loading

0 comments on commit da537b4

Please sign in to comment.