Home

Awesome

nightfly

nightfly is a dark midnight theme for modern Neovim and classic Vim.

Note, all nightfly highlights in Neovim are implemented in Lua, whilst highlights in Vim are implemented in legacy Vimscript.

:point_right: I maintain another dark theme named moonfly which may be of interest.

Screenshot

screenshot

Styled Features & Plugins

Neovim-only:

Neovim & Vim compatible:

Vim-only:

:zap: Requirements

nightfly is a GUI-only colorscheme.

A GUI client or a modern terminal version of Vim or Neovim in a true-color terminal is required. Details about true-color terminals are listed here.

nightfly explicitly does not support the 256 color cterm version of Vim.

Installation

Install the bluz71/vim-nightfly-colors colorscheme with your preferred plugin manager.

lazy.nvim:

{ "bluz71/vim-nightfly-colors", name = "nightfly", lazy = false, priority = 1000 },

vim-plug:

Plug 'bluz71/vim-nightfly-colors', { 'as': 'nightfly' }

Usage

Enable the colorscheme after the plugin declaration.

" Vimscript initialization file
colorscheme nightfly
-- Lua initialization file
vim.cmd [[colorscheme nightfly]]

Statusline

let g:lightline = { 'colorscheme': 'nightfly' }

:wrench: Options

OptionDefault State
nightflyCursorColorDisabled
nightflyItalicsEnabled
nightflyNormalFloatDisabled
nightflyTerminalColorsEnabled
nightflyTransparentDisabled
nightflyUndercurlsEnabled
nightflyUnderlineMatchParenDisabled
nightflyVirtualTextColorDisabled
nightflyWinSeparator1

nightflyCursorColor

The nightflyCursorColor option specifies whether to color the cursor or not. By default the cursor will NOT be colored. If you prefer a colored cursor then add the following to your initialization file:

" Vimscript initialization file
let g:nightflyCursorColor = v:true
-- Lua initialization file
vim.g.nightflyCursorColor = true

nightflyItalics

The nightflyItalics option specifies whether to use italics for comments and certain HTML elements in GUI versions of Vim. By default this option is enabled. If you do not like the appearance of italics then add the following to your initialization file:

" Vimscript initialization file
let g:nightflyItalics = v:false
-- Lua initialization file
vim.g.nightflyItalics = false

nightflyNormalFloat

The nightflyNormalFloat option specifies whether to use nightfly background and foreground colors in Neovim floating windows. By default this option is disabled, hence, Neovim floating windows will usually be styled with popup menu colors. If you would like to use nightfly colors instead then add the following to your configuration:

" Vimscript initialization file
let g:nightflyNormalFloat = v:true
-- Lua initialization file
vim.g.nightflyNormalFloat = true

:bulb: If the above option is set then it is highly recommended to enable floating window borders to distinguish between the edit and floating windows in Neovim's LSP client, for example:

  vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
    vim.lsp.handlers.hover, {
      border = "single"
    }
  )
  vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
    vim.lsp.handlers.signatureHelp, {
      border = "single"
    }
  )
  vim.diagnostic.config({ float = { border = "single" } })

:bulb: Likewise, nvim-cmp may be configured as follows for nicer display when g:nightflyNormalFloat is enabled:

local winhighlight = {
  winhighlight = "Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel",
}
require('cmp').setup({
  window = {
    completion = cmp.config.window.bordered(winhighlight),
    documentation = cmp.config.window.bordered(winhighlight),
  }
})

nightflyTerminalColors

The nightflyTerminalColors option specifies whether to use the nightfly color palette in :terminal windows when termguicolors is set. By default this option is enabled. If you prefer not to use the nightfly color palette for the first 16 terminal colors then add the following to your initialization file:

" Vimscript initialization file
let g:nightflyTerminalColors = v:false
-- Lua initialization file
vim.g.nightflyTerminalColors = false

nightflyTransparent

The nightflyTransparent option specifies whether to use an opaque or transparent background in GUI versions of Vim. By default this option is disabled. If you would like a transparent background then add the following to your initialization file:

" Vimscript initialization file
let g:nightflyTransparent = v:true
-- Lua initialization file
vim.g.nightflyTransparent = true

nightflyUndercurls

The nightflyUndercurls option specifies whether to use undercurls for spelling and linting errors in GUI versions of Vim, including terminal Vim with termguicolors set. By default this option is enabled. If you do not like the appearance of undercurls then add the following to your initialization file:

" Vimscript initialization file
let g:nightflyUndercurls = v:false
-- Lua initialization file
vim.g.nightflyUndercurls = false

nightflyUnderlineMatchParen

The nightflyUnderlineMatchParen option specifies whether to underline matching parentheses. By default this option is disabled. If you want to underline matching parentheses then add the following to your initialization file:

" Vimscript initialization file
let g:nightflyUnderlineMatchParen = v:true
-- Lua initialization file
vim.g.nightflyUnderlineMatchParen = true

nightflyVirtualTextColor

The nightflyVirtualTextColor option specifies whether to display diagnostic virtual text in color. By default this option is disabled. If you want to display diagnostic virtual text in color then add the following to your initialization file:

" Vimscript initialization file
let g:nightflyVirtualTextColor = v:true
-- Lua initialization file
vim.g.nightflyVirtualTextColor = true

nightflyWinSeparator

The nightflyWinSeparator option specifies the style of window separators:

For example, if line separators are desired then add the following to your configuration:

" Vimscript initialization file
let g:nightflyWinSeparator = 2
-- Lua initialization file
vim.g.nightflyWinSeparator = 2

:gift: If using Neovim 0.7 (or later), the following configuration will improve the look of line separators (if option 2 has been chosen) by selecting thicker characters for the separators:

" Vimscript initialization file
set fillchars=horiz:━,horizup:┻,horizdown:┳,vert:┃,vertleft:┨,vertright:┣,verthoriz:╋
-- Lua initialization file
vim.opt.fillchars = { horiz = '━', horizup = '┻', horizdown = '┳', vert = '┃', vertleft = '┫', vertright = '┣', verthoriz = '╋', }

Overriding Highlights

If a certain highlight of this theme does not suit then it is recommended to use an autocmd to override that desired highlight.

For example, if one wishes to highlight functions in bold then simply add the following to your initialization file prior to setting the colorscheme:

" Vimscript initialization file
augroup CustomHighlight
    autocmd!
    autocmd ColorScheme nightfly highlight Function guifg=#82aaff gui=bold
augroup END
-- Lua initialization file
local custom_highlight = vim.api.nvim_create_augroup("CustomHighlight", {})
vim.api.nvim_create_autocmd("ColorScheme", {
  pattern = "nightfly",
  callback = function()
    vim.api.nvim_set_hl(0, "Function", { fg = "#82aaff", bold = true })
  end,
  group = custom_highlight,
})

Palette & Custom Colors (Neovim Only)

The palette field returns a table of internal theme colors; useful for constructing custom statuslines and the like.

require("nightfly").palette

Meanwhile the custom_colors function allows customization of individual theme colors. This needs to occur prior to invoking the colorscheme. The full list of available colors is provided by the palette field.

  require("nightfly").custom_colors({
    bg = "#161616",
    violet = "#ff74b8",
  })
  vim.cmd([[colorscheme nightfly]])

True Color Terminals

Many modern terminals support 24-bit true colors. Current versions of Vim & Neovim on such terminals support true colors when set termguicolors is enabled.

On terminals that support true colors, and when termguicolors is set, the nightfly colorscheme will emit the correct theme colors.

For the nightfly colorscheme to display correctly inside tmux the following setting will usually be required in ~/.tmux.conf:

set -ga terminal-overrides ',xterm-256color:Tc'

Vim, as against Neovim, inside tmux, will also require the following settings be added to the ~/.vimrc file:

let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"

Extra Themes

A collection of nightfly-flavoured themes are provided:

For other terminals please configure appropriately with the following colors:

TypeCategoryValueColor
BackgroundBackground#011627background
ForegroundForeground#bdc1c6background
BoldBold#eeeeeebackground
CursorCursor#9ca1aabackground
Cursor TextCursor Text#080808background
SelectionSelection#b2ceeebackground
Selection TextSelection Text#080808background
Color 1Black (normal)#1d3b53background
Color 2Red (normal)#fc514ebackground
Color 3Green (normal)#a1cd5ebackground
Color 4Yellow (normal)#e3d18abackground
Color 5Blue (normal)#82aaffbackground
Color 6Purple (normal)#c792eabackground
Color 7Cyan (normal)#7fdbcabackground
Color 8White (normal)#a1aab8background
Color 9Black (bright)#7c8f8fbackground
Color 10Red (bright)#ff5874background
Color 11Green (bright)#21c7a8background
Color 12Yellow (bright)#ecc48dbackground
Color 13Blue (bright)#82aaffbackground
Color 14Purple (bright)#ae81ffbackground
Color 15Cyan (bright)#7fdbcabackground
Color 16White (bright)#d6deebbackground

Sponsor

Ko-fi

License

License: MIT