diff --git a/.gitignore b/.gitignore index df266259a..dc604db0e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .lua .luarocks +/nerd-fonts/ /vim-colortemplate/ diff --git a/Makefile b/Makefile index f9be6849a..f05d73ed6 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,9 @@ +NERD_FONTS_VERSION = 3.1.1 VIM_COLORTEMPLATE_VERSION = 2.2.3 all: colors style-check lint -colors: vim-colortemplate +colors: nerd-fonts vim-colortemplate nvim \ --clean \ --headless \ @@ -18,6 +19,9 @@ colors-check: colors vim-colortemplate: git clone --depth 1 -b v$(VIM_COLORTEMPLATE_VERSION) https://github.com/lifepillar/vim-colortemplate.git vim-colortemplate +nerd-fonts: + git clone --depth 1 --filter blob:none --sparse -b v$(NERD_FONTS_VERSION) https://github.com/ryanoasis/nerd-fonts.git nerd-fonts + style-check: stylua . --check @@ -28,6 +32,6 @@ lint: luacheck lua clean: - rm -rf vim-colortemplate + rm -rf nerd-fonts vim-colortemplate .PHONY: all colors style-check style-fix lint diff --git a/lua/nvim-web-devicons/_gen/color.lua b/lua/nvim-web-devicons/_gen/color.lua new file mode 100644 index 000000000..c541d492b --- /dev/null +++ b/lua/nvim-web-devicons/_gen/color.lua @@ -0,0 +1,44 @@ +local M = {} + +---@param rrggbb string +---@return string +function M.darken(rrggbb) + local light78 = 255 * 7 / 8 + local light68 = 255 * 6 / 8 + local light58 = 255 * 5 / 8 + local light12 = 255 / 2 + local light13 = 255 / 3 + + local hex = bit.tohex ---@type fun(n: number): string + + local r, g, b = rrggbb:match "%#(%x%x)(%x%x)(%x%x)" + r, g, b = tonumber("0x" .. r), tonumber("0x" .. g), tonumber("0x" .. b) + -- luminance formula: see https://stackoverflow.com/a/596243 + local lum = 0.299 * r + 0.587 * g + 0.114 * b + if lum < light13 then -------------------- darkest tertile + return rrggbb + elseif lum < light12 then ---------------- second darkest quartile + r = hex(r / 4 * 3):sub(-2) + g = hex(g / 4 * 3):sub(-2) + b = hex(b / 4 * 3):sub(-2) + elseif lum < light58 then ---------------- lightest octiles: first + r = hex(r / 3 * 2):sub(-2) + g = hex(g / 3 * 2):sub(-2) + b = hex(b / 3 * 2):sub(-2) + elseif lum < light68 then ---------------- lightest octiles: second + r = hex(r / 2):sub(-2) + g = hex(g / 2):sub(-2) + b = hex(b / 2):sub(-2) + elseif lum < light78 then ---------------- lightest octiles: third + r = hex(r / 3):sub(-2) + g = hex(g / 3):sub(-2) + b = hex(b / 3):sub(-2) + else ------------------------------------- lightest octile + r = hex(r / 5):sub(-2) + g = hex(g / 5):sub(-2) + b = hex(b / 5):sub(-2) + end + return string.format("#%s%s%s", r, g, b) +end + +return M diff --git a/lua/nvim-web-devicons/_gen/icons.lua b/lua/nvim-web-devicons/_gen/icons.lua index cd6dbca91..e2a188b14 100644 --- a/lua/nvim-web-devicons/_gen/icons.lua +++ b/lua/nvim-web-devicons/_gen/icons.lua @@ -1,165 +1,165 @@ return { AOSC = { color = "#c00000", - icon = "", + icon = "linux-aosc", os = { "aosc" }, }, Ai = { color = "#cbcb41", extension = { "ai" }, - icon = "", + icon = "dev-illustrator", }, Almalinux = { color = "#ff4649", - icon = "", + icon = "linux-almalinux", os = { "alma" }, }, Alpine = { color = "#0d597f", - icon = "", + icon = "linux-alpine", os = { "alpine" }, }, Apple = { color = "#A2AAAD", - icon = "", + icon = "seti-apple", os = { "apple" }, }, AppleScript = { color = "#6d8085", extension = { "applescript" }, filetype = { "applescript" }, - icon = "", + icon = "fa-apple", }, Arch = { color = "#0f94d2", - icon = "󰣇", + icon = "md-arch", os = { "arch" }, }, Arduino = { color = "#56b6c2", extension = { "ino" }, filetype = { "arduino" }, - icon = "", + icon = "linux-arduino", }, Artix = { color = "#41b4d7", - icon = "", + icon = "linux-artix", os = { "artix" }, }, Audio = { color = "#66D8EF", extension = { "aac", "flac", "mp3", "m4a", "ogg", "wav" }, - icon = "", + icon = "fa-music", }, AzureCli = { color = "#0078d4", extension = { "azcli" }, - icon = "", + icon = "cod-azure_devops", }, Backup = { color = "#6d8086", extension = { "bak" }, - icon = "󰁯", + icon = "md-backup_restore", }, Bash = { color = "#89e051", extension = { "bash" }, filetype = { "bash" }, - icon = "", + icon = "dev-terminal", }, BashConfig = { color = "#89e051", file = { ".bash_profile", ".bashrc" }, - icon = "", + icon = "seti-config", }, Bat = { color = "#C1F12E", extension = { "bat" }, filetype = { "winbatch", "dosbatch" }, - icon = "", + icon = "seti-config", }, Bazel = { color = "#89e051", extension = { "bzl", "bazel" }, file = { "build", "workspace" }, filetype = { "bzl" }, - icon = "", + icon = "seti-bazel", }, BibTeX = { color = "#cbcb41", extension = { "bib" }, filetype = { "bib" }, - icon = "󱉟", + icon = "md-bookshelf", }, BinaryGLTF = { color = "#FFB13B", extension = { "glb" }, - icon = "", + icon = "fa-cube", }, Brewfile = { color = "#701516", file = { "brewfile" }, - icon = "", + icon = "dev-ruby_rough", }, Budgie = { color = "#5195e3", - icon = "", + icon = "linux-budgie", os = { "budgie" }, }, C = { color = "#599eff", extension = { "c" }, filetype = { "c" }, - icon = "", + icon = "custom-c", }, CMake = { color = "#6d8086", extension = { "cmake" }, file = { "cmakelists.txt" }, filetype = { "cmake" }, - icon = "", + icon = "seti-config", }, CPlusPlus = { color = "#f34b7d", extension = { "c++", "cc", "ccm" }, - icon = "", + icon = "custom-cpp", }, CSharpProject = { color = "#512bd4", extension = { "csproj" }, - icon = "󰪮", + icon = "md-dot_net", }, Centos = { color = "#a2518d", - icon = "", + icon = "linux-centos", os = { "centos" }, }, Checkhealth = { color = "#75B4FB", file = { "checkhealth" }, filetype = { "checkhealth" }, - icon = "󰓙", + icon = "md-stethoscope", }, Clojure = { color = "#8dc149", extension = { "clj" }, filetype = { "clojure" }, - icon = "", + icon = "dev-clojure", }, ClojureC = { color = "#8dc149", extension = { "cljc" }, - icon = "", + icon = "dev-clojure", }, ClojureDart = { color = "#519aba", extension = { "cljd" }, - icon = "", + icon = "dev-clojure_alt", }, ClojureJS = { color = "#519aba", extension = { "cljs" }, - icon = "", + icon = "dev-clojure_alt", }, Cobol = { color = "#005ca5", @@ -171,121 +171,120 @@ return { color = "#cbcb41", extension = { "coffee" }, filetype = { "coffee" }, - icon = "", + icon = "seti-coffee", }, Conf = { color = "#6d8086", extension = { "conf" }, filetype = { "conf" }, - icon = "", + icon = "seti-config", }, Configuration = { color = "#ECECEC", extension = { "cfg" }, filetype = { "cfg" }, - icon = "", + icon = "dev-code_badge", }, Cp = { color = "#519aba", extension = { "cp", "cpp", "cxx", "cppm", "cxxm", "ixx", "mpp" }, filetype = { "cpp" }, - icon = "", + icon = "custom-cpp", }, Crystal = { color = "#c8c8c8", extension = { "cr" }, filetype = { "crystal" }, - icon = "", + icon = "custom-crystal", }, Cs = { color = "#596706", extension = { "cs" }, filetype = { "cs" }, - icon = "󰌛", + icon = "md-language_csharp", }, Cson = { color = "#cbcb41", extension = { "cson" }, filetype = { "cson" }, - icon = "", + icon = "seti-less", }, Css = { color = "#42a5f5", extension = { "css" }, filetype = { "css" }, - icon = "", + icon = "dev-css3", }, Csv = { color = "#89e051", extension = { "csv" }, filetype = { "csv" }, - icon = "", + icon = "seti-csv", }, Cuda = { color = "#89e051", extension = { "cu" }, filetype = { "cuda" }, - icon = "", + icon = "seti-cu", }, Cudah = { color = "#a074c4", extension = { "cuh" }, - icon = "", + icon = "seti-cu", }, Cython = { color = "#5aa7e4", extension = { "pxd", "pxi", "pyx" }, - icon = "", + icon = "seti-python", }, D = { color = "#427819", extension = { "d" }, filetype = { "d" }, - icon = "", + icon = "dev-dlang", }, Dart = { color = "#03589C", extension = { "dart" }, filetype = { "dart" }, - icon = "", + icon = "dev-dart", }, Db = { color = "#dad8d8", extension = { "db", "dump", "sql", "sqlite", "sqlite3" }, filetype = { "sql", "mysql" }, - icon = "", + icon = "dev-database", }, Debian = { color = "#a80030", - icon = "", + icon = "linux-debian", os = { "debian" }, }, Deepin = { color = "#2ca7f8", - icon = "", + icon = "linux-deepin", os = { "deepin" }, }, DesktopEntry = { color = "#563d7c", extension = { "desktop" }, filetype = { "desktop" }, - icon = "", + icon = "fa-desktop", }, Devuan = { color = "#404a52", - icon = "", + icon = "linux-devuan", os = { "devuan" }, }, Diff = { color = "#41535b", extension = { "diff" }, filetype = { "diff" }, - icon = "", + icon = "dev-git_compare", }, Dockerfile = { color = "#458ee6", extension = { "Dockerfile" }, - filetype = { "dockerfile" }, file = { ".dockerignore", "compose.yaml", @@ -295,388 +294,384 @@ return { "docker-compose.yaml", "docker-compose.yml", }, - icon = "󰡨", + filetype = { "dockerfile" }, + icon = "md-docker", }, Drools = { color = "#ffafaf", extension = { "drl" }, - icon = "", + icon = "fae-brain", }, Dropbox = { color = "#0061FE", extension = { "dropbox" }, - icon = "", + icon = "dev-dropbox", }, DsStore = { color = "#41535b", file = { ".ds_store" }, - icon = "", + icon = "seti-config", }, EditorConfig = { color = "#fff2f2", file = { ".editorconfig" }, filetype = { "editorconfig" }, - icon = "", + icon = "seti-editorconfig", }, Edn = { color = "#519aba", extension = { "edn" }, - icon = "", + icon = "dev-clojure_alt", }, Ejs = { color = "#cbcb41", extension = { "ejs" }, filetype = { "ejs" }, - icon = "", + icon = "seti-html", }, Elementary = { color = "#5890c2", - icon = "", + icon = "linux-elementary", os = { "elementary" }, }, Elm = { color = "#519aba", extension = { "elm" }, filetype = { "elm" }, - icon = "", + icon = "custom-elm", }, Endeavour = { color = "#7b3db9", - icon = "", + icon = "linux-endeavour", os = { "endeavour" }, }, Env = { color = "#faf743", file = { ".env" }, - icon = "", + icon = "oct-sliders", }, Epp = { color = "#FFA61A", extension = { "epp" }, - icon = "", + icon = "seti-puppet", }, Erb = { color = "#701516", extension = { "erb" }, - icon = "", + icon = "seti-html", }, Erl = { color = "#B83998", extension = { "erl", "hrl" }, filetype = { "erlang" }, - icon = "", + icon = "dev-erlang", }, Eslint = { color = "#4b32c3", file = { ".eslintignore", ".eslintrc" }, - icon = "", + icon = "seti-eslint", }, Ex = { color = "#a074c4", extension = { "ex", "exs", "eex", "leex", "heex" }, file = { "mix.lock" }, filetype = { "elixir" }, - icon = "", + icon = "custom-elixir", }, Excel = { color = "#207245", extension = { "xls", "xlsx" }, - icon = "󰈛", + icon = "md-file_excel", }, Exe = { color = "#9F0500", extension = { "app", "elf", "exe", "out" }, - icon = "", + icon = "cod-file_binary", + }, + FSharp = { + color = "#519aba", + extension = { "fs", "f#", "fsi", "fsscript", "fsx" }, + filetype = { "fsharp" }, + icon = "dev-fsharp", }, Favicon = { color = "#cbcb41", file = { "favicon.ico" }, - icon = "", + icon = "seti-favicon", }, Fedora = { color = "#072a5e", - icon = "", + icon = "linux-fedora", os = { "fedora" }, }, Fennel = { color = "#fff3d7", extension = { "fnl" }, filetype = { "fennel" }, - icon = "", + icon = "custom-fennel", }, Font = { color = "#ECECEC", extension = { "eot", "otf", "ttf", "woff", "woff2" }, - icon = "", + icon = "fa-font", }, Fortran = { color = "#734f96", extension = { "f90" }, filetype = { "fortran" }, - icon = "󱈚", + icon = "md-language_fortran", }, FreeBSD = { color = "#c90f02", - icon = "", + icon = "linux-freebsd", os = { "freebsd" }, }, - FSharp = { - color = "#519aba", - extension = { "fs", "f#", "fsi", "fsscript", "fsx" }, - filetype = { "fsharp" }, - icon = "", - }, GDScript = { color = "#6d8086", extension = { "gd" }, filetype = { "gdscript" }, - icon = "", + icon = "seti-config", }, Gentoo = { color = "#b1abce", - icon = "󰣨", + icon = "md-gentoo", os = { "gentoo" }, }, Git = { color = "#41535b", file = { ".gitattributes", "commit_editmsg", ".gitignore", ".gitmodules" }, filetype = { "gitcommit", "gitignore", "gitattributes" }, - icon = "", + icon = "dev-git", }, GitConfig = { color = "#41535b", file = { ".gitconfig" }, filetype = { "gitconfig" }, - icon = "", + icon = "seti-config", }, GitLogo = { color = "#F14C28", extension = { "git" }, - icon = "", + icon = "dev-git", }, GitlabCI = { color = "#e24329", file = { ".gitlab-ci.yml" }, - icon = "", + icon = "fa-gitlab", }, Go = { color = "#519aba", extension = { "go" }, filetype = { "go" }, - icon = "", + icon = "seti-go", }, GodotProject = { color = "#6d8086", extension = { "godot" }, - icon = "", + icon = "dev-code_badge", }, GraphQL = { color = "#e535ab", extension = { "gql", "graphql" }, filetype = { "graphql" }, - icon = "", + icon = "fa-connectdevelop", }, Groovy = { color = "#4a687c", file = { "groovy" }, filetype = { "groovy" }, - icon = "", + icon = "dev-groovy", }, Gruntfile = { color = "#e37933", file = { "gruntfile" }, - icon = "", + icon = "seti-grunt", }, Guix = { color = "#ffcc00", - icon = "", + icon = "linux-gnu_guix", os = { "guix" }, }, Gulpfile = { color = "#cc3e44", file = { "gulpfile" }, - icon = "", + icon = "seti-gulp", }, H = { color = "#a074c4", extension = { "h", "hh", "hpp", "hxx" }, - icon = "", + icon = "fa-h_square", }, Haml = { color = "#eaeae1", extension = { "haml" }, filetype = { "haml" }, - icon = "", + icon = "seti-html", }, Haxe = { color = "#ea8220", extension = { "hx" }, filetype = { "haxe" }, - icon = "", + icon = "seti-haxe", }, Hbs = { color = "#f0772b", extension = { "hbs" }, filetype = { "html.handlebars" }, - icon = "", + icon = "seti-mustache", }, Hs = { color = "#a074c4", extension = { "hs", "lhs" }, filetype = { "haskell" }, - icon = "", + icon = "seti-haskell", }, Htm = { color = "#e34c26", extension = { "htm" }, - icon = "", + icon = "seti-html", }, Html = { color = "#e44d26", extension = { "html" }, filetype = { "html" }, - icon = "", + icon = "dev-html5", }, Huff = { color = "#4242c7", extension = { "huff" }, filetype = { "huff" }, - icon = "󰡘", + icon = "md-chess_knight", }, Hurl = { color = "#ff0288", extension = { "hurl" }, filetype = { "hurl" }, - icon = "", + icon = "fa-exchange", }, Ico = { color = "#cbcb41", extension = { "ico" }, - icon = "", + icon = "seti-image", }, Illumos = { color = "#ff430f", - icon = "", + icon = "linux-illumos", os = { "illumos" }, }, ImportConfiguration = { color = "#ECECEC", extension = { "import" }, filetype = { "import" }, - icon = "", + icon = "fa-paperclip", }, Ini = { color = "#6d8086", extension = { "ini" }, filetype = { "ini" }, - icon = "", + icon = "seti-config", }, Java = { color = "#cc3e44", extension = { "java" }, filetype = { "java" }, - icon = "", + icon = "dev-java", }, JavaScriptReactTest = { color = "#20c2e3", extension = { "spec.jsx", "test.jsx" }, - icon = "", + icon = "oct-beaker", }, Jl = { color = "#a270ba", extension = { "jl" }, filetype = { "julia" }, - icon = "", + icon = "seti-julia", }, Js = { color = "#F1F134", extension = { "js", "cjs", "mjs" }, filetype = { "javascript" }, - icon = "󰌞", + icon = "md-language_javascript", }, Json = { color = "#cbcb41", extension = { "json", "json5", "jsonc" }, file = { ".babelrc" }, filetype = { "json", "json5", "jsonc" }, - icon = "", + icon = "seti-less", }, Jsx = { color = "#20c2e3", extension = { "jsx" }, filetype = { "javascriptreact" }, - icon = "", + icon = "seti-react", }, Kali = { color = "#2777ff", - icon = "", + icon = "linux-kali_linux", os = { "kali" }, }, Kotlin = { color = "#7F52FF", extension = { "kt", "kts" }, filetype = { "kotlin" }, - icon = "", + icon = "custom-kotlin", }, Less = { color = "#563d7c", extension = { "less" }, filetype = { "less" }, - icon = "", + icon = "seti-css", }, License = { color = "#cbcb41", extension = { "license" }, file = { "copying.lesser", "unlicense", "license", "copying" }, - icon = "", + icon = "seti-license", }, Linux = { color = "#fdfdfb", - icon = "", + icon = "cod-terminal_linux", os = { "linux" }, }, Liquid = { color = "#95BF47", extension = { "liquid" }, filetype = { "liquid" }, - icon = "", + icon = "seti-liquid", }, Lock = { color = "#bbbbbb", extension = { "lock" }, - icon = "", + icon = "fa-unlock_alt", }, Log = { color = "#dddddd", extension = { "log" }, filetype = { "log" }, - icon = "󰌱", + icon = "md-library", }, Lua = { color = "#51a0cf", extension = { "lua" }, filetype = { "lua" }, - icon = "", + icon = "seti-lua", }, Luau = { color = "#00a2ff", extension = { "luau" }, filetype = { "luau" }, - icon = "", + icon = "seti-lua", }, Luaurc = { color = "#00a2ff", file = { ".luaurc" }, - icon = "", - }, - Movie = { - color = "#FD971F", - extension = { "m4v", "mkv", "mov", "mp4", "webm" }, - icon = "", + icon = "seti-config", }, Mageia = { color = "#2397d4", - icon = "", + icon = "linux-mageia", os = { "mageia" }, }, Makefile = { @@ -684,93 +679,98 @@ return { extension = { "makefile", "mk", "gnumakefile" }, file = { "makefile", "gnumakefile" }, filetype = { "make" }, - icon = "", + icon = "dev-gnu", }, Manjaro = { color = "#33b959", - icon = "", + icon = "linux-manjaro", os = { "manjaro" }, }, Markdown = { color = "#dddddd", extension = { "markdown" }, filetype = { "markdown" }, - icon = "", + icon = "seti-markdown", }, Material = { color = "#B83998", extension = { "material" }, - icon = "󰔉", + icon = "md-image_filter_hdr", }, Md = { color = "#dddddd", extension = { "md" }, - icon = "", + icon = "oct-markdown", }, Mdx = { color = "#519aba", extension = { "mdx" }, - icon = "", + icon = "oct-markdown", }, Mint = { color = "#87c095", extension = { "mint" }, - icon = "󰌪", + icon = "md-leaf", os = { "mint" }, }, Ml = { color = "#e37933", extension = { "ml", "mli" }, filetype = { "ocaml" }, - icon = "", + icon = "seti-ocaml", }, Motoko = { color = "#9772FB", extension = { "mo" }, icon = "∞", }, + Movie = { + color = "#FD971F", + extension = { "m4v", "mkv", "mov", "mp4", "webm" }, + icon = "fa-video_camera", + }, Mustache = { color = "#e37933", extension = { "mustache" }, filetype = { "html.mustache" }, - icon = "", + icon = "seti-mustache", }, NPM = { color = "#E8274B", file = { ".npmignore", ".npmrc" }, - icon = "", + icon = "dev-npm", }, Nim = { color = "#f3d400", extension = { "nim" }, filetype = { "nim" }, - icon = "", + icon = "seti-nim", }, Nix = { color = "#7ebae4", extension = { "nix" }, filetype = { "nix" }, - icon = "", + icon = "linux-nixos", }, NixOS = { color = "#7ab1db", - icon = "", + icon = "linux-nixos", os = { "nixos" }, }, NodeModules = { color = "#E8274B", file = { "node_modules" }, - icon = "", + icon = "dev-nodejs_small", }, Notebook = { color = "#51a0cf", extension = { "ipynb" }, - icon = "", + icon = "seti-python", }, Nswag = { color = "#85ea2d", extension = { "nswag" }, - icon = "", + icon = "seti-less", }, Nushell = { color = "#3aa675", @@ -781,182 +781,175 @@ return { OPUS = { color = "#F88A02", extension = { "opus" }, - icon = "󰈣", + icon = "md-file_music", }, OpenBSD = { color = "#f2ca30", - icon = "", + icon = "linux-openbsd", os = { "openbsd" }, }, OpenSCAD = { color = "#f9d72c", extension = { "scad" }, - icon = "", + icon = "linux-openscad", }, OpenSUSE = { color = "#6fb424", - icon = "", + icon = "linux-opensuse", os = { "opensuse" }, }, OrgMode = { color = "#77AA99", extension = { "org" }, filetype = { "org" }, - icon = "", + icon = "custom-orgmode", }, PackageJson = { color = "#e8274b", file = { "package.json" }, - icon = "", + icon = "dev-npm", }, PackageLockJson = { color = "#7a0d21", file = { "package-lock.json" }, - icon = "", + icon = "dev-npm", }, PackedResource = { color = "#6d8086", extension = { "pck" }, - icon = "", + icon = "oct-package", }, Parrot = { color = "#54deff", - icon = "", + icon = "linux-parrot", os = { "parrot" }, }, Pdf = { color = "#b30b00", extension = { "pdf" }, - icon = "", + icon = "cod-file_pdf", + }, + PhotoShop = { + color = "#519aba", + extension = { "psb", "psd" }, + icon = "dev-photoshop", }, Php = { color = "#a074c4", extension = { "php" }, filetype = { "php" }, - icon = "", + icon = "seti-php", }, Picture = { color = "#a074c4", extension = { "avif", "bmp", "gif", "jpeg", "jxl", "jpg", "png", "webp" }, filetype = { "avif", "bmp" }, - icon = "", + icon = "seti-image", }, Pl = { color = "#519aba", extension = { "pl", "pm" }, filetype = { "perl" }, - icon = "", + icon = "dev-perl", }, Pop_OS = { color = "#48b9c7", - icon = "", + icon = "linux-pop_os", os = { "pop_os" }, }, Pp = { color = "#FFA61A", extension = { "pp" }, - icon = "", + icon = "seti-puppet", }, Ppt = { color = "#cb4a32", extension = { "ppt" }, - icon = "󰈧", + icon = "md-file_powerpoint", }, Prisma = { color = "#5a67d8", extension = { "prisma" }, filetype = { "prisma" }, - icon = "", + icon = "seti-prisma", }, Procfile = { color = "#a074c4", file = { "procfile" }, filetype = { "procfile" }, - icon = "", + icon = "seti-heroku", }, Prolog = { color = "#e4b854", extension = { "pro" }, filetype = { "prolog" }, - icon = "", + icon = "dev-prolog", }, PsManifestfile = { color = "#6975c4", extension = { "psd1" }, - icon = "󰨊", + icon = "md-powershell", }, PsScriptModulefile = { color = "#6975c4", extension = { "psm1" }, - icon = "󰨊", + icon = "md-powershell", }, PsScriptfile = { color = "#4273ca", extension = { "ps1" }, filetype = { "ps1" }, - icon = "󰨊", - }, - PhotoShop = { - color = "#519aba", - extension = { "psb", "psd" }, - icon = "", + icon = "md-powershell", }, Py = { color = "#ffbc03", extension = { "py", "pyi" }, file = { "py.typed" }, filetype = { "python", "python2" }, - icon = "", + icon = "seti-python", }, PyGen = { color = "#ffe291", extension = { "pyc", "pyd", "pyo" }, - icon = "", + icon = "seti-python", }, Query = { color = "#90a850", extension = { "query" }, - icon = "", + icon = "fae-tree", }, R = { color = "#2266ba", extension = { "r", "R" }, file = { "R", "r" }, filetype = { "r" }, - icon = "󰟔", + icon = "md-language_r", }, RaspberryPiOS = { color = "#be1848", - icon = "", + icon = "linux-raspberry_pi", os = { "raspberry_pi" }, }, RazorPage = { color = "#512bd4", extension = { "cshtml", "razor" }, filetype = { "razor" }, - icon = "󱦗", - }, - Ruby = { - color = "#701516", - extension = { "config.ru", "gemspec", "rake", "rb" }, - file = { "gemfile$", "rakefile" }, - filetype = { "gemfile" }, - icon = "", + icon = "md-razor_double_edge", }, ReScript = { color = "#cc3e44", extension = { "res" }, filetype = { "rescript" }, - icon = "", + icon = "seti-rescript", }, ReScriptInterface = { color = "#f55385", extension = { "resi" }, - icon = "", + icon = "seti-rescript", }, Redhat = { color = "#EE0000", - icon = "󱄛", + icon = "md-redhat", os = { "redhat" }, }, Rmd = { @@ -964,79 +957,86 @@ return { extension = { "rmd" }, file = { "rmd" }, filetype = { "rmarkdown" }, - icon = "", + icon = "seti-markdown", }, RockyLinux = { color = "#0fb37d", - icon = "", + icon = "linux-rocky_linux", os = { "rocky" }, }, Rproj = { color = "#358a5b", extension = { "rproj" }, filetype = { "rproj" }, - icon = "󰗆", + icon = "md-vector_rectangle", }, Rs = { color = "#dea584", extension = { "rlib", "rs" }, filetype = { "rust" }, - icon = "", + icon = "dev-rust", }, Rss = { color = "#FB9D3B", extension = { "rss" }, - icon = "", + icon = "seti-xml", + }, + Ruby = { + color = "#701516", + extension = { "config.ru", "gemspec", "rake", "rb" }, + file = { "gemfile$", "rakefile" }, + filetype = { "gemfile" }, + icon = "dev-ruby_rough", }, Sabayon = { color = "#c6c6c6", - icon = "", + icon = "linux-sabayon", os = { "sabayon" }, }, Sass = { color = "#f55385", extension = { "sass", "scss" }, filetype = { "sass", "scss" }, - icon = "", + icon = "seti-sass", }, Scala = { color = "#cc3e44", extension = { "scala", "sbt" }, filetype = { "scala" }, - icon = "", + icon = "dev-scala", }, Scheme = { color = "#eeeeee", extension = { "scm" }, filetype = { "scheme" }, - icon = "󰘧", + icon = "md-lambda", }, SettingsJson = { color = "#854CC7", file = { ".settings.json" }, - icon = "", + icon = "dev-visualstudio", }, Sh = { color = "#4d5a5e", extension = { "awk", "csh", "fish", "ksh", "sh" }, filetype = { "awk", "csh", "fish", "sh" }, - icon = "", + icon = "dev-terminal", }, Slackware = { color = "#475fa9", - icon = "", + icon = "linux-slackware", os = { "slackware" }, }, Slim = { color = "#e34c26", extension = { "slim" }, filetype = { "slim" }, - icon = "", + icon = "seti-html", }, Sln = { color = "#854CC7", extension = { "sln" }, - icon = "", + icon = "dev-visualstudio", }, Sml = { color = "#e37933", @@ -1048,279 +1048,279 @@ return { color = "#519aba", extension = { "sol" }, filetype = { "solidity" }, - icon = "", + icon = "seti-ethereum", }, Solus = { color = "#4b5163", - icon = "", + icon = "linux-solus", os = { "solus" }, }, Styl = { color = "#8dc149", extension = { "styl" }, filetype = { "styl" }, - icon = "", + icon = "seti-stylus", }, Suo = { color = "#854CC7", extension = { "suo", "sublime" }, filetype = { "suo", "sublime" }, - icon = "", + icon = "dev-visualstudio", }, Svelte = { color = "#ff3e00", extension = { "svelte" }, file = { "svelte.config.js" }, filetype = { "svelte" }, - icon = "", + icon = "seti-svelte", }, Svg = { color = "#FFB13B", extension = { "svg" }, filetype = { "svg" }, - icon = "󰜡", + icon = "md-svg", }, Swift = { color = "#e37933", extension = { "swift" }, filetype = { "swift" }, - icon = "", + icon = "dev-swift", }, SystemVerilog = { color = "#019833", extension = { "svh", "sv" }, filetype = { "systemverilog" }, - icon = "󰍛", + icon = "md-memory", }, TFVars = { color = "#5F43E9", extension = { "tfvars" }, - icon = "", + icon = "fa-file", }, TSConfig = { color = "#519aba", file = { "tsconfig.json" }, - icon = "", + icon = "seti-tsconfig", }, TailwindConfig = { color = "#20c2e3", file = { "tailwind.config.js", "tailwind.config.mjs", "tailwind.config.ts" }, - icon = "󱏿", + icon = "md-tailwind", }, Tcl = { color = "#1e5cb3", extension = { "tbc", "tcl" }, filetype = { "tcl" }, - icon = "󰛓", + icon = "md-feather", }, Templ = { color = "#dbbd30", extension = { "templ" }, filetype = { "template" }, - icon = "", + icon = "cod-code", }, Terminal = { color = "#31B53E", extension = { "terminal" }, - icon = "", + icon = "oct-terminal", }, Terraform = { color = "#5F43E9", extension = { "tf" }, filetype = { "terraform" }, - icon = "", + icon = "seti-terraform", }, TestJs = { color = "#cbcb41", extension = { "spec.js", "test.js" }, - icon = "", + icon = "oct-beaker", }, TestTs = { color = "#519aba", extension = { "spec.ts", "test.ts" }, - icon = "", + icon = "oct-beaker", }, Tex = { color = "#3D6117", extension = { "tex" }, filetype = { "tex" }, - icon = "󰙩", + icon = "md-text_shadow", }, TextResource = { color = "#cbcb41", extension = { "tres" }, - icon = "", + icon = "dev-database", }, TextScene = { color = "#a074c4", extension = { "tscn" }, - icon = "󰎁", + icon = "md-movie", }, Toml = { color = "#9c4221", extension = { "toml" }, filetype = { "toml" }, - icon = "", + icon = "custom-toml", }, Tor = { color = "#519aba", extension = { "t" }, - icon = "", + icon = "dev-perl", }, Ts = { color = "#519aba", extension = { "cts", "mts", "ts" }, filetype = { "typescript" }, - icon = "", + icon = "seti-typescript", }, Tsx = { color = "#1354bf", extension = { "tsx" }, filetype = { "typescriptreact" }, - icon = "", + icon = "dev-react", }, Twig = { color = "#8dc149", extension = { "twig" }, - icon = "", + icon = "seti-twig", }, Txt = { color = "#89e051", extension = { "txt" }, filetype = { "text" }, - icon = "󰈙", + icon = "md-file_document", }, TypeScriptReactTest = { color = "#1354bf", extension = { "spec.tsx", "test.tsx" }, - icon = "", + icon = "oct-beaker", }, Ubuntu = { color = "#dd4814", - icon = "", + icon = "dev-ubuntu", os = { "ubuntu" }, }, VHDL = { color = "#019833", extension = { "vhdl", "vhd" }, filetype = { "vhdl" }, - icon = "󰍛", + icon = "md-memory", }, Vagrantfile = { color = "#1563FF", file = { "vagrantfile$" }, filetype = { "vagrantfile" }, - icon = "", + icon = "fa-linode", }, Vala = { color = "#7239b3", extension = { "vala" }, filetype = { "vala" }, - icon = "", + icon = "seti-vala", }, Verilog = { color = "#019833", extension = { "v", "vh" }, filetype = { "verilog" }, - icon = "󰍛", + icon = "md-memory", }, Vim = { color = "#019833", extension = { "vim" }, file = { ".gvimrc", ".vimrc", "_gvimrc", "_vimrc" }, filetype = { "vim" }, - icon = "", + icon = "custom-vim", }, Vlang = { color = "#5d87bf", extension = { "vsh" }, - icon = "", + icon = "custom-v_lang", }, Void = { color = "#295340", - icon = "", + icon = "linux-void", os = { "void" }, }, Vue = { color = "#8dc149", extension = { "vue" }, filetype = { "vue" }, - icon = "", + icon = "seti-vue", }, Wasm = { color = "#5c4cdb", extension = { "wasm" }, - icon = "", + icon = "seti-wasm", }, Webmanifest = { color = "#f1e05a", extension = { "webmanifest" }, - icon = "", + icon = "seti-less", }, Webpack = { color = "#519aba", extension = { "webpack" }, file = { "webpack" }, - icon = "󰜫", + icon = "md-webpack", }, Windows = { color = "#00A4EF", - icon = "", + icon = "fa-windows", os = { "windows" }, }, Word = { color = "#185abd", extension = { "doc", "docx" }, - icon = "󰈬", + icon = "md-file_word", }, Xaml = { color = "#512bd4", extension = { "xaml" }, - icon = "󰙳", + icon = "md-language_xaml", }, XcPlayground = { color = "#e37933", extension = { "xcplayground" }, - icon = "", + icon = "dev-swift", }, Xml = { color = "#e37933", extension = { "xml" }, filetype = { "xml" }, - icon = "󰗀", + icon = "md-xml", }, Xul = { color = "#e37933", extension = { "xul" }, - icon = "", + icon = "dev-firefox", }, Yaml = { color = "#6d8086", extension = { "yml", "yaml" }, filetype = { "yaml" }, - icon = "", + icon = "seti-config", }, Zig = { color = "#f69a1b", extension = { "zig" }, file = { "build.zig.zon" }, filetype = { "zig" }, - icon = "", + icon = "seti-zig", }, Zorin = { color = "#14a1e8", - icon = "", + icon = "linux-zorin", os = { "zorin" }, }, Zsh = { color = "#89e051", extension = { "zsh" }, filetype = { "zsh" }, - icon = "", + icon = "dev-terminal", }, ZshConfig = { color = "#89e051", file = { ".zshenv", ".zprofile", ".zshrc" }, - icon = "", + icon = "seti-config", }, } diff --git a/lua/nvim-web-devicons/_gen/init.lua b/lua/nvim-web-devicons/_gen/init.lua index 810783497..4e96b9612 100644 --- a/lua/nvim-web-devicons/_gen/init.lua +++ b/lua/nvim-web-devicons/_gen/init.lua @@ -1,46 +1,7 @@ +local color = require "nvim-web-devicons._gen.color" +local nerdfonts = require "nvim-web-devicons._gen.nerdfonts" local original = require "nvim-web-devicons._gen.icons" ----@param rrggbb string ----@return string -local function darken_color(rrggbb) - local light78 = 255 * 7 / 8 - local light68 = 255 * 6 / 8 - local light58 = 255 * 5 / 8 - local light12 = 255 / 2 - local light13 = 255 / 3 - - local hex = bit.tohex ---@type fun(n: number): string - - local r, g, b = rrggbb:match "%#(%x%x)(%x%x)(%x%x)" - r, g, b = tonumber("0x" .. r), tonumber("0x" .. g), tonumber("0x" .. b) - -- luminance formula: see https://stackoverflow.com/a/596243 - local lum = 0.299 * r + 0.587 * g + 0.114 * b - if lum < light13 then -------------------- darkest tertile - return rrggbb - elseif lum < light12 then ---------------- second darkest quartile - r = hex(r / 4 * 3):sub(-2) - g = hex(g / 4 * 3):sub(-2) - b = hex(b / 4 * 3):sub(-2) - elseif lum < light58 then ---------------- lightest octiles: first - r = hex(r / 3 * 2):sub(-2) - g = hex(g / 3 * 2):sub(-2) - b = hex(b / 3 * 2):sub(-2) - elseif lum < light68 then ---------------- lightest octiles: second - r = hex(r / 2):sub(-2) - g = hex(g / 2):sub(-2) - b = hex(b / 2):sub(-2) - elseif lum < light78 then ---------------- lightest octiles: third - r = hex(r / 3):sub(-2) - g = hex(g / 3):sub(-2) - b = hex(b / 3):sub(-2) - else ------------------------------------- lightest octile - r = hex(r / 5):sub(-2) - g = hex(g / 5):sub(-2) - b = hex(b / 5):sub(-2) - end - return string.format("#%s%s%s", r, g, b) -end - ---@param filename string ---@param obj any local function write(filename, obj) @@ -66,14 +27,16 @@ local function generate_icons(filename, light) for name, value in pairs(original) do local icon = { name = name, - icon = value.icon, + -- some icons are not nerd-fonts + icon = nerdfonts.get_icon_by_class(value.icon) or value.icon, color = value.color, } if light then - icon.color = darken_color(icon.color) + icon.color = color.darken(icon.color) end icon.cterm_color = tostring(vim.fn["colortemplate#colorspace#approx"](icon.color).index) + assert(icon.icon:len() <= 4) assert(value.file or value.extension or value.os) if value.file then diff --git a/lua/nvim-web-devicons/_gen/nerdfonts.lua b/lua/nvim-web-devicons/_gen/nerdfonts.lua new file mode 100644 index 000000000..958418bf5 --- /dev/null +++ b/lua/nvim-web-devicons/_gen/nerdfonts.lua @@ -0,0 +1,27 @@ +---@param path string +---@return { [string]: string } +local function load_json(path) + local file = assert(io.open(path, "r")) + local json = file:read "*a" + file:close() + local data = vim.json.decode(json) + local icons = {} + for name, t in pairs(data) do + if name ~= "METADATA" then + icons[name] = t.char + end + end + return icons +end + +local icons = load_json "nerd-fonts/glyphnames.json" + +local M = {} + +---@param class string +---@return string? +function M.get_icon_by_class(class) + return icons[class] +end + +return M