GithubHelp home page GithubHelp logo

edeneast / nightfox.nvim Goto Github PK

View Code? Open in Web Editor NEW
2.8K 12.0 129.0 1.49 MB

๐ŸฆŠA highly customizable theme for vim and neovim with support for lsp, treesitter and a variety of plugins.

License: MIT License

Lua 85.91% Shell 8.15% Makefile 0.64% Nix 0.42% Vim Script 1.78% Nushell 3.10%
neovim lua colorscheme vim theme colorblind daltonism neovim-theme vim-theme

nightfox.nvim's Introduction

Nightfox

A highly customizable theme for vim and neovim with support for lsp, treesitter and a variety of plugins.

Nightfox

nightfox

Dayfox

dayfox

Dawnfox

dawnfox

Duskfox

duskfox

Nordfox

nordfox

Terafox

terafox

Carbonfox

carbonfox

Tabline is tabby.nvim and statusline is feline.nvim. You can find my config for tabby and feline here as well as the auto generated highlight groups here. If you would like a single consumable file that contains that can be added to your own config check out misc/feline.lua and misc/tabby.lua.

Features

  • Supports both vim and neovim
  • Highly configurable with template overriding
  • Colorblind mode (daltonization, and simulation)
  • Support for multiple plugins and status lines
    • And many others should "just work"!
  • Compile user's configuration for fast startup times
  • Export Color library utility
  • Interactive live config re-loading

Requirements

  • Neovim >= 0.8 or Vim 9 with lua = 5.1+
  • True color support
  • Undercurl terminal support (optional)

Note for MacOS: The default terminal does not support true color. Use either Iterm2 or another terminal that supports true color.

Installation

Download with your favorite package manager.

{ "EdenEast/nightfox.nvim" } -- lazy
use "EdenEast/nightfox.nvim" -- Packer
Plug 'EdenEast/nightfox.nvim' " Vim-Plug

Usage

Simply set the colorscheme with the builtin command :colorscheme

colorscheme nightfox
vim.cmd("colorscheme nightfox")

Configuration

There is no need to call setup if you don't want to change the default options and settings.

-- Default options
require('nightfox').setup({
  options = {
    -- Compiled file's destination location
    compile_path = vim.fn.stdpath("cache") .. "/nightfox",
    compile_file_suffix = "_compiled", -- Compiled file suffix
    transparent = false,     -- Disable setting background
    terminal_colors = true,  -- Set terminal colors (vim.g.terminal_color_*) used in `:terminal`
    dim_inactive = false,    -- Non focused panes set to alternative background
    module_default = true,   -- Default enable value for modules
    colorblind = {
      enable = false,        -- Enable colorblind support
      simulate_only = false, -- Only show simulated colorblind colors and not diff shifted
      severity = {
        protan = 0,          -- Severity [0,1] for protan (red)
        deutan = 0,          -- Severity [0,1] for deutan (green)
        tritan = 0,          -- Severity [0,1] for tritan (blue)
      },
    },
    styles = {               -- Style to be applied to different syntax groups
      comments = "NONE",     -- Value is any valid attr-list value `:help attr-list`
      conditionals = "NONE",
      constants = "NONE",
      functions = "NONE",
      keywords = "NONE",
      numbers = "NONE",
      operators = "NONE",
      strings = "NONE",
      types = "NONE",
      variables = "NONE",
    },
    inverse = {             -- Inverse highlight for different types
      match_paren = false,
      visual = false,
      search = false,
    },
    modules = {             -- List of various plugins and additional options
      -- ...
    },
  },
  palettes = {},
  specs = {},
  groups = {},
})

-- setup must be called before loading
vim.cmd("colorscheme nightfox")

If you would like to change any of the default options above you only have to define the options that change. If an option is not present in your options table the default option will be used. For example if changing the styles of certain syntax is the only desired change then your options table would look like:

require('nightfox').setup({
  options = {
    styles = {
      comments = "italic",
      keywords = "bold",
      types = "italic,bold",
    }
  }
})

To see a detailed explanation of nightfox's config settings consult either the builtin help :help nightfox or Usage.

Modules

Nightfox's modules store configuration information for various plugins and other neovim modules. To enable a module either set the module to true or if the module has additional configuration information set enable to true.

By default modules will be enabled. To change this behaviour change options.module_default to false.

To see a list of modules check, see Usage or :help for more information.

Customize palettes and groups

You can change the color palette and the highlight group of nightfox. Here is a brief example:

-- Palettes are the base color defines of a colorscheme.
-- You can override these palettes for each colorscheme defined by nightfox.
local palettes = {
  -- Everything defined under `all` will be applied to each style.
  all = {
    -- Each palette defines these colors:
    --   black, red, green, yellow, blue, magenta, cyan, white, orange, pink
    --
    -- These colors have 3 shades: base, bright, and dim
    --
    -- Defining just a color defines it's base color
    red = "#ff0000",
  },
  nightfox = {
    -- A specific style's value will be used over the `all`'s value
    red = "#c94f6d",
  },
  dayfox = {
    -- Defining multiple shades is done by passing a table
    blue = { base = "#4d688e", bright = "#4e75aa", dim = "#485e7d" },
  },
  nordfox = {
    -- A palette also defines the following:
    --   bg0, bg1, bg2, bg3, bg4, fg0, fg1, fg2, fg3, sel0, sel1, comment
    --
    -- These are the different foreground and background shades used by the theme.
    -- The base bg and fg is 1, 0 is normally the dark alternative. The others are
    -- incrementally lighter versions.
    bg1 = "#2e3440",

    -- sel is different types of selection colors.
    sel0 = "#3e4a5b", -- Popup bg, visual selection bg
    sel1 = "#4f6074", -- Popup sel bg, search bg

    -- comment is the definition of the comment color.
    comment = "#60728a",
  },
}

-- Spec's (specifications) are a mapping of palettes to logical groups that will be
-- used by the groups. Some examples of the groups that specs map would be:
--   - syntax groups (functions, types, keywords, ...)
--   - diagnostic groups (error, warning, info, hints)
--   - git groups (add, removed, changed)
--
-- You can override these just like palettes
local specs = {
  -- As with palettes, the values defined under `all` will be applied to every style.
  all = {
    syntax = {
      -- Specs allow you to define a value using either a color or template. If the string does
      -- start with `#` the string will be used as the path of the palette table. Defining just
      -- a color uses the base version of that color.
      keyword = "magenta",

      -- Adding either `.bright` or `.dim` will change the value
      conditional = "magenta.bright",
      number = "orange.dim",
    },
    git = {
      -- A color define can also be used
      changed = "#f4a261",
    },
  },
  nightfox = {
    syntax = {
      -- As with palettes, a specific style's value will be used over the `all`'s value.
      operator = "orange",
    },
  },
}

-- Groups are the highlight group definitions. The keys of this table are the name of the highlight
-- groups that will be overridden. The value is a table with the following values:
--   - fg, bg, style, sp, link,
--
-- Just like `spec` groups support templates. This time the template is based on a spec object.
local groups = {
  -- As with specs and palettes, the values defined under `all` will be applied to every style.
  all = {
    -- If `link` is defined it will be applied over any other values defined
    Whitespace = { link = "Comment" },

    -- Specs are used for the template. Specs have their palette's as a field that can be accessed
    IncSearch = { bg = "palette.cyan" },
  },
  nightfox = {
    -- As with specs and palettes, a specific style's value will be used over the `all`'s value.
    PmenuSel = { bg = "#73daca", fg = "bg0" },
  },
}

require("nightfox").setup({ palettes = palettes, specs = specs, groups = groups })

-- setup must be called before loading
vim.cmd("colorscheme nightfox")

To find the list of syntax highlight groups defined for vim use the help :help group-name and :help nvim-treesitter-highlights for treesitter. If you would also like to see how nightfox defines these highlight groups you can see syntax.lua for vim's syntax and treesitter.lua for treesitter. These files list out all all highlight groups and have a comment describing them. Another file to note is editor.lua which is the highlight groups responsible for how vim looks (background, cursorline, tabline, etc...). To get the highlight group under your cursor see here for more information

To get more information check out Usage or the help file :help nightfox for more detailed information.

Custom template values

Nightfox's palettes and specs can be extended with your own values. This is useful for users that want to distinguish a spec value being used for multiple group definitions. This is best understood with an example:

bg0 is used as the dark alternative background color. This is used in multiple areas (non-current file, status line, normal float, etc...). If you would like to have the inactive color diffferent then the float / statusline color you can define your own value in the specs table.

require("nightfox").setup({
  palettes = {
    -- Custom duskfox with black background
    duskfox = {
      bg1 = "#000000", -- Black background
      bg0 = "#1d1d2b", -- Alt backgrounds (floats, statusline, ...)
      bg3 = "#121820", -- 55% darkened from stock
      sel0 = "#131b24", -- 55% darkened from stock
    },
  },
  specs = {
    all = {
      inactive = "bg0", -- Default value for other styles
    },
    duskfox = {
      inactive = "#090909", -- Slightly lighter then black background
    },
  },
  groups = {
    all = {
      NormalNC = { fg = "fg1", bg = "inactive" }, -- Non-current windows
    },
  },
})

Api

Nightfox exposes some Api's and utility classes that let you fetch data from nightfox.

Palettes

You can get the palettes used by each colorscheme:

-- Returns a table with each colorscheme and the palette associated with it
local palettes = require('nightfox.palette').load()

-- Returns the palette of the specified colorscheme
local palette = require('nightfox.palette').load("nightfox")

print(vim.inspect(palette.red))
-- {
--   base = "#c94f6d",
--   bright = "#d16983",
--   dim = "#ab435d",
-- }

See Usage for more information on palettes.

Specs

You can get the spec used by each colorscheme:

-- Returns a table with each colorscheme and the spec associated with it
local specs require('nightfox.spec').load()

-- Returns the spec of the specified colorscheme
local spec = require('nightfox.spec').load("nightfox")

print(vim.inspect(spec.git))
-- {
--   add = "#81b29a",
--   changed = "#dbc074",
--   removed = "#c94f6d"
-- }

See Usage for more information on specs.

Color lib

Nightfox uses a color library internally to manipulate colors. You can use this library as well.

local palette = require('nightfox.palette').load('nightfox')
local Color = require("nightfox.lib.color")

local bg = Color.from_hex(palette.bg1)
local red = Color.from_hex("#ff0000")

-- Blend the bg with red. The blend factor is from 0 to 1
-- with 0 being full bg and 1 being full red
local red_bg = bg:blend(red, 0.2)

print(red_bg:to_css())
-- "#471c26"

-- Brighten bg by adding 10 to the value of the color as a hsv
local alt_bg = bg:brighten(10)
print(vim.inspect(alt_bg:to_hsv()))
-- {
--   hue = 213.91304347826,
--   saturation = 47.916666666667,
--   value = 28.823529411765
-- }

There are a lot of useful functions to manipulate and work with colors in different color spaces. See Usage for more information on Color.

Colorblind

For individuals with color vision deficiency (cvd), nightfox has implemented a colorblind mode to help enhance color contrast. This can be enabled with this option colorblind.enable.

Understanding cvd

There are three types of cvd:

  • Protan (Red / L cones)
  • Deutan (Green / M cones)
  • Tritan (Blue / S cones)

These are referred to as protanomaly, deuteranomaly, and tritanomaly for individuals that have all three cones (trichromats) but one is weak (anomalous trichromacy).

These can also be referred to as protanopia, deuteranopia, and tritanopia. This is for individuals that only have two cones (dichromats or dichromacy).

Cone Type Weak (trichromacy) Missing (Dichromacy)
L / Red Protan Protanomaly Protanopia
M / Green Deutan Deuteranomaly Deuteranopia
S / Blue Tritan Tritanomaly Tritanopia

Configuring cvd

Nightfox needs to simulate your cvd in order to shift colors correctly. This is done by setting your cvd type's severity level. Severity is a value between 0 and 1 where 1 is full dichromacy. You can also have multiple kinds of cvd configured at a time. Here is a full example:

require("nightfox").setup({
  options = {
    colorblind = {
      enable = true,
      severity = {
        protan = 0.3,
        deutan = 0.6,
      },
    },
  },
})

If you are looking for a way to self evaluate what severity factor to use, check out daltonlens's self evaluation article with interactive self evaluation Ishihasa plates.

Another method would be to use the option colorblind.simulate_only option along with nightfox's interactive mode. While nightfox is simulating cvd set a severity to 1. Now decrease the severity incrementally until you cannot perceive a difference in the change of colors.

How does this work?

This is accomplished by applying an algorithm called Daltonization. The process follows these steps:

  1. Simulate what a person with cvd would see
  2. Calculate the difference between original vs. simulated
  3. Shift the difference towards the visible spectrum of the cvd individual
  4. Correct original color by adding it to the corrected difference

You can see the simulated colors instead of the corrected colors by setting the option colorblind.simulate_only.

cvd-example

Compile

Nightfox is a highly customizable and configurable colorscheme. This does however come at the cost of complexity and execution time.

Nightfox pre-computes the result of your configuration and saves the lua bytecode in a cache to be used on next load. This significantly speeds up nightfox's execution time. Changes to your configuration will be re-computed and cached automatically.

By default nightfox writes the compiled results into the system's cache directory. On unix this is $XDG_CACHE_HOME/nvim/nightfox and on windows this is %localappdata%\\Temp\\nvim\\nightfox.

Nightfox provides functions to work with the nightfox compiler.

:NightfoxCompile " Manually call nightfox compiler to create/update compiled files
require('nightfox').compile() -- lua api version

Interactive

Nightfox makes it easy to make changes to its config and see the results. For this nightfox exposes the command:

NightfoxInteractive

This command will attach an autocmd to the current buffer that executes on BufferWritePost. The autocmd will clear nightfox's internal state and re-source it's config from the newly saved file. It will then reset the colorscheme.

demo

There are a few things to note:

  • This requires executing luafile on the current file. Any syntax errors will throw errors.
  • If you are using packer and have nightfox's config in a config = function() end block, this will not work as packer would require to be re-compiled and the compiled file sourced.

Supported Plugins

Status lines

Lualine checks the value of vim.g.colors_name (set when using :colorscheme command) to determine the theme to load. Set your colorscheme before calling setup.

vim.cmd("colorscheme nightfox")
require('lualine').setup({ ... })

Lightline checks the value of vim.g.lightline.colorscheme. It does not depend on the value of the :colorscheme command, Please set it.

vim.cmd("colorscheme nightfox")
vim.g.lightline = { colorscheme = "nightfox" } -- Or the name of colorscheme you use

Syntax highlight groups

This section will help you determine what highlight group is being applied to a piece of syntax. These sections will output the highlight group for the value under the cursor.

Treesitter highlighting

If treesitter is the highlighting method for the language in question you can use the command: :Inspect.

Vim highlighting

Add this vimscript function to your configuration.

vimscript highlight function
" plugin/syntax.vim

" Output the highlight group under the cursor
"
" This function will output the entire stack of hightlight groups being applied. The stack is
" outputted in the correct order from top to bottom. Vim will walk through the stack from top to
" bottom and apply the first defined highlight group found.
function! SynStack()
  for i1 in synstack(line("."), col("."))
    let i2 = synIDtrans(i1)
    let n1 = synIDattr(i1, "name")
    let n2 = synIDattr(i2, "name")
    echo n1 "->" n2
  endfor
endfunction

" You can also create a convenience mapping
map <F2> <cmd>call SynStack()<cr>

Extra

There are extra configuration files for the following:

Acknowledgements

References

Some themes were inspired by wallpapers.

Nordfox nordfox_reference
Terafox terafox_reference

๐Ÿ’ Thanks to

nightfox.nvim's People

Contributors

4513echo avatar actions-user avatar bobbleclank avatar ckafi avatar edeneast avatar ethanholz avatar gegoune avatar github-actions[bot] avatar histrio avatar igor-semyonov avatar jamesoff avatar k-rodgers avatar mehalter avatar metalelf0 avatar micke avatar mrtnvgr avatar nullchilly avatar oxalica avatar parsifa1 avatar pusewicz avatar rafi avatar rockyzhang24 avatar roginfarrer avatar sallescosta avatar skoch13 avatar stevearc avatar swoogan avatar thesw4rm avatar thewatts avatar vihu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nightfox.nvim's Issues

Adjust brightness of some colors in bright theme version

IMO some of the colors could be darkened so they do not blend too much into background:
image
The yellow/golden color could be 10-15 % darker, the crimson color could be around 20 darker (it would require some test to get exact values) . Maybe something like this can work:
image

Still awesome to see bright versions of nightfox.

Bumping Red color

Thanks for great theme EdenEast!. I just wanted suggest bumping red color a bit to : red="#dc6959"
new
image
old:
image

Its small change but IMO default red is bit to dim, compared to neighbor area. I only tested default style.
Black and white version where its easier to see brightness differences (its easier to see that old red is blending bit much into background) :
image

Colors messed up with simple config

Using the new 2.0, with this simple config many colors end up changed from their default. When I run without a config the colors are much different. Since I'm not changing any colors it feels like a bug.

require("nightfox").setup {
  options = {
    styles = {
      comments = "italic",
    },
  },
}

vim.cmd "colorscheme nightfox"

Here is what I see on screen with the above config:
Screen Shot 2022-03-17 at 10 04 53

Here is what I see on screen when I use the config shown in the picture below:
Screen Shot 2022-03-17 at 10 27 32

LspCodeLens support

LspCodeLens is the color of virtual text added by Lsp when code lens are used.

Terminal colors?

It would be nice to have the same colors in my terminal. Is it possible you could f.ex supply something I can import into terminal.sexy so I can convert it to my terminal of choice?

nvim-cursorline plugin breaks cursorline highlighting

Description

When loading duskfox, the cursorline colour looks fine initially, but once i move the cursor, the colour changes to a light background which is difficult to read

running :colorscheme duskfox restores the proper colour, but then moving the cursor, switching buffers, entering commandline, etc, breaks it again.

Behavior

Expected behavior
Cursorline looks good in all circumstances

Screenshots
Here's how it looks immediately after :colorscheme duskfox:
Screen Shot 2022-03-18 at 12 20 09
and here's how it looks after moving the cursor

Screen Shot 2022-03-18 at 12 21 32

Configuration

this function is called in packer's config callback for nightfox:

return function()
  local nightfox = require'nightfox'

  -- This function set the configuration of nightfox. If a value is not passed in the setup function
  -- it will be taken from the default configuration above
  nightfox.setup {
    options = {
      dim_inactive = true,
      modules = {
        cmp = true,
        diagnostic = true,
        lsp_trouble = true,
        gitsigns = true,
        modes = true,
        native_lsp = true,
        neogit = true,
        nvimtree = true,
        telescope = true,
        treesitter = true,
        whichkey = true,
      },
      styles = {
        comments = "italic",
        keywords = "bold",
        functions = "italic,bold"
      },
    },
    pallets = {
      duskfox = {
        bg1 = "#000000",
        bg0 = "#010101",
        bg3 = "#121820", -- 55% darkened from stock
        sel0 = "#131b24", -- 55% darkened from stock
      },
      nightfox = {
        bg1 = "#000000",
        bg0 = "#010101",
        bg3 = "#121820", -- 55% darkened from stock
        sel0 = "#131b24", -- 55% darkened from stock
      },
    },
    groups = {
      TSPunctDelimiter = { fg = "${red}" },
      CursorLine = { bg = '${bg3}' },
      Comment = { style = "italic" },
      MatchParen = { fg = "yellow" },
      IndentBlankLineContextChar = { fg = '#88ddff' },
      GitSignsChange = { fg='#f16d0a' },
      Folded = {
        bg = '${bg1}',
      },
      LspCodeLens = {
        bg = "${bg1}",
        style = "italic"
      },
    }
  }
end

Reproduce

  1. load with minimal_init.lua
  2. enter insert mode
  3. exit insert mode
minimal_init.lua
-- `minimal_init.lua` used for reproducible configuration
-- Open with `nvim --clean -u minimal_init.lua`

local is_windows = vim.fn.has("win32") == 1
local function join(...)
  local sep = is_windows and "\\" or "/"
  return table.concat({ ... }, sep)
end

local root_tmp = is_windows and os.getenv("TEMP") or "/tmp"
local site_path = join(root_tmp, "nvim", "site")
local pack_path = join(site_path, "pack")
local install_path = join(pack_path, "packer", "start", "packer.nvim")
local compile_path = join(install_path, "plugin", "packer_compiled.lua")
vim.opt.packpath = site_path

local function load_plugins()
  local packer = require("packer")
  local use = packer.use
  packer.reset()
  packer.init({ compile_path = compile_path, package_root = pack_path })

  use("wbthomason/packer.nvim")
  use("EdenEast/nightfox.nvim")
  use'nvim-treesitter/nvim-treesitter'
  use'mvllow/modes.nvim'

  --- FIXCURSORHOLD IS THE CONFLICTING PLUGIN

  use { 'antoinemadec/FixCursorHold.nvim', setup = function() vim.g.cursorhold_updatetime = 500 end }

  --- UNINSTALLING IT SOLVES THE PROBLEM

  packer.install()
end

_G.load_config = function()
  require'modes'.setup()
  -- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
  require'nvim-treesitter.configs'.setup {
    ensure_installed = 'maintained',
    highlight = { enable = true },
    incremental_selection = { enable = true },
  }

  require("nightfox").setup({
    options = {
      dim_inactive = true,
      modules = {
        cmp = true,
        diagnostic = true,
        lsp_trouble = true,
        gitsigns = true,
        modes = true,
        native_lsp = true,
        neogit = true,
        nvimtree = true,
        telescope = true,
        treesitter = true,
        whichkey = true,
      },
      styles = {
        comments = "italic",
        keywords = "bold",
        functions = "italic,bold"
      },
    },
    pallets = {
      duskfox = {
        bg1 = "#000000",
        bg0 = "#010101",
        bg3 = "#121820", -- 55% darkened from stock
        sel0 = "#131b24", -- 55% darkened from stock
      },
      nightfox = {
        bg1 = "#000000",
        bg0 = "#010101",
        bg3 = "#121820", -- 55% darkened from stock
        sel0 = "#131b24", -- 55% darkened from stock
      },
    },
    groups = {
      TSPunctDelimiter = { fg = "${red}" },
      CursorLine = { bg = '${bg3}' },
      Comment = { style = "italic" },
      MatchParen = { fg = "yellow" },
      IndentBlankLineContextChar = { fg = '#88ddff' },
      GitSignsChange = { fg='#f16d0a' },
      Folded = {
        bg = '${bg1}',
      },
      LspCodeLens = {
        bg = "${bg1}",
        style = "italic"
      },
    }
  })

  vim.cmd([[
  set backspace=indent,eol,start
  set colorcolumn=100
  set completeopt=menu,menuone,noselect
  set cursorcolumn
  set cursorline
  set encoding=UTF-8
  set expandtab
  set laststatus=2
  set linebreak
  set list
  set mouse=a
  set nocompatible
  set number
  set pastetoggle=<F10>
  set relativenumber
  set shiftwidth=2
  set softtabstop=2
  set tabstop=2
  set termguicolors
  set virtualedit=block,onemore
  set nowrap

  colorscheme duskfox
  ]])
end

if vim.fn.isdirectory(install_path) == 0 then
  vim.fn.system({ "git", "clone", "--depth=1", "https://github.com/wbthomason/packer.nvim", install_path })
end
load_plugins()
vim.cmd([[autocmd User PackerComplete ++once echo "Ready!" | lua load_config()]])

Additional info / context

Any additional info like neovim version (nvim -v), terminal, platform, etc to help with resolution

Setting inverse.search = true, searches has no highlights

require("nightfox").setup({
	options = {
		styles = {
			comments = "italic",
			keywords = "bold",
			functions = "italic",
		},
		inverse = {
			match_paren = true,
			search = true,
		},
	},
})

vim.cmd([[colorscheme nordfox]])

Using this config searches has no highlights

`stdpath` needs vim.fn.has("nvim") check

Description

Trying to load the colorscheme in mainline Vim gives the error "E117: Unknown function: stdpath". It looks like the intent is to be cross-compatible, but the stdpath() function is Neovim-only.

Behavior

Expected behavior
Beautiful colors.

Configuration

No explicit configuration (so, default?).

Reproduce

  1. vim
  2. colo nightfox

Additional info / context

Tested on Vim 8.2 (Arch Linux "huge" build)
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Feb 24 2022 18:41:57)
Included patches: 1-4464
Compiled by Arch Linux
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl               +file_in_path      +mouse_urxvt       -tag_any_white
+arabic            +find_in_path      +mouse_xterm       +tcl/dyn
+autocmd           +float             +multi_byte        +termguicolors
+autochdir         +folding           +multi_lang        +terminal
-autoservername    -footer            -mzscheme          +terminfo
+balloon_eval      +fork()            +netbeans_intg     +termresponse
+balloon_eval_term +gettext           +num64             +textobjects
+browse            -hangul_input      +packages          +textprop
++builtin_terms    +iconv             +path_extra        +timers
+byte_offset       +insert_expand     +perl/dyn          +title
+channel           +ipv6              +persistent_undo   +toolbar
+cindent           +job               +popupwin          +user_commands
+clientserver      +jumplist          +postscript        +vartabs
+clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +vim9script
+cmdline_hist      +langmap           -python            +viminfo
+cmdline_info      +libcall           +python3/dyn       +virtualedit
+comments          +linebreak         +quickfix          +visual
+conceal           +lispindent        +reltime           +visualextra
+cryptv            +listcmds          +rightleft         +vreplace
+cscope            +localmap          +ruby/dyn          +wildignore
+cursorbind        +lua/dyn           +scrollbind        +wildmenu
+cursorshape       +menu              +signs             +windows
+dialog_con_gui    +mksession         +smartindent       +writebackup
+diff              +modify_fname      -sodium            +X11
+digraphs          +mouse             +sound             -xfontset
+dnd               +mouseshape        +spell             +xim
-ebcdic            +mouse_dec         +startuptime       -xpm
+emacs_tags        +mouse_gpm         +statusline        +xsmp_interact
+eval              -mouse_jsbterm     -sun_workshop      +xterm_clipboard
+ex_extra          +mouse_netterm     +syntax            -xterm_save
+extra_search      +mouse_sgr         +tag_binary        
-farsi             -mouse_sysmouse    -tag_old_static    
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "/etc/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-4 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/lzo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cloudproviders -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/at-spi-2.0 -pthread -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -flto -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 
Linking: gcc -L. -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.34/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -flto -L/usr/local/lib -o vim -lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lelf -lcanberra -lacl -lattr -lgpm -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.34/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -L/usr/local/lib -L/usr/lib/perl5/5.34/core_perl/CORE -lperl -lpthread -ldl -lm -lcrypt -lutil -lc -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lm 

Lualine README config

Is there somewhere where I can find this specific Lualine config?

Screenshot 2022-03-18 134908

The one shown on README.
Nightfox

Add 'background' parameter for prevent the theme settings background

According this close issue "Transparent background still activate after disabling #70" the behavior is not accurate.

There are several other themes which support this correctly. For example you can inspire here:

https://github.com/marko-cerovac/material.nvim

 require('material').setup({
    disable = {
		  background = false, -- Prevent the theme from setting the background (NeoVim then uses your terminal background)
    },
  })

If this settings is used, the theme background is taken without transparency with appropriate aim of theme creators.

`vim.cmd` in Neovim is `vim.command` in Vim

Description

Loading the colorscheme in Vim (after addressing #107) results in the error "attempt to call a nil value (field 'cmd')" from precompiled Lua file. Status of known Lua incompatibilities in Neovim are being tracked at neovim/neovim#12537, in case it helps. I don't know whether changing the vim table would have undesirable side effects, but it's possible that a well-placed

if vim.fn.has("nvim") == 0 then
  vim.cmd = vim.command
end

could be a quick fix; otherwise a separate

function vimcmd(cmd)
  if vim.fn.has("nvim") == 0 then
    vim.command(cmd)
  else
    vim.cmd(cmd)
  end
end

could be used.

Behavior

Expected behavior
Beautiful colors, of course.

Configuration

None/default.

Reproduce

  1. vim
  2. :colo nightfox

`colors_name` set only to `nightfox`

With pr #35 being merged we can now use colorscheme nordfox. When using the colorscheme command it would be expected that vim.g.colors_name would be set to nordfox. Currently this is only set to nightfox. The variable vim.g.colors_name should be set to the name of the variant that was selected.

Refactor configuration to use lua tables

I would like to change the method of which nightfox is configured. I would like to move to a fully lua based setup without the use of globals and instead just setup nightfox and then load the setup.

An example of what the configuration might look like:

local nightfox = require('nightfox')

nightfox.setup({
  fox = "nightfox",
  styles = {  -- The style of the section, not sure if this takes a string or a bool
    comments = "NONE",
    functions = "NONE",
    keywords = "NONE",
    strings = "NONE",
    variables = "NONE",
  },
  colors = {}, -- override any of the defined colors in a scheme
  group = {}, -- override any highlight group set
})

nightfox.load()

This change was brought up when adding the override example in the readme. There was a dependency on the order of the lines and felt messy.

feature request: inverse matches

In https://github.com/srcery-colors/srcery-vim there is an option to inverse the colour of matches and match parenthesis of treesitter-highlight module or a / search:
image
image

Could you please add a similar feature to nightfox? Because I think this can improve visibility of these matches, as you see its currently a bit hard to see without inverse colours.
image

Idea: Register your own palette

Is your feature request related to a problem? Please describe.
Nightfox has become modular enough and big enough that it could be described as a colorscheme framework. The only requirement to create your own theme with nightfox is define your own palette.

Describe the solution you'd like
Nightfox has an api to register a new pallet, The palette can also define a spec as well in case someone wants to change the mapping from palette to spec.

Screenshot links

This issue is used for storing screenshots for readme.

Banner
v0.1.0

nightfox

nightfox

dayfox

dayfox

dawnfox

dawnfox

duskfox

duskfox

nordfox

nordfox

modify the unused part's highlighting

I love your colortheme so much, but there is a problem that the unused part's default highlighting makes the codes difficult to read, especially after the overlap of the cursorline and the unused part.
I have read the theme.lua and tried to modify the color, but failed.
I am using Treesitter for highlighting.
2021-10-21_15-32
2021-10-21_15-38

Spelling: "palette"

Description

How you name things is of course totally your call, but I figured I'd point out (with all due respect!) that a set of colors is called a palette, in case the peculiar spelling was unintentional. ๐Ÿ˜…

CSS โ€“ negative values not coloured correctly and selector coloring request

Thanks for the great theme!

I've noticed in CSS files, negative values don't get the same color as positive ones:

image

Not sure if that is intentional?

In addition, wondered if it might be preferable to have the selectors a different color; at present, selectors, properties and all non integer/function values get the same treatment. Unsure if this is a limitation of treesitter?

BTW โ€“ featured this theme here :) https://youtu.be/_evGrg4l3CY

Default theme darker after rewrite

Hello,

Maybe this is a setting issue but after the rewrite some colors of the default theme are a lot darker than before, I especially noticed this when using telescope and checking the selection window, furthermore also some colors changed.
I am using treesitter for highlighting though so maybe this is related.

V1.0.0 Version which shows a nice border
old

Current Main, the border is barely visible.
new

My setup is as simple as using.

require("nightfox").setup({options = { transparent = true }})
vim.cmd([[ colorscheme nightfox ]])

I also see that the highlights are different, (I use treesitter as well).
V1.0.0
oldhighlights

Current
newhighlights

modes.nvim

Please consider adding support for modes.nvim highlight groups

vim.cmd('hi ModesCopy guibg=#f5c359')
vim.cmd('hi ModesDelete guibg=#c75c6a')
vim.cmd('hi ModesInsert guibg=#78ccc5')
vim.cmd('hi ModesVisual guibg=#9745be')

Request iterm2 port

Beautiful theme, good job!

I would like to have it ported to iterm2, if someone knows how to do it...

Cheers

Unable to choose default style

I tried to set the default colorschme to dayfox but will just revert to nightfox.

I tried using this config

local nightfox = require("nightfox")

-- This function set the configuration of nightfox. If a value is not passed in the setup function
-- it will be taken from the default configuration above
nightfox.setup({
	fox = "dayfox", -- change the colorscheme to use nordfox
	styles = {
		comments = "italic", -- change style of comments to be italic
		keywords = "bold", -- change style of keywords to be bold
		functions = "bold", -- styles can be a comma separated list
	},
	inverse = {
		match_paren = true, -- inverse the highlighting of match_parens
	},
})

-- Load the configuration set above and apply the colorscheme
nightfox.load()
-- vim.cmd([[colorscheme dayfox]])

getting markdownH3 and H4 to have a color? Also italic not working.

Thanks so much for your work on this plugin, it is amazing.
I am trying to get comments to be italic and different colors for markdownH3 H4 headings:

"vimscript
lua << EOF

local nightfox = require('nightfox')

nightfox.setup({
  styles = {
    comments = "italic", -- change style of comments to be italic
  },
  colors = {
    bg = "#111111",
		bg_highlight = "#333333"
  },
  hlgroups = {
    Folded = { fg = "c.blue", bg = "c.bg" }, -- line used for closed folds
    markdownH3 = { fg = "c.red", style = "bold" },
    markdownH4 = { fg = "c.green", style = "bold" },
  }
})

nightfox.load()

EOF

The other color changes are sticking but not the italics or markdown headings. Any ideas? I tried in the plugin itself and couldn't seem to get them to work there either.
thanks

Dim

Hello all.

How do I get rid of the inactive pane color?

Thanks

Highlighted text when substituting is too dark

Great theme. I'm using nordfox, but highlighting of matches when doing a substitution (:%s/FOO/BAR/) makes every instance of FOO black (or very dark grey) which makes it impossible to read on a dark background colour. I don't know if this is intentional or if it something in my config, but it makes it hard to see the matches as they could be whitespace. I would prefer the matches to be highlighted grey, like when searching.

What's the setting for this?

echo output missing on startup

Description

Remember when I said:

The only thing that appear a bit odd in that I can't explain it is that without the setup options I don't see the "Ready!" message. With my setup options I do see the "Ready!" message.

when working on #85 (comment).

Well that is hanging around and something to do with Nightfox. Something in the plugin, which I have not been able to find, is causing the output of an echo to disappear. I can see the output there for a nanosecond if I watch real close, but it disappears.

I have narrowed it down to when I invoke the vim.cmd 'colorscheme nightfox command.

If I remove that command the echo output shows up and stays around. As soon as I add that command back the echo output flashes by. It is like something is injecting a <CR> into the startup stream.

Side note: I could not figure out how vim.cmd 'colorscheme nightfox loads the compiled nightfox theme... be happy to understand the lines of code that does that or how that works.

Behavior

Expected behavior
I'd expect to not have output not be cleared.

Configuration

Relevant nightfox's configuration...

Reproduce

To reproduce I have a echo TEST! right after my colorscheme nightfox command. Output "flashes" by when using nightfox colorscheme. Output stays there when using another (non nightfox) colorscheme.

This happens (as I mentioned in link above) when using the minimal init.lua.

Additional info / context

Using neovim 0.6.1; wezterm latest.

Support colorblind accessibility

I believe accessability something that is very important. As a colorscheme, nightfox should be accessible to people with color blindness.

To this end nightfox should change its colors based on someone's type of color blindness. By setting the type of color blindness in the config settings nightfox's pallet should reflect colors / shades that are distinct.

This is a long term goal of nightfox and I am not sure the best way of implementing this. I also need to research and understand more about color blindness and how to best change colors to reflect the different types.

Transparent background still activate after disabling

I'm using nordfox. I'm using kitty with transparency, but I want to neovim without transparent background.

I configure fox this way:

local nightfox = require("nightfox")
nightfox.setup({
  transparent = false
})
nightfox.load()

But the nordfox has still transparent bg.

Document overriding highlight groups

In issue #10 it was asked how to override a highlight group. I created a code example to show how to do this. This should be documented in the Advanced Configuration section.

diff mode unreadable

Using neovim in diff mode (nvim -d file1 file2) is quite unusable. Is this something that can be changed/fixed in this color scheme?

image

Highlight and warning background colors off

Describe the solution you'd like
I might have missed this but trying to find a way to turn off the background colors on warnings and errors, or this is not a feature yet?

Colors not like the preview

Your theme looks amazing, but it doesn't show properly on my side. I tried in Kitty and Alacritty as well as inside and outside of tmux. Any idea what I might be doing wrong?

image

Here is a minimal init.vim

" auto-install vim-plug                                                                                                                                                                                                                                                                                   
if empty(glob('~/.config/nvim/autoload/plug.vim'))                                                                                                                                                                                                                                                        
  silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs                                                                                                                                                                                                                                        
    \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim                                                                                                                                                                                                                                 
  autocmd VimEnter * PlugInstall | source $MYVIMRC                                                                                                                                                                                                                                                        
endif                                                                                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                                          
call plug#begin('~/.config/nvim/autoload/plugged')       
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}                                                                                                                                                                                                                                                 
Plug 'EdenEast/nightfox.nvim'                                                                                                                                                                                                                                                                             
call plug#end()                                                                                                                                                                                                                                                                                           
                                                                                                                                                                                                                                                                                                          
" Automatically install missing plugins on startup                                                                                                                                                                                                                                                        
autocmd VimEnter *                                                                                                                                                                                                                                                                                        
  \  if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))                                                                                                                                                                                                                                           
  \|   PlugInstall --sync | q                                                                                                                                                                                                                                                                             
  \| endif                                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                          
let g:nightfox_style = "nightfox" 
colorscheme nightfox               

Here is what lua print(vim.inspect(require('nightfox.colors').setup())) is giving

{
  bg = "#192330",
  bg_alt = "#131A24",
  bg_float = "#131A24",
  bg_highlight = "#283648",
  bg_popup = "#131A24",
  bg_search = "#2F5660",
  bg_sidebar = "#131A24",
  bg_statusline = "#131A24",
  bg_visual = "#2B3B51",
  black = "#141C26",
  black_br = "#7f8c98",
  blue = "#719cd6",
  blue_br = "#84CEE4",
  border = "#141C26",
  border_highlight = "#719cd6",
  comment = "#526175",
  cyan = "#63cdcf",
  cyan_br = "#59F0FF",
  diff = {
    add = "#293840",
    change = "#263549",
    delete = "#332A39",
    text = "#719cd6"
  },
  error = "#c94f6d",
  fg = "#CDCECF",
  fg_alt = "#A4A5A6",
  fg_gutter = "#3b4261",
  fg_sidebar = "#A4A5A6",
  git = {
    add = "#70a288",
    change = "#A58155",
    conflict = "#C07A6D",
    delete = "#904A6A",
    ignore = "#393b44"
  },
  gitSigns = {
    add = "#266d6a",
    change = "#536c9e",
    delete = "#b2555b"
  },
  green = "#81B29A",
  green_br = "#58cd8b",
  hint = "#63cdcf",
  info = "#719cd6",
  magenta = "#9D79D6",
  magenta_br = "#B8A1E3",
  name = "nightfox",
  none = "NONE",
  orange = "#F4A261",
  orange_br = "#F6A878",
  pink = "#D67AD2",
  pink_br = "#DF97DB",
  red = "#c94f6d",
  red_br = "#D6616B",
  variable = "#dfdfe0",
  warning = "#dbc074",
  white = "#dfdfe0",
  white_br = "#F2F2F2",
  yellow = "#dbc074",
  yellow_br = "#FFE37E"
}

Telescope styling alternative

No need to add this, but I just wanted to share a quick setup that may help others.

You can style the prompt of telescope in your setup like this:

local nightfox = require('nightfox')
nightfox.setup({
    fox = 'nordfox',
    hlgroups = {
        TelescopeBorder = { fg = "${bg_popup}", bg = "${bg_popup}" },
        TelescopePromptBorder = { fg = "${bg_visual}", bg = "${bg_visual}" },
        TelescopePromptNormal = { fg = "${fg_sidebar}", bg = "${bg_visual}" },
        TelescopePromptPrefix = { fg = "${fg_sidebar}", bg = "${bg_visual}" },
        TelescopeNormal = { fg = "${fg_sidebar}", bg = "${bg_popup}" },
        TelescopePreviewTitle = { fg = "${bg_popup}", bg = "${green}" },
        TelescopePromptTitle = { fg = "${bg_popup}", bg = "${green}" },
        TelescopeResultsTitle = { fg = "${bg_popup}", bg = "${green}" },
        TelescopeMatching = { fg = "${error}", bg = "${NONE}" },
    }
})
nightfox.load()

Screenshot 2022-03-08 at 07 42 36

Screenshot 2022-03-08 at 07 42 04

It does not work on the fly if you change themes, but this setup works quite well with the 2 themes I use.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.