From 5a95f812cee1fbdccf21acfd439aaed379b17f63 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sat, 9 Nov 2024 23:35:58 +0300 Subject: [PATCH] visuals/tiny-devicons-auto-colors: init module --- flake.lock | 17 ++++++++ flake.nix | 5 +++ modules/plugins/visuals/default.nix | 1 + .../tiny-devicons-auto-colors/config.nix | 21 ++++++++++ .../tiny-devicons-auto-colors/default.nix | 6 +++ .../tiny-devicons-auto-colors.nix | 41 +++++++++++++++++++ 6 files changed, 91 insertions(+) create mode 100644 modules/plugins/visuals/tiny-devicons-auto-colors/config.nix create mode 100644 modules/plugins/visuals/tiny-devicons-auto-colors/default.nix create mode 100644 modules/plugins/visuals/tiny-devicons-auto-colors/tiny-devicons-auto-colors.nix diff --git a/flake.lock b/flake.lock index fef34036..36d59db4 100644 --- a/flake.lock +++ b/flake.lock @@ -1790,6 +1790,22 @@ "type": "github" } }, + "plugin-tiny-devicons-auto-colors": { + "flake": false, + "locked": { + "lastModified": 1724403745, + "narHash": "sha256-Ndkbvxn/x7+fxEYD7JIygqUiItuhoY+4+DaL/pJGKdc=", + "owner": "rachartier", + "repo": "tiny-devicons-auto-colors.nvim", + "rev": "a39fa4c92268832f6034306793b8acbfec2a7549", + "type": "github" + }, + "original": { + "owner": "rachartier", + "repo": "tiny-devicons-auto-colors.nvim", + "type": "github" + } + }, "plugin-todo-comments": { "flake": false, "locked": { @@ -2112,6 +2128,7 @@ "plugin-sqls-nvim": "plugin-sqls-nvim", "plugin-tabular": "plugin-tabular", "plugin-telescope": "plugin-telescope", + "plugin-tiny-devicons-auto-colors": "plugin-tiny-devicons-auto-colors", "plugin-todo-comments": "plugin-todo-comments", "plugin-toggleterm-nvim": "plugin-toggleterm-nvim", "plugin-tokyonight": "plugin-tokyonight", diff --git a/flake.nix b/flake.nix index 144e136c..875fa432 100644 --- a/flake.nix +++ b/flake.nix @@ -468,6 +468,11 @@ flake = false; }; + plugin-tiny-devicons-auto-colors = { + url = "github:rachartier/tiny-devicons-auto-colors.nvim"; + flake = false; + }; + plugin-gitsigns-nvim = { url = "github:lewis6991/gitsigns.nvim"; flake = false; diff --git a/modules/plugins/visuals/default.nix b/modules/plugins/visuals/default.nix index ed408b61..0843654e 100644 --- a/modules/plugins/visuals/default.nix +++ b/modules/plugins/visuals/default.nix @@ -15,5 +15,6 @@ in { ./nvim-cursorline ./nvim-scrollbar ./nvim-web-devicons + ./tiny-devicons-auto-colors ]; } diff --git a/modules/plugins/visuals/tiny-devicons-auto-colors/config.nix b/modules/plugins/visuals/tiny-devicons-auto-colors/config.nix new file mode 100644 index 00000000..a7fd3752 --- /dev/null +++ b/modules/plugins/visuals/tiny-devicons-auto-colors/config.nix @@ -0,0 +1,21 @@ +{ + config, + lib, + ... +}: let + inherit (lib.modules) mkIf; + inherit (lib.nvim.lua) toLuaObject; + inherit (lib.nvim.dag) entryAnywhere; + + cfg = config.vim.visuals.tiny-devicons-auto-colors; +in { + config = mkIf cfg.enable { + vim = { + startPlugins = ["tiny-devicons-auto-colors" "nvim-web-devicons"]; + + pluginRC.tiny-devicons-auto-colors = entryAnywhere '' + require("tiny-devicons-auto-colors").setup(${toLuaObject cfg.setupOpts}) + ''; + }; + }; +} diff --git a/modules/plugins/visuals/tiny-devicons-auto-colors/default.nix b/modules/plugins/visuals/tiny-devicons-auto-colors/default.nix new file mode 100644 index 00000000..0fe05101 --- /dev/null +++ b/modules/plugins/visuals/tiny-devicons-auto-colors/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./config.nix + ./tiny-devicons-auto-colors.nix + ]; +} diff --git a/modules/plugins/visuals/tiny-devicons-auto-colors/tiny-devicons-auto-colors.nix b/modules/plugins/visuals/tiny-devicons-auto-colors/tiny-devicons-auto-colors.nix new file mode 100644 index 00000000..6b565e0a --- /dev/null +++ b/modules/plugins/visuals/tiny-devicons-auto-colors/tiny-devicons-auto-colors.nix @@ -0,0 +1,41 @@ +{lib, ...}: let + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.types) int float; + inherit (lib.generators) mkLuaInline; + inherit (lib.nvim.types) mkPluginSetupOption luaInline; +in { + options.vim.visuals.tiny-devicons-auto-colors = { + enable = mkEnableOption "alternative nvim-web-devicons icon colors [tiny-devicons-auto-colors]"; + + setupOpts = mkPluginSetupOption "tiny-devicons-auto-colors" { + factors = { + lightness = mkOption { + type = float; + default = 1.76; + description = "Lightness factor of icons"; + }; + + chroma = mkOption { + type = int; + default = 1; + description = "Chroma factor of icons"; + }; + + hue = mkOption { + type = float; + default = 1.25; + description = "Hue factor of icons"; + }; + + cache = { + enabled = mkEnableOption "caching of icon colors. This will greatly improve performance" // {default = true;}; + path = mkOption { + type = luaInline; + default = mkLuaInline "vim.fn.stdpath(\"cache\") .. \"/tiny-devicons-auto-colors-cache.json\""; + description = "Path to the cache file"; + }; + }; + }; + }; + }; +}