Skip to content

🦊A soft dark Neovim theme written in lua, with support for lsp, treesitter and a variety of plugins.

License

Notifications You must be signed in to change notification settings

guibou/nightfox.nvim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🦊 Nightfox

A dark Neovim theme written in lua.

banner

Styles

Which fox will you choose?

Nightfox

nightfox-example

Nordfox

nordfox-example

Palefox

palefox-example

Randfox

Having trouble picking a fox. Let the dice decide! Set style to randfox to get a random fox every time the colorsheme is applied.

✨ Features

Supported plugins

⚡️ Requirements

  • Neovim >= 0.5.0

📦 Installation

Install the theme with a package manager:

" For Vim-Plug
Plug 'EdenEast/nightfox.nvim'
-- For Packer
use 'EdenEast/nightfox.nvim'

🚀 Usage

Enable the colorscheme:

" From vimscript
colorscheme nightfox
-- From lua
require('nightfox').load()

To enable Nightfox from Lualine:

require('lualine').setup {
  options = {
    -- ... your lualine config
    theme = "nightfox"
  }
}

To enable Nightfox from Lightline:

" Vim Script
let g:lightline = {'colorscheme': 'nightfox'}

❗️ nightfox is the only valid theme name. The other names are styles that can be set in the configuration.

Command

Nightfox also provides the following command to load a specific fox's style.

  • :NightfoxLoad <fox> load and applies the passed <fox> (Use tab completion to view options)

⚙️ Configuration

Nightfox comes with default configuration values. You can view them here:

{
  fox = "nightfox", -- Which fox style should be applied
  transparent = false, -- Disable setting the background color
  terminal_colors = true, -- Configure the colors used when opening :terminal
  styles = {
    comments = "NONE", -- Style that is applied to comments: see `highlight-args` for options
    functions = "NONE", -- Style that is applied to functions: see `highlight-args` for options
    keywords = "NONE", -- Style that is applied to keywords: see `highlight-args` for options
    strings = "NONE", -- Style that is applied to strings: see `highlight-args` for options
    variables = "NONE", -- Style that is applied to variables: see `highlight-args` for options
  },
  colors = {}, -- Override default colors
  hlgroups = {}, -- Override highlight groups
}

You can override these values to suite your preferences. An example of this would be as follows:

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 = "nordfox", -- 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 = "italic,bold" -- styles can be a comma separated list
  },
  colors = {
    red = "#FF000", -- Override the red color for MAX POWER
    bg_alt = "#000000",
  },
  hlgroup = {
    TSPunctDelimiter = { fg = "${red}" }, -- Override a highlight group with the color red
    LspCodeLens = { bg = "#000000" },
  }
})

-- Load the configuration set above and apply the colorscheme
nightfox.load()

For configuration in vimscript, wrap the above example in a lua script block.

" vimscript
lua << EOF
-- example above here
EOF

General

These are general settings and are unrelated to any group of settings.

  • fox: {string} The name of the fox you which to base the colorscheme on. See Styles.
  • transparent: {boolean} If set to true the background color will not be set.
  • terminal_colors: {boolean} If set to true nightfox will set the terminal colors for :terminal

Styles

These options set the style for their respecitve highlight groups. See :help highlight-args.

  • comments: {string} Style to the applied to comments
  • functions: {string} Style to the applied to functions
  • keywords: {string} Style to the applied to keywords
  • strings: {string} Style to the applied to strings
  • variables: {string} Style to the applied to variables

Colors

colors is a table that defines hex color overrides for the colors returned by require('nightfox.colors').load(). To see what values can be overridden, use vim.inspect to print out the returned color table.

print(vim.inspect(require('nightfox.colors').init()))

Colors with the suffix _br are brighter colors. Colors with the suffix _dm are dimmer colors.

To see what colors are defined to what highlight group you can reference the file theme.lua.

HLGroup

hlgroups is a table that defines overrides for highlight groups. The table consists of the highlight group name as the key. The value is a table that defines optional values of the highlight group. These values can be:

  • fg: The foreground color of the highlight group
  • bg: The background color of the highlight group
  • style: The style applied to the highlight group (see :help hightlight-args)
  • sp: Special colors use in GUI. (see :help hightlight-guisp)

To use a color defined by nightfox's you can use the template format: ${}. Any value that you can override in the colors section can be added in the template format. Some examples would be: ${red}, ${blue_br}, ${bg_alt}.

To see examples of highlight groups that can be overridden reference the file theme.lua.

⚙️ Advanced Configuration

Get color values from nightfox

There are different ways to get colors from nightfox. Here are some examples:

-- Get the colors defined in nightfox with the color overrides from config applied
local colors = require('nightfox.colors').load()

-- Get the color of a specific theme with the color overrides applied from the config
local colors = require('nightfox.colors').load('nordfox')

-- Get the colors defined in nightfox without the color overrides applied from the config
local colors = require('nightfox.colors').init()

-- Get the color of a specific theme without the color overrides applied from the config
local colors = require('nightfox.colors').init("nordfox")

🍬 Extra

There are extra configuration files for:

The generation method used is based off of tokyonight. They are generated by executing lua on the file lua/nightfox/extras/init.lua. The generated results are output to the extra folder.

🔥Contributing

Pull requests are welcome. For contributing to extras, they are generated with a template and run with each colorscheme style. To add a new template follow these steps:

  1. Create new lua file under ./lua/nightfox/extras/
  2. Add the name and file extension into the extras table in ./lua/nightfox/extras/init.lua
  3. To execute the template generation :luafile ./lua/nightfox/extras/init.lua
  4. Commit any files generated in ./extra

Found a new fox? Follow this checklist to capture the fox:

  1. Create a new lua file under ./lua/nightfox/colors folder with the fox's name
  2. Copy the contents of another fox into the file that was created
  3. Update the color table with new foxes hex colors
  4. Add the fox's name into the M.foxes table in ./lua/nightfox/colors/init.lua

Credits

These themes were used as references and based off this:

About

🦊A soft dark Neovim theme written in lua, with support for lsp, treesitter and a variety of plugins.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 88.9%
  • Shell 10.0%
  • Vim Script 1.1%