From f97e2f6ffc5005d35a0d02e207fefef8d3d329e3 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Wed, 10 Feb 2021 14:49:33 +0000 Subject: [PATCH] base16: init plugin --- flake.nix | 4 +- plugins/colorschemes/base16-list.nix | 131 +++++++++++++++++++++++++++ plugins/colorschemes/base16.nix | 26 +++++- plugins/statuslines/lightline.nix | 4 +- 4 files changed, 159 insertions(+), 6 deletions(-) create mode 100644 plugins/colorschemes/base16-list.nix diff --git a/flake.nix b/flake.nix index 6dbbb45a..201c48ff 100644 --- a/flake.nix +++ b/flake.nix @@ -35,9 +35,9 @@ programs.nixvim = { enable = true; package = pkgs.neovim-nightly; - colorschemes.gruvbox = { + colorschemes.base16 = { enable = true; - italics = true; + colorscheme = "ocean"; }; options.number = true; diff --git a/plugins/colorschemes/base16-list.nix b/plugins/colorschemes/base16-list.nix new file mode 100644 index 00000000..b666769e --- /dev/null +++ b/plugins/colorschemes/base16-list.nix @@ -0,0 +1,131 @@ +# This is a list of all base16 themes +[ + "3024" + "apathy" + "ashes" + "atelier-cave-light" + "atelier-cave" + "atelier-dune-light" + "atelier-dune" + "atelier-estuary-light" + "atelier-estuary" + "atelier-forest-light" + "atelier-forest" + "atelier-heath-light" + "atelier-heath" + "atelier-lakeside-light" + "atelier-lakeside" + "atelier-plateau-light" + "atelier-plateau" + "atelier-savanna-light" + "atelier-savanna" + "atelier-seaside-light" + "atelier-seaside" + "atelier-sulphurpool-light" + "atelier-sulphurpool" + "atlas" + "bespin" + "black-metal-bathory" + "black-metal-burzum" + "black-metal-dark-funeral" + "black-metal-gorgoroth" + "black-metal-immortal" + "black-metal-khold" + "black-metal-marduk" + "black-metal-mayhem" + "black-metal-nile" + "black-metal-venom" + "black-metal" + "brewer" + "bright" + "brogrammer" + "brushtrees-dark" + "brushtrees" + "chalk" + "circus" + "classic-dark" + "classic-light" + "codeschool" + "cupcake" + "cupertino" + "darktooth" + "default-dark" + "default-light" + "dracula" + "eighties" + "embers" + "flat" + "fruit-soda" + "github" + "google-dark" + "google-light" + "grayscale-dark" + "grayscale-light" + "greenscreen" + "gruvbox-dark-hard" + "gruvbox-dark-medium" + "gruvbox-dark-pale" + "gruvbox-dark-soft" + "gruvbox-light-hard" + "gruvbox-light-medium" + "gruvbox-light-soft" + "harmonic-dark" + "harmonic-light" + "heetch-light" + "heetch" + "helios" + "hopscotch" + "horizon-dark" + "ia-dark" + "ia-light" + "icy" + "irblack" + "isotope" + "macintosh" + "marrakesh" + "material-darker" + "material-lighter" + "material-palenight" + "material" + "material-vivid" + "materia" + "mellow-purple" + "mexico-light" + "mocha" + "monokai" + "nord" + "oceanicnext" + "ocean" + "onedark" + "one-light" + "outrun-dark" + "papercolor-dark" + "papercolor-light" + "paraiso" + "phd" + "pico" + "pop" + "porple" + "railscasts" + "rebecca" + "seti" + "shapeshifter" + "snazzy" + "solarflare" + "solarized-dark" + "solarized-light" + "spacemacs" + "summerfruit-dark" + "summerfruit-light" + "synth-midnight-dark" + "tomorrow-night-eighties" + "tomorrow-night" + "tomorrow" + "tube" + "twilight" + "unikitty-dark" + "unikitty-light" + "woodland" + "xcode-dusk" + "zenburn" +] diff --git a/plugins/colorschemes/base16.nix b/plugins/colorschemes/base16.nix index 7da1f516..9cdb1fce 100644 --- a/plugins/colorschemes/base16.nix +++ b/plugins/colorschemes/base16.nix @@ -2,18 +2,40 @@ with lib; let cfg = config.programs.nixvim.colorschemes.base16; - colors = types.enum [ "bg" "red" "green" "yellow" "blue" "purple" "aqua" "gray" "fg" "bg0_h" "bg0" "bg1" "bg2" "bg3" "bg4" "gray" "orange" "bg0_s" "fg0" "fg1" "fg2" "fg3" "fg4" ]; + themes = import ./base16-list.nix; in { options = { programs.nixvim.colorschemes.base16 = { enable = mkEnableOption "Enable base16"; + + useTruecolor = mkOption { + type = types.bool; + default = true; + description = "Whether to use truecolor for the colorschemes. If set to false, you'll need to set up base16 in your shell."; + }; + + colorscheme = mkOption { + type = types.enum themes; + description = "The base16 colorscheme to use"; + }; + + setUpBar = mkOption { + type = types.bool; + default = true; + description = "Whether to install the matching plugin for your statusbar. This does nothing as of yet, waiting for upstream support."; + }; }; }; config = mkIf cfg.enable { programs.nixvim = { - colorscheme = "base16-default-dark"; + colorscheme = "base16-${cfg.colorscheme}"; extraPlugins = [ pkgs.vimPlugins.base16-vim ]; + + plugins.airline.theme = mkIf (cfg.setUpBar) "base16"; + plugins.lightline.colorscheme = null; + + options.termguicolors = mkIf cfg.useTruecolor true; }; }; } diff --git a/plugins/statuslines/lightline.nix b/plugins/statuslines/lightline.nix index 225dfea8..5260bfed 100644 --- a/plugins/statuslines/lightline.nix +++ b/plugins/statuslines/lightline.nix @@ -75,13 +75,13 @@ in { }; config = let - configAttrs = { + configAttrs = filterAttrs (_: v: v != null) { inherit (cfg) colorscheme active component componentFunction modeMap; }; in mkIf cfg.enable { programs.nixvim = { extraPlugins = [ pkgs.vimPlugins.lightline-vim ]; - globals.lightline = configAttrs; + globals.lightline = mkIf (configAttrs != {}) configAttrs; }; }; }