From dcbaed04d7191692955805d7f71fcf16ca55943e Mon Sep 17 00:00:00 2001 From: Michael Chris Lopez Date: Sun, 7 Nov 2021 09:30:44 +0800 Subject: [PATCH] feat: add randombones --- README.md | 1 + colors/randombones.vim | 15 +++++++++++++++ doc/zenbones.md | 1 + 3 files changed, 17 insertions(+) create mode 100644 colors/randombones.vim diff --git a/README.md b/README.md index fc03d03..1eeb37c 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ Or choose from the collection: | `tokyobones` | Inspired by [Tokyo Night](https://github.com/enkia/tokyo-night-vscode-theme#color-palette) | | `duckbones` | Inspired by [Spaceduck](https://pineapplegiant.github.io/spaceduck) | | `zenburned` | Inspired by [Zenburn](https://kippura.org/zenburnpage) | +| `randombones` | Randomly pick from the collection. | ## [Configuration and other documentations](doc/zenbones.md) diff --git a/colors/randombones.vim b/colors/randombones.vim new file mode 100644 index 0000000..073a724 --- /dev/null +++ b/colors/randombones.vim @@ -0,0 +1,15 @@ +let s:colorschemes = json_decode(readfile(expand(':h:h') . '/colorschemes.json')) + +if has('nvim') + lua math.randomseed(os.time()) + let s:index = v:lua.math.random(len(s:colorschemes)) - 1 +else + let s:index = rand() % len(s:colorschemes) +endif + +let s:color = s:colorschemes[s:index] +if exists('s:color.background') + call zenbones#setup_colorscheme(s:color.name, s:color.background) +else + call zenbones#setup_colorscheme(s:color.name) +end diff --git a/doc/zenbones.md b/doc/zenbones.md index cf19ee3..0d3cb03 100644 --- a/doc/zenbones.md +++ b/doc/zenbones.md @@ -24,6 +24,7 @@ colorscheme nordbones colorscheme tokyobones colorscheme duckbones colorscheme zenburned +colorscheme randombones ``` ## Configuration