commit 21d1c08b8553a1449d0acdc473eff96c2eca9e56 Author: gbprod Date: Thu Nov 24 08:53:14 2022 +0100 Initial commit diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c8d021e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,21 @@ +name: Integration + +on: + push: + branches: [main] + pull_request: + branches: [main] + schedule: + - cron: '0 7 * * 1' + +jobs: + stylua: + name: Check codestyle + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: JohnnyMorganz/stylua-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --color always --check . + diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml new file mode 100644 index 0000000..07c868b --- /dev/null +++ b/.github/workflows/doc.yml @@ -0,0 +1,22 @@ +name: panvimdoc + +on: + push: + branches: [main] + +jobs: + docs: + runs-on: ubuntu-latest + name: pandoc to vimdoc + steps: + - uses: actions/checkout@v2 + - name: panvimdoc + uses: kdheepak/panvimdoc@main + with: + vimdoc: nord-nvim + description: Nord theme for Neovim + version: 'NVIM v0.8.0' + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: 'chore: auto generate docs' + branch: ${{ github.head_ref }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..926ccaa --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +doc/tags diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..653f105 --- /dev/null +++ b/.luacheckrc @@ -0,0 +1 @@ +globals = { "vim" } diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..1e022ee --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,3 @@ +# Contributor Code of Conduct + +[Don't be a jerk.](https://meta.wikimedia.org/wiki/Don%27t_be_a_jerk) diff --git a/LICENCE b/LICENCE new file mode 100644 index 0000000..f196531 --- /dev/null +++ b/LICENCE @@ -0,0 +1,12 @@ + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + +Everyone is permitted to copy and distribute verbatim or modified +copies of this license document, and changing it is allowed as long +as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. You just DO WHAT THE FUCK YOU WANT TO. + diff --git a/README.md b/README.md new file mode 100644 index 0000000..4e25484 --- /dev/null +++ b/README.md @@ -0,0 +1,120 @@ +# gbprod/nord.nvim + +Neovim theme using the [Nord palette](https://www.nordtheme.com/) that tries to +be as close as possible to the [official vim theme](https://github.com/arcticicestudio/nord-vim/) +and [the official vscode theme](https://github.com/arcticicestudio/nord-visual-studio-code). + +**This colorscheme still under developement, please keep calm and report issues** + +> "Arctic, north-bluish clean and elegant" - arcticicestudio + + +![2022-12-01-142011_1277x703_scrot](https://user-images.githubusercontent.com/3751019/205092735-ced8ba05-d15d-4751-9a88-17cefef5ec52.png) +![2022-12-01-142157_1270x700_scrot](https://user-images.githubusercontent.com/3751019/205092727-a266d2c8-35fd-4272-b90f-c1f063591e58.png) +![2022-12-01-142111_1276x700_scrot](https://user-images.githubusercontent.com/3751019/205092730-9874369f-d045-47c6-8b07-5371cf344223.png) +![2022-12-01-142044_1265x634_scrot](https://user-images.githubusercontent.com/3751019/205092733-3aebea83-c5a8-4e96-ab2e-a4646cc9e3ea.png) + +## ✨ Features {#features} + +- supports TreeSitter and LSP +- vim terminal colors +- **lualine** theme + +### Plugin Support + +- [TreeSitter](https://github.com/nvim-treesitter/nvim-treesitter) +- [LSP Diagnostics](https://neovim.io/doc/user/lsp.html) +- [LSP Trouble](https://github.com/folke/lsp-trouble.nvim) +- [Git Signs](https://github.com/lewis6991/gitsigns.nvim) +- [Git Gutter](https://github.com/airblade/vim-gitgutter) +- [Telescope](https://github.com/nvim-telescope/telescope.nvim) +- [NvimTree](https://github.com/kyazdani42/nvim-tree.lua) +- [WhichKey](https://github.com/liuchengxu/vim-which-key) +- [Lualine](https://github.com/hoob3rt/lualine.nvim) +- [Leap](https://github.com/ggandor/leap.nvim) +- [Barbar](https://github.com/romgrk/barbar.nvim) +- [Cmp](https://github.com/hrsh7th/nvim-cmp/) +- [Navic](https://github.com/SmiteshP/nvim-navic) + +You're preferred plugin is missing ? Open an issue or, even better, open a pull +request πŸ˜‰. + +## ⚑️ Requirements + +- Neovim >= 0.8.0 + +## πŸ“¦ Installation + +Install the theme with your preferred package manager: + +[packer](https://github.com/wbthomason/packer.nvim) + +```lua +use 'gbprod/nord.nvim' +``` + +## πŸš€ Usage + +Enable the colorscheme: + +```vim +" Vim Script +colorscheme nord +``` + +```lua +-- Lua +vim.cmd[[colorscheme nord]] +``` + +To enable the `nord` theme for `Lualine`, simply specify it in your +lualine settings: + +```lua +require('lualine').setup { + options = { + -- ... your lualine config + theme = 'nord' + -- ... your lualine config + } +} +``` + +## βš™οΈ Configuration + +> ❗️ configuration needs to be set **BEFORE** loading the color scheme with +> `colorscheme nord` + +Nord.nvim will use the default options, unless you call `setup`. + +```lua +require("nord").setup({ + -- your configuration comes here + -- or leave it empty to use the default settings + transparent = false, -- Enable this to disable setting the background color + terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim + diff = { mode = "bg" }, -- enables/disables colorful backgrounds when used in diff mode. values : [bg|fg] + borders = true, -- Enable the border between verticaly split windows visible + errors = { mode = "bg" }, -- Display mode for errors and diagnostics + -- values : [bg|fg|none] + styles = { + -- Style to be applied to different syntax groups + -- Value is any valid attr-list value for `:help nvim_set_hl` + comments = { italic = true }, + keywords = {}, + functions = {}, + variables = {}, + }, +}) +``` + +## πŸŽ‰ Credits + +- [shaunsingh/nord.nvim](https://github.com/shaunsingh/nord.nvim): pretty good + Nord theme for Neovim but to far from original and requires too much + customisation for me. +- [arcticicestudio/nord-visual-studio-code](https://github.com/arcticicestudio/nord-visual-studio-code): For color picking +- [arcticicestudio/nord-vim](https://github.com/arcticicestudio/nord-vim): For + his years of good and loyal service. +- [folke/tokyonight.nvim](https://github.com/folke/tokyonight.nvim): For a lot + of code inspiration. diff --git a/colors/nord.lua b/colors/nord.lua new file mode 100644 index 0000000..2dc3903 --- /dev/null +++ b/colors/nord.lua @@ -0,0 +1 @@ +require("nord").load() diff --git a/doc/nord-nvim.txt b/doc/nord-nvim.txt new file mode 100644 index 0000000..24d81f7 --- /dev/null +++ b/doc/nord-nvim.txt @@ -0,0 +1,161 @@ +*nord-nvim.txt* Nord theme for Neovim + +============================================================================== +Table of Contents *nord-nvim-table-of-contents* + +1. gbprod/nord.nvim |nord-nvim-gbprod/nord.nvim| + - ✨ Features |nord-nvim-✨-features| + - ⚑️ Requirements |nord-nvim-⚑️-requirements| + - πŸ“¦ Installation |nord-nvim-πŸ“¦-installation| + - πŸš€ Usage |nord-nvim-πŸš€-usage| + - βš™οΈ Configuration |nord-nvim-βš™οΈ-configuration| + - πŸŽ‰ Credits |nord-nvim-πŸŽ‰-credits| + +============================================================================== +1. gbprod/nord.nvim *nord-nvim-gbprod/nord.nvim* + +Neovim theme using the Nord palette that tries to +be as close as possible to the official vim theme + and the official vscode theme +. + +**This colorscheme still under developement, please keep calm and report +issues** + + + "Arctic, north-bluish clean and elegant" - arcticicestudio + + + + +✨ FEATURES *nord-nvim-✨-features* + + +- supports TreeSitter and LSP +- vim terminal colors +- **lualine** theme + + +PLUGIN SUPPORT ~ + + +- TreeSitter +- |LSP Diagnostics| +- LSP Trouble +- Git Signs +- Git Gutter +- Telescope +- NvimTree +- WhichKey +- Lualine +- Leap +- Barbar +- Cmp +- Navic + + +You’re preferred plugin is missing ? Open an issue or, even better, open a +pull request πŸ˜‰. + +⚑️ REQUIREMENTS *nord-nvim-⚑️-requirements* + + +- Neovim >= 0.8.0 + + +πŸ“¦ INSTALLATION *nord-nvim-πŸ“¦-installation* + +Install the theme with your preferred package manager: + +packer + +> + use 'gbprod/nord.nvim' +< + + +πŸš€ USAGE *nord-nvim-πŸš€-usage* + +Enable the colorscheme: + +> + " Vim Script + colorscheme tokyonight +< + + +> + -- Lua + vim.cmd[[colorscheme tokyonight]] +< + + +To enable the `nord` theme for `Lualine`, simply specify it in your lualine +settings: + +> + require('lualine').setup { + options = { + -- ... your lualine config + theme = 'nord' + -- ... your lualine config + } + } +< + + +βš™οΈ CONFIGURATION *nord-nvim-βš™οΈ-configuration* + + + ❗️ configuration needs to be set **BEFORE** loading the color scheme with + `colorscheme nord` + + +Nord.nvim will use the default options, unless you call `setup`. + +> + require("nord").setup({ + -- your configuration comes here + -- or leave it empty to use the default settings + transparent = false, -- Enable this to disable setting the background color + terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim + diff = { mode = "bg" }, -- enables/disables colorful backgrounds when used in diff mode. values : [bg|fg] + borders = true, -- Enable the border between verticaly split windows visible + errors = { mode = "bg" }, -- Display mode for errors and diagnostics + -- values : [bg|fg|none] + styles = { + -- Style to be applied to different syntax groups + -- Value is any valid attr-list value for `:help nvim_set_hl` + comments = { italic = true }, + keywords = {}, + functions = {}, + variables = {}, + }, + }) +< + + +πŸŽ‰ CREDITS *nord-nvim-πŸŽ‰-credits* + + +- shaunsingh/nord.nvim : pretty good + Nord theme for Neovim but to far from original and requires too much + customisation for me. +- arcticicestudio/nord-visual-studio-code : For color picking +- arcticicestudio/nord-vim : For + his years of good and loyal service. +- folke/tokyonight.nvim : For a lot + of code inspiration. + + +Generated by panvimdoc + +vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/lua/lualine/themes/nord.lua b/lua/lualine/themes/nord.lua new file mode 100644 index 0000000..54ff660 --- /dev/null +++ b/lua/lualine/themes/nord.lua @@ -0,0 +1,33 @@ +local c = require("nord.colors") + +local nord = {} + +nord.normal = { + a = { fg = c.polar_night.bright, bg = c.frost.ice }, + b = { fg = c.snow_storm.brighter, bg = c.polar_night.brighter }, + c = { fg = c.snow_storm.brighter, bg = c.polar_night.brightest }, +} + +nord.insert = { + a = { fg = c.polar_night.bright, bg = c.snow_storm.brightest }, +} + +nord.visual = { + a = { fg = c.polar_night.bright, bg = c.frost.polar_water }, +} + +nord.replace = { + a = { fg = c.polar_night.bright, bg = c.aurora.yellow }, +} + +nord.command = { + a = { fg = c.polar_night.bright, bg = c.aurora.purple }, +} + +nord.inactive = { + a = { fg = c.snow_storm.origin, bg = c.polar_night.origin }, + b = { fg = c.snow_storm.origin, bg = c.polar_night.origin }, + c = { fg = c.snow_storm.origin, bg = c.polar_night.bright }, +} + +return nord diff --git a/lua/nord/colors.lua b/lua/nord/colors.lua new file mode 100644 index 0000000..87cdfa8 --- /dev/null +++ b/lua/nord/colors.lua @@ -0,0 +1,28 @@ +return { + polar_night = { + origin = "#2E3440", -- nord0 + bright = "#3B4252", -- nord1 + brighter = "#434C5E", -- nord2 + brightest = "#4C566A", -- nord3 + light = "#616E88", -- out of palette + }, + snow_storm = { + origin = "#D8DEE9", -- nord4 + brighter = "#E5E9F0", -- nord5 + brightest = "#ECEFF4", -- nord6 + }, + frost = { + polar_water = "#8FBCBB", -- nord7 + ice = "#88C0D0", -- nord8 + artic_water = "#81A1C1", -- nord9 + artic_ocean = "#5E81AC", -- nord10 + }, + aurora = { + red = "#BF616A", -- nord11 + orange = "#D08770", -- nord12 + yellow = "#EBCB8B", -- nord13 + green = "#A3BE8C", -- nord14 + purple = "#B48EAD", -- nord15 + }, + none = "NONE", +} diff --git a/lua/nord/config.lua b/lua/nord/config.lua new file mode 100644 index 0000000..a156717 --- /dev/null +++ b/lua/nord/config.lua @@ -0,0 +1,33 @@ +local config = {} + +local defaults = { + transparent = false, -- Enable this to disable setting the background color + terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim + + diff = { mode = "bg" }, -- [bg|fg] + borders = true, + errors = { mode = "bg" }, -- [bg|fg|none] + + styles = { + -- Value is any valid attr-list value for `:help nvim_set_hl` + comments = { italic = true }, + keywords = {}, + functions = {}, + variables = {}, + errors = {}, + }, +} + +config.options = {} + +function config.setup(options) + config.options = vim.tbl_deep_extend("force", {}, defaults, options or {}) +end + +function config.extend(options) + config.options = vim.tbl_deep_extend("force", {}, config.options or defaults, options or {}) +end + +config.setup() + +return config diff --git a/lua/nord/defaults.lua b/lua/nord/defaults.lua new file mode 100644 index 0000000..3db56d1 --- /dev/null +++ b/lua/nord/defaults.lua @@ -0,0 +1,88 @@ +local c = require("nord.colors") +local utils = require("nord.utils") + +local defaluts = {} + +function defaluts.highlights() + local options = require("nord.config").options + + return { + ColorColumn = { bg = c.polar_night.bright }, -- used for the columns set with 'colorcolumn' + Conceal = { fg = c.none, bg = c.none }, -- placeholder characters substituted for concealed text (see 'conceallevel') + Cursor = { fg = c.snow_storm.origin, bg = c.none, reverse = true }, -- the character under the cursor + CursorIM = { fg = c.snow_storm.brighter, bg = c.none, reverse = true }, -- like Cursor, but used when in IME mode + CursorColumn = { bg = c.polar_night.bright }, -- Screen-column at the cursor, when 'cursorcolumn' is set. + CursorLine = { bg = c.polar_night.bright }, -- Screen-line at the cursor, when 'cursorline' is set. Low-priority if foreground (ctermfg OR guifg) is not set. + Directory = { fg = c.frost.ice }, -- directory names (and other special names in listings) + EndOfBuffer = { fg = c.polar_night.bright }, -- filler lines (~) after the end of the buffer. By default, this is highlighted like |hl-NonText|. + ErrorMsg = { fg = c.snow_storm.origin, bg = c.aurora.red }, -- error messages on the command line + VertSplit = { fg = c.polar_night.brighter, bg = options.borders and c.polar_night.bright or c.polar_night.origin }, -- the column separating vertically split windows + WinSeparator = { + fg = c.polar_night.brighter, + bg = options.borders and c.polar_night.bright or c.polar_night.origin, + }, -- the column separating vertically split windows + Folded = { fg = c.polar_night.brightest, bg = c.polar_night.bright }, -- line used for closed folds + FoldColumn = { fg = c.polar_night.brightest, bg = c.polar_night.origin }, -- 'foldcolumn' + SignColumn = { fg = c.polar_night.bright, bg = options.transparent and c.none or c.polar_night.origin }, -- column where |signs| are displayed + -- Substitute = { link = "Search" }, -- |:substitute| replacement text highlighting + LineNr = { fg = c.polar_night.brightest, bg = c.none }, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set. + CursorLineNr = { fg = c.snow_storm.origin, bold = true }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. + MatchParen = { fg = c.frost.ice, bg = c.polar_night.brightest }, -- The character under the cursor or just before it, if it is a paired bracket, and its match. |pi_paren.txt| + ModeMsg = { fg = c.snow_storm.origin }, -- 'showmode' message (e.g., "-- INSERT -- ") + MsgArea = {}, -- Area for messages and cmdline + MsgSeparator = {}, -- Separator for scrolled messages, `msgsep` flag of 'display' + MoreMsg = { fg = c.frost.ice }, -- |more-prompt| + NonText = { fg = c.polar_night.brighter }, -- '@' at the end of the window, characters from 'showbreak' and other characters that do not really exist in the text (e.g., ">" displayed when a double-wide character doesn't fit at the end of the line). See also |hl-EndOfBuffer|. + Normal = { fg = c.snow_storm.origin, bg = options.transparent and c.none or c.polar_night.origin }, -- normal text + NormalFloat = { fg = c.snow_storm.origin, bg = c.polar_night.origin }, -- Normal text in floating windows. + FloatBorder = { fg = c.polar_night.brightest, bg = c.polar_night.origin }, -- Borders of floating windows + Pmenu = { fg = c.snow_storm.origin, bg = c.polar_night.brighter }, -- Popup menu: normal item. + PmenuSel = { fg = c.snow_storm.origin, bg = c.polar_night.brightest }, -- Popup menu: selected item. + PmenuSbar = { fg = c.snow_storm.origin, bg = c.polar_night.brighter }, -- Popup menu: scrollbar. + PmenuThumb = { fg = c.frost.ice, bg = c.polar_night.brightest }, -- Popup menu: Thumb of the scrollbar. + Question = { fg = c.snow_storm.origin }, -- |hit-enter| prompt and yes/no questions + + QuickFixLine = { fg = c.snow_storm.origin, bg = c.none, reverse = true }, -- Current |quickfix| item in the quickfix window. Combined with |hl-CursorLine| when the cursor is there. + Search = { fg = c.polar_night.bright, bg = c.frost.ice }, -- Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand out. + IncSearch = { fg = c.snow_storm.brightest, bg = c.frost.ice }, -- 'incsearch' highlighting; also used for the text replaced with ":s///c" + CurSearch = { link = "IncSearch" }, + SpecialKey = { fg = c.polar_night.brightest }, -- Unprintable characters: text displayed differently from what it really is. But not 'listchars' whitespace. |hl-Whitespace| + + SpellBad = { fg = c.aurora.red, bg = c.polar_night.origin, sp = c.aurora.red, undercurl = true }, -- Word that is not recognized by the spellchecker. |spell| Combined with the highlighting used otherwise. + SpellCap = { fg = c.aurora.yellow, bg = c.polar_night.origin, sp = c.aurora.yellow, undercurl = true }, -- Word that should start with a capital. |spell| Combined with the highlighting used otherwise. + SpellLocal = { fg = c.snow_storm.brighter, bg = c.polar_night.origin, sp = c.snow_storm.brighter, undercurl = true }, -- Word that is recognized by the spellchecker as one that is used in another region. |spell| Combined with the highlighting used otherwise. + SpellRare = { + fg = c.snow_storm.brightest, + bg = c.polar_night.origin, + sp = c.snow_storm.brightest, + undercurl = true, + }, -- Word that is recognized by the spellchecker as one that is hardly ever used. |spell| Combined with the highlighting used otherwise. + + StatusLine = { fg = c.frost.ice, bg = c.polar_night.brightest }, -- status line of current window + StatusLineNC = { fg = c.snow_storm.origin, bg = c.polar_night.brightest }, -- status lines of not-current windows Note: if this is equal to "StatusLine" Vim will use "^^^" in the status line of the current window. + + TabLine = { fg = c.snow_storm.origin, bg = c.fg_gutter }, -- tab pages line, not active tab page label + TabLineFill = { fg = c.snow_storm.origin, bg = c.polar_night.bright }, -- tab pages line, where there are no labels + TabLineSel = { fg = c.frost.ice, bg = c.polar_night.brightest }, -- tab pages line, active tab page label + + Title = { fg = c.snow_storm.origin, bold = true }, -- titles for output from ":set all", ":autocmd" etc. + + Visual = { fg = c.none, bg = c.polar_night.brighter }, -- Visual mode selection + VisualNOS = { fg = c.none, bg = c.polar_night.brighter }, -- Visual mode selection when vim is "Not Owning the Selection". + WarningMsg = { fg = c.polar_night.origin, bg = c.aurora.yellow }, -- warning messages + Whitespace = { fg = c.polar_night.brighter }, -- "nbsp", "space", "tab" and "trail" in 'listchars' + WildMenu = { fg = c.frost.ice, bg = c.polar_night.bright }, -- current match in 'wildmenu' completion + qfLineNr = { fg = c.frost.artic_water }, + qfFileName = { fg = c.frost.ice }, + DiffAdd = utils.make_diff(c.aurora.green), -- diff mode: Added line + DiffChange = utils.make_diff(c.aurora.yellow), -- diff mode: Changed line + DiffDelete = utils.make_diff(c.aurora.red), -- diff mode: Deleted line + DiffText = utils.make_diff(c.frost.artic_water), -- diff mode: Changed text within a changed line + + healthError = { fg = c.aurora.red }, + healthSuccess = { fg = c.aurora.green }, + healthWarning = { fg = c.aurora.yellow }, + } +end + +return defaluts diff --git a/lua/nord/init.lua b/lua/nord/init.lua new file mode 100644 index 0000000..1a76169 --- /dev/null +++ b/lua/nord/init.lua @@ -0,0 +1,34 @@ +local config = require("nord.config") +local utils = require("nord.utils") + +local nord = {} + +function nord.load(opts) + if opts then + require("nord.config").extend(opts) + end + + vim.cmd([[ highlight clear ]]) + + if config.options.terminal_colors then + require("nord.terminal").apply() + end + + utils.load(require("nord.defaults").highlights()) + utils.load(require("nord.syntax").highlights()) + utils.load(require("nord.treesitter").highlights()) + utils.load(require("nord.terminal").highlights()) + utils.load(require("nord.lsp").highlights()) + + utils.load(require("nord.plugins.bufferline").highlights()) + utils.load(require("nord.plugins.git").highlights()) + utils.load(require("nord.plugins.completion").highlights()) + utils.load(require("nord.plugins.filetree").highlights()) + utils.load(require("nord.plugins.motion").highlights()) + utils.load(require("nord.plugins.picker").highlights()) + utils.load(require("nord.plugins.ui").highlights()) +end + +nord.setup = config.setup + +return nord diff --git a/lua/nord/lsp.lua b/lua/nord/lsp.lua new file mode 100644 index 0000000..249a9e8 --- /dev/null +++ b/lua/nord/lsp.lua @@ -0,0 +1,41 @@ +local utils = require("nord.utils") +local lsp = {} + +local c = require("nord.colors") + +function lsp.highlights() + return { + -- LspReferenceText = { bg = c.fg_gutter }, -- used for highlighting "text" references + -- LspReferenceRead = { bg = c.fg_gutter }, -- used for highlighting "read" references + -- LspReferenceWrite = { bg = c.fg_gutter }, -- used for highlighting "write" references + + DiagnosticError = { fg = c.aurora.red }, -- Used as the base highlight group. Other Diagnostic highlights link to this by default + DiagnosticWarn = { fg = c.aurora.yellow }, -- Used as the base highlight group. Other Diagnostic highlights link to this by default + DiagnosticInfo = { fg = c.frost.ice }, -- Used as the base highlight group. Other Diagnostic highlights link to this by default + DiagnosticHint = { fg = c.frost.artic_water }, -- Used as the base highlight group. Other Diagnostic highlights link to this by default + + DiagnosticVirtualTextError = { bg = utils.darken(c.aurora.red, 0.1), fg = c.aurora.red }, -- Used for "Error" diagnostic virtual text + DiagnosticVirtualTextWarn = { bg = utils.darken(c.aurora.yellow, 0.1), fg = c.aurora.yellow }, -- Used for "Warning" diagnostic virtual text + DiagnosticVirtualTextInfo = { bg = utils.darken(c.frost.ice, 0.1), fg = c.frost.ice }, -- Used for "Information" diagnostic virtual text + DiagnosticVirtualTextHint = { bg = utils.darken(c.frost.artic_water, 0.1), fg = c.frost.artic_water }, -- Used for "Hint" diagnostic virtual text + + DiagnosticUnderlineError = { undercurl = true, sp = c.aurora.red }, -- Used to underline "Error" diagnostics + DiagnosticUnderlineWarn = { undercurl = true, sp = c.aurora.yellow }, -- Used to underline "Warning" diagnostics + DiagnosticUnderlineInfo = { undercurl = true, sp = c.frost.ice }, -- Used to underline "Information" diagnostics + DiagnosticUnderlineHint = { undercurl = true, sp = c.frost.artic_water }, -- Used to underline "Hint" diagnostics + + LspCodeLens = { fg = c.polar_night.brightest }, + + -- ray-x/lsp_signature.nvim + LspSignatureActiveParameter = { bg = c.polar_night.brighter, bold = true }, + + -- LspTrouble + TroubleText = { fg = c.snow_storm.origin }, + TroubleCount = { fg = c.frost.ice, bg = c.polar_night.brightest }, + TroubleNormal = { fg = c.snow_storm.origin, bg = c.none }, + TroubleIndent = { fg = c.polar_night.light, bg = c.none }, + TroubleLocation = { fg = c.polar_night.light, bg = c.none }, + } +end + +return lsp diff --git a/lua/nord/plugins/bufferline.lua b/lua/nord/plugins/bufferline.lua new file mode 100644 index 0000000..11b1bb0 --- /dev/null +++ b/lua/nord/plugins/bufferline.lua @@ -0,0 +1,34 @@ +local utils = require("nord.utils") + +local bufferline = {} + +local c = require("nord.colors") + +function bufferline.highlights() + return { + -- Barbar + BufferTabpageFill = { bg = c.polar_night.origin }, + + BufferCurrent = { bg = c.polar_night.brighter }, + BufferCurrentIndex = { bg = c.polar_night.brighter }, + BufferCurrentMod = { bg = c.polar_night.brighter, fg = c.aurora.yellow }, + BufferCurrentSign = { bg = c.polar_night.brighter }, + BufferCurrentTarget = { bg = c.polar_night.brighter, fg = c.aurora.red }, + + BufferVisible = { bg = c.polar_night.bright }, + BufferVisibleIndex = { bg = c.polar_night.bright }, + BufferVisibleMod = { bg = c.polar_night.bright, fg = c.aurora.yellow }, + BufferVisibleSign = { bg = c.polar_night.bright }, + BufferVisibleTarget = { bg = c.polar_night.bright, fg = c.aurora.red }, + + BufferInactive = { bg = c.polar_night.origin, fg = utils.darken(c.snow_storm.origin, 0.4) }, + BufferInactiveIndex = { bg = c.polar_night.origin, fg = utils.darken(c.snow_storm.origin, 0.4) }, + BufferInactiveMod = { bg = c.polar_night.origin, fg = utils.darken(c.aurora.yellow, 0.4) }, + BufferInactiveSign = { bg = c.polar_night.origin, fg = utils.darken(c.snow_storm.origin, 0.4) }, + BufferInactiveTarget = { bg = c.polar_night.origin, fg = c.aurora.red }, + BufferTabpages = { bg = c.bg_statusline, fg = c.none }, + BufferTabpage = { bg = c.bg_statusline, fg = c.border_highlight }, + } +end + +return bufferline diff --git a/lua/nord/plugins/completion.lua b/lua/nord/plugins/completion.lua new file mode 100644 index 0000000..7cb3dd5 --- /dev/null +++ b/lua/nord/plugins/completion.lua @@ -0,0 +1,21 @@ +local cmp = {} + +local c = require("nord.colors") + +function cmp.highlights() + return { + CmpItemAbbrDeprecated = { fg = c.polar_night.brightest }, + CmpItemAbbrMatch = { fg = c.frost.ice, bold = true }, + CmpItemAbbrMatchFuzzy = { fg = c.frost.ice, bold = true }, + CmpItemKind = { fg = c.frost.artic_water }, + CmpItemKindVariable = { fg = c.frost.ice }, + CmpItemKindInterface = { fg = c.frost.ice }, + CmpItemKindClass = { fg = c.frost.ice }, + CmpItemKindFunction = { fg = c.aurora.purple }, + CmpItemKindMethod = { fg = c.aurora.purple }, + CmpItemKindSnippet = { fg = c.aurora.green }, + CmpItemKindText = { fg = c.snow_storm.origin }, + } +end + +return cmp diff --git a/lua/nord/plugins/filetree.lua b/lua/nord/plugins/filetree.lua new file mode 100644 index 0000000..65454d3 --- /dev/null +++ b/lua/nord/plugins/filetree.lua @@ -0,0 +1,26 @@ +local filetree = {} + +local config = require("nord.config") +local c = require("nord.colors") + +function filetree.highlights() + return { + -- NvimTree + NvimTreeNormal = { fg = c.snow_storm.origin }, + NvimTreeWinSeparator = { fg = config.options.borders and c.polar_night.bright or c.none }, + NvimTreeNormalNC = { fg = c.snow_storm.origin }, + NvimTreeRootFolder = { fg = c.snow_storm.origin, bold = true }, + NvimTreeGitDirty = { fg = c.aurora.yellow }, + NvimTreeGitNew = { fg = c.aurora.green }, + NvimTreeGitDeleted = { fg = c.aurora.red }, + NvimTreeGitIgnored = { fg = c.polar_night.light }, + NvimTreeSpecialFile = { fg = c.aurora.yellow, underline = true }, + NvimTreeIndentMarker = { fg = c.frost.artic_water }, + NvimTreeImageFile = { fg = c.snow_storm.origin }, + NvimTreeSymlink = { fg = c.frost.artic_water }, + NvimTreeFolderIcon = { fg = c.frost.artic_water }, + NvimTreeOpenedFolderName = { fg = c.snow_storm.origin }, + } +end + +return filetree diff --git a/lua/nord/plugins/git.lua b/lua/nord/plugins/git.lua new file mode 100644 index 0000000..7d58866 --- /dev/null +++ b/lua/nord/plugins/git.lua @@ -0,0 +1,26 @@ +local git = {} + +local c = require("nord.colors") + +function git.highlights() + return { + -- airblade/vim-gitgutter + GitGutterAdd = { fg = c.aurora.green }, + GitGutterChange = { fg = c.aurora.yellow }, + GitGutterDelete = { fg = c.aurora.red }, + + -- lewis6991/gitsigns.nvim + GitSignsAdd = { fg = c.aurora.green }, + GitSignsAddNr = { fg = c.aurora.green }, + GitSignsAddLn = { fg = c.aurora.green }, + GitSignsChange = { fg = c.aurora.yellow }, + GitSignsChangeNr = { fg = c.aurora.yellow }, + GitSignsChangeLn = { fg = c.aurora.yellow }, + GitSignsDelete = { fg = c.aurora.red }, + GitSignsDeleteNr = { fg = c.aurora.red }, + GitSignsDeleteLn = { fg = c.aurora.red }, + GitSignsCurrentLineBlame = { fg = c.polar_night.brightest, bold = true }, + } +end + +return git diff --git a/lua/nord/plugins/motion.lua b/lua/nord/plugins/motion.lua new file mode 100644 index 0000000..a2421ce --- /dev/null +++ b/lua/nord/plugins/motion.lua @@ -0,0 +1,14 @@ +local motion = {} + +local c = require("nord.colors") + +function motion.highlights() + return { + LeapMatch = { bg = c.aurora.green, fg = c.polar_night.bright, bold = true, nocombine = true }, + LeapLabelPrimary = { fg = c.polar_night.bright, bg = c.aurora.green, bold = true, nocombine = true }, + LeapLabelSecondary = { fg = c.polar_night.bright, bg = c.aurora.purple, bold = true, nocombine = true }, + LeapLabelSelected = { fg = c.polar_night.bright, bg = c.aurora.yellow, bold = true, nocombine = true }, + } +end + +return motion diff --git a/lua/nord/plugins/picker.lua b/lua/nord/plugins/picker.lua new file mode 100644 index 0000000..ec73c35 --- /dev/null +++ b/lua/nord/plugins/picker.lua @@ -0,0 +1,14 @@ +local picker = {} + +local c = require("nord.colors") + +function picker.highlights() + return { + TelescopeBorder = { fg = c.polar_night.light, bg = c.polar_night.origin }, + TelescopeTitle = { fg = c.snow_storm.origin, bold = true }, + TelescopePromptCounter = { fg = c.polar_night.light }, + TelescopeMatching = { fg = c.frost.ice, bold = true }, + } +end + +return picker diff --git a/lua/nord/plugins/ui.lua b/lua/nord/plugins/ui.lua new file mode 100644 index 0000000..3aadc6d --- /dev/null +++ b/lua/nord/plugins/ui.lua @@ -0,0 +1,46 @@ +local ui = {} + +local c = require("nord.colors") + +function ui.highlights() + return { + -- WhichKey + WhichKey = { fg = c.frost.ice, bold = true }, + WhichKeyGroup = { fg = c.frost.artic_water }, + WhichKeyDesc = { fg = c.snow_storm.origin }, + WhichKeyFloat = { bg = c.polar_night.bright }, + + -- Navic + NavicIconsFile = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicIconsModule = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicIconsNamespace = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicIconsPackage = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicIconsClass = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicIconsMethod = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicIconsProperty = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicIconsField = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicIconsConstructor = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicIconsEnum = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicIconsInterface = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicIconsFunction = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicIconsVariable = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicIconsConstant = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicIconsString = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicIconsNumber = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicIconsBoolean = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicIconsArray = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicIconsObject = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicIconsKey = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicIconsKeyword = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicIconsNull = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicIconsEnumMember = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicIconsStruct = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicIconsEvent = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicIconsOperator = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicIconsTypeParameter = { fg = c.frost.polar_water, bg = c.polar_night.brightest }, + NavicText = { fg = c.snow_storm.origin, bg = c.polar_night.brightest }, + NavicSeparator = { fg = c.frost.artic_water, bg = c.polar_night.brightest }, + } +end + +return ui diff --git a/lua/nord/syntax.lua b/lua/nord/syntax.lua new file mode 100644 index 0000000..9427444 --- /dev/null +++ b/lua/nord/syntax.lua @@ -0,0 +1,70 @@ +local c = require("nord.colors") +local utils = require("nord.utils") + +local base = {} + +function base.highlights() + local options = require("nord.config").options + + return { + Bold = { bold = true }, + Boolean = { fg = c.frost.artic_water }, -- a boolean constant: TRUE, false + Character = { fg = c.aurora.green }, -- a character constant: 'c', '\n' + Conditional = { fg = c.frost.artic_water }, -- if, then, else, endif, switch, etc. + Constant = { fg = c.snow_storm.origin }, -- (preferred) any constant + Comment = vim.tbl_extend("force", { fg = c.polar_night.light }, options.styles.comments), -- any comment + Debug = { fg = c.snow_storm.origin }, -- debugging statements + Define = { fg = c.frost.artic_water }, -- preprocessor #define + Delimiter = { fg = c.snow_storm.brightest }, -- character that needs attention + -- Error = { fg = c.snow_storm.origin, bg = c.aurora.red }, -- (preferred) any erroneous construct + Error = utils.make_error(c.aurora.red), -- (preferred) any erroneous construct + Exception = { fg = c.frost.artic_water }, -- try, catch, throw + Float = { fg = c.aurora.purple }, -- a floating point constant: 2.3e10 + Function = vim.tbl_extend("force", { fg = c.frost.ice }, options.styles.functions), -- function name (also: methods for classes) + Identifier = vim.tbl_extend("force", { fg = c.snow_storm.origin }, options.styles.variables), -- (preferred) any variable name + Include = { fg = c.frost.artic_water }, -- preprocessor #include + Italic = { italic = true }, + Keyword = vim.tbl_extend("force", { fg = c.frost.artic_water }, options.styles.keywords), -- any other keyword + Label = { fg = c.frost.artic_water }, -- case, default, etc. + Macro = { link = "Define" }, -- same as Define + Number = { fg = c.aurora.purple }, -- a number constant: 234, 0xff + Operator = { fg = c.frost.artic_water }, -- "sizeof", "+", "*", etc. + PreCondit = { link = "PreProc" }, -- preprocessor #if, #else, #endif, etc. + PreProc = { fg = c.frost.artic_water }, -- (preferred) generic Preprocessor + Repeat = { fg = c.frost.artic_water }, -- for, do, while, etc. + Special = { fg = c.snow_storm.origin }, -- (preferred) any special symbol + SpecialChar = { fg = c.aurora.yellow }, -- special character in a constant + SpecialComment = { fg = c.frost.ice }, -- special things inside a comment + Statement = { fg = c.frost.artic_water }, -- (preferred) any statement + StorageClass = { fg = c.frost.artic_water }, -- static, register, volatile, etc. + String = { fg = c.aurora.green }, -- a string constant: "this is a string" + Structure = { fg = c.frost.artic_water }, -- struct, union, enum, etc. + Tag = { fg = c.snow_storm.origin }, -- you can use CTRL-] on this + Todo = { fg = c.aurora.yellow, bg = c.none }, -- (preferred) anything that needs extra attention; mostly the keywords TODO FIXME and XXX + Type = { fg = c.frost.artic_water }, -- (preferred) int, long, char, etc. + Typedef = { fg = c.frost.artic_water }, -- A typedef + Underlined = { underline = true }, -- (preferred) text that stands out, HTML links + -- ("Ignore", below, may be invisible...) + -- Ignore = { }, -- (preferred) left blank, hidden |hl-Ignore| + + htmlH1 = { fg = c.frost.ice, bold = true }, + htmlH2 = { fg = c.frost.ice }, + + markdownHeadingDelimiter = { fg = c.frost.polar_water }, + markdownCode = { fg = c.frost.polar_water }, + markdownCodeBlock = { fg = c.snow_storm.origin }, + markdownH1 = { fg = c.frost.ice, bold = true }, + markdownH2 = { fg = c.frost.ice }, + markdownLinkText = { fg = c.frost.ice, underline = true }, + markdownBlockquote = { fg = c.frost.polar_water }, + markdownFootnote = { fg = c.frost.polar_water }, + markdownId = { fg = c.frost.polar_water }, + markdownIdDeclaration = { fg = c.frost.polar_water }, + markdownUrl = { fg = c.snow_storm.origin }, + + debugPC = { bg = c.frost.artic_water }, -- used for highlighting the current line in terminal-debug + debugBreakpoint = { bg = c.frost.artic_ocean, fg = c.frost.artic_water }, -- used for breakpoint colors in terminal-debug + } +end + +return base diff --git a/lua/nord/terminal.lua b/lua/nord/terminal.lua new file mode 100644 index 0000000..5deae9a --- /dev/null +++ b/lua/nord/terminal.lua @@ -0,0 +1,42 @@ +local terminal = {} + +local c = require("nord.colors") + +function terminal.apply() + -- dark + vim.g.terminal_color_0 = c.polar_night.bright + vim.g.terminal_color_8 = c.polar_night.brightest + + -- light + vim.g.terminal_color_7 = c.snow_storm.brighter + vim.g.terminal_color_15 = c.snow_storm.brightest + + -- colors + vim.g.terminal_color_1 = c.aurora.red + vim.g.terminal_color_9 = c.aurora.red + + vim.g.terminal_color_2 = c.aurora.green + vim.g.terminal_color_10 = c.aurora.green + + vim.g.terminal_color_3 = c.aurora.yellow + vim.g.terminal_color_11 = c.aurora.yellow + + vim.g.terminal_color_4 = c.frost.artic_water + vim.g.terminal_color_12 = c.frost.artic_water + + vim.g.terminal_color_5 = c.aurora.purple + vim.g.terminal_color_13 = c.aurora.purple + + vim.g.terminal_color_6 = c.frost.ice + vim.g.terminal_color_14 = c.frost.polar_water +end + +function terminal.highlights() + return { + + TermCursor = { fg = c.snow_storm.origin, bg = c.none, reverse = true }, -- cursor in a focused terminal + TermCursorNC = { fg = c.polar_night.brightest, bg = c.none, reverse = true }, -- cursor in an unfocused terminal + } +end + +return terminal diff --git a/lua/nord/treesitter.lua b/lua/nord/treesitter.lua new file mode 100644 index 0000000..77f48f2 --- /dev/null +++ b/lua/nord/treesitter.lua @@ -0,0 +1,113 @@ +local c = require("nord.colors") +local utils = require("nord.utils") + +local treesitter = {} + +function treesitter.highlights() + local options = require("nord.config").options + + return { + -- Misc + ["@comment"] = vim.tbl_extend("force", { fg = c.polar_night.light }, options.styles.comments), -- line and block comments + ["@error"] = utils.make_error(c.aurora.red), -- syntax/parser errors + -- ["@none"] -- completely disable the highlight + ["@preproc"] = { fg = c.frost.artic_water }, -- various preprocessor directives & shebangs + ["@define"] = { fg = c.frost.artic_water }, -- preprocessor definition directives + ["@operator"] = { fg = c.frost.artic_water }, -- symbolic operators (e.g. `+` / `*`) + + -- Punctuation + ["@punctuation.delimiter"] = { fg = c.snow_storm.brightest }, -- delimiters (e.g. `;` / `.` / `,`) + ["@punctuation.bracket"] = { fg = c.frost.ice }, -- brackets (e.g. `()` / `{}` / `[]`) + ["@punctuation.special"] = { fg = c.frost.artic_water }, -- special symbols (e.g. `{}` in string interpolation) + + -- Literals + ["@string"] = { fg = c.aurora.green }, -- string literals + ["@string.regex"] = { fg = c.aurora.yellow }, -- regular expressions + ["@string.escape"] = { fg = c.aurora.yellow }, -- escape sequences + ["@string.special"] = { fg = c.aurora.yellow }, -- other special strings (e.g. dates) + ["@character"] = { fg = c.aurora.green }, -- character literals + ["@character.special"] = { fg = c.aurora.yellow }, -- special characters (e.g. wildcards) + ["@boolean"] = { fg = c.frost.artic_water }, -- boolean literals + ["@number"] = { fg = c.aurora.purple }, -- numeric literals + ["@float"] = { fg = c.aurora.purple }, -- floating-point number literals + + -- Functions + ["@function"] = vim.tbl_extend("force", { fg = c.frost.ice }, options.styles.functions), -- function definitions + ["@function.builtin"] = { fg = c.frost.ice }, -- built-in functions + ["@function.call"] = { fg = c.frost.ice }, -- function calls + ["@function.macro"] = { fg = c.frost.artic_water }, -- preprocessor macros + ["@method"] = { fg = c.frost.ice }, -- method definitions + ["@method.call"] = { fg = c.frost.ice }, -- method calls + ["@constructor"] = { fg = c.frost.ice }, -- constructor calls and definitions + ["@parameter"] = { fg = c.frost.ice }, -- parameters of a function + + -- Keywords + ["@keyword"] = vim.tbl_extend("force", { fg = c.frost.artic_water }, options.styles.keywords), -- various keywords + ["@keyword.function"] = vim.tbl_extend("force", { fg = c.frost.artic_water }, options.styles.functions), -- keywords that define a function (e.g. `func` in Go, `def` in Python) + ["@keyword.operator"] = { fg = c.frost.artic_water }, -- operators that are English words (e.g. `and` / `or`) + ["@keyword.return"] = { fg = c.frost.artic_water }, -- keywords like `return` and `yield` + ["@conditional"] = { fg = c.frost.artic_water }, -- keywords related to conditionals (e.g. `if` / `else`) + ["@repeat"] = { fg = c.frost.artic_water }, -- keywords related to loops (e.g. `for` / `while`) + ["@debug"] = { fg = c.snow_storm.origin }, -- keywords related to debugging + ["@label"] = { fg = c.frost.artic_water }, -- GOTO and other labels (e.g. `label:` in C) + ["@include"] = { fg = c.frost.artic_water }, -- keywords for including modules (e.g. `import` / `from` in Python) + ["@exception"] = { fg = c.frost.artic_water }, -- keywords related to exceptions (e.g. `throw` / `catch`) + + -- Types + ["@type"] = { fg = c.frost.polar_water }, -- type or class definitions and annotations + ["@type.builtin"] = { fg = c.frost.artic_water }, -- built-in types + ["@type.definition"] = { fg = c.frost.polar_water }, -- type definitions (e.g. `typedef` in C) + ["@type.qualifier"] = { fg = c.frost.artic_water }, -- type qualifiers (e.g. `const`) + ["@storageclass"] = { fg = c.frost.artic_water }, -- visibility/life-time modifiers + ["@attribute"] = { fg = c.snow_storm.origin }, -- attribute annotations (e.g. Python decorators) + ["@field"] = { fg = c.snow_storm.origin }, -- object and struct fields + ["@property"] = { fg = c.snow_storm.origin }, -- similar to `@field` + + -- Identifiers + ["@variable"] = vim.tbl_extend("force", { fg = c.snow_storm.origin }, options.styles.variables), -- various variable names + ["@variable.builtin"] = { fg = c.frost.artic_water }, -- built-in variable names (e.g. `this`) + ["@constant"] = { fg = c.snow_storm.origin }, -- constant identifiers + ["@constant.builtin"] = { fg = c.frost.artic_water }, -- built-in constant values + ["@constant.macro"] = { fg = c.frost.artic_water }, -- constants defined by the preprocessor + ["@namespace"] = { fg = c.snow_storm.origin }, -- modules or namespaces + ["@symbol"] = { fg = c.snow_storm.origin }, -- symbols or atoms + + -- Text + ["@text"] = { fg = c.snow_storm.origin }, -- non-structured text + ["@text.strong"] = { bold = true }, -- bold text + ["@text.emphasis"] = { italic = true }, -- text with emphasis + ["@text.underline"] = { underline = true }, -- underlined text + ["@text.strike"] = { strikethrough = true }, -- strikethrough text + ["@text.title"] = { fg = c.frost.ice }, -- text that is part of a title + ["@text.literal"] = { fg = c.frost.polar_water }, -- literal or verbatim text + ["@text.uri"] = { fg = c.aurora.green, underline = true, sp = c.aurora.green }, -- URIs (e.g. hyperlinks) + ["@text.math"] = { fg = c.frost.polar_water }, -- math environments (e.g. `$ ... $` in LaTeX) + ["@text.environment"] = { fg = c.frost.polar_water }, -- text environments of markup languages + ["@text.environment.name"] = { fg = c.frost.artic_water }, -- text indicating the type of an environment + ["@text.reference"] = { fg = c.frost.polar_water }, -- text references, footnotes, citations, etc. + ["@text.todo"] = { fg = c.frost.artic_water }, -- todo notes + ["@text.note"] = { fg = c.frost.artic_water }, -- info notes + ["@text.warning"] = { fg = c.aurora.yellow }, -- warning notes + ["@text.danger"] = { fg = c.aurora.red }, -- danger/error notes + ["@text.diff.add"] = { link = "DiffAdd" }, -- added text (for diff files) + ["@text.diff.delete"] = { link = "DiffDelete" }, -- deleted text (for diff files) + + -- Tags + ["@tag"] = { fg = c.frost.artic_water }, -- XML tag names + ["@tag.attribute"] = { fg = c.frost.polar_water }, -- XML tag attributes + ["@tag.delimiter"] = { fg = c.frost.artic_water }, -- XML tag delimiters + + -- Conceal + ["@conceal"] = { fg = c.none, bg = c.none }, -- for captures that are only used for concealing + + -- Spell + -- ["@spell"] = {}, -- for defining regions to be spellchecked + -- ["@nospell"] = {}, -- for defining regions that should NOT be spellchecked + + -- Language specific + ["@constant.git_rebase"] = { fg = c.frost.polar_water }, + ["@field.yaml"] = { fg = c.frost.polar_water }, + } +end + +return treesitter diff --git a/lua/nord/utils.lua b/lua/nord/utils.lua new file mode 100644 index 0000000..a806abf --- /dev/null +++ b/lua/nord/utils.lua @@ -0,0 +1,54 @@ +local utils = {} +local c = require("nord.colors") + +function utils.load(highlights) + for group, hl in pairs(highlights) do + vim.api.nvim_set_hl(0, group, hl) + end +end + +function utils.make_diff(color) + local options = require("nord.config").options + + if options.diff.mode == "fg" then + return { fg = color, bg = c.polar_night.bright } + else + return { fg = c.aurora.green, bg = c.none, reverse = true } + end +end + +function utils.make_error(color) + local options = require("nord.config").options + + if options.errors.mode == "bg" then + return vim.tbl_extend("force", { bg = color }, options.styles.errors) + elseif options.errors.mode == "fg" then + return vim.tbl_extend("force", { undercurl = true, sp = color, fg = color }, options.styles.errors) + else + return vim.tbl_extend("force", { undercurl = true, sp = color }, options.styles.errors) + end +end + +function utils.darken(hex, amount, bg) + return utils.blend(hex, bg or c.polar_night.origin, amount) +end + +local function hexToRgb(c) + c = string.lower(c) + return { tonumber(c:sub(2, 3), 16), tonumber(c:sub(4, 5), 16), tonumber(c:sub(6, 7), 16) } +end + +function utils.blend(foreground, background, alpha) + alpha = type(alpha) == "string" and (tonumber(alpha, 16) / 0xff) or alpha + local bg = hexToRgb(background) + local fg = hexToRgb(foreground) + + local blendChannel = function(i) + local ret = (alpha * fg[i] + ((1 - alpha) * bg[i])) + return math.floor(math.min(math.max(0, ret), 255) + 0.5) + end + + return string.format("#%02x%02x%02x", blendChannel(1), blendChannel(2), blendChannel(3)) +end + +return utils diff --git a/stylua.toml b/stylua.toml new file mode 100644 index 0000000..0fd4cb5 --- /dev/null +++ b/stylua.toml @@ -0,0 +1,6 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +no_call_parentheses = false