/vim-moonfly-colors

A dark color scheme for Vim

Primary LanguageVim ScriptMIT LicenseMIT

moonfly

moonfly is a dark colorscheme for Vim & Neovim inspired by:

👉 I maintain another dark Vim theme named nightfly which may be of interest.

Screenshots

Ruby

ruby

JavaScript

javascript

The font in use is Iosevka.

Styled Features & Plugins

Installation

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

vim-plug:

Plug 'bluz71/vim-moonfly-colors'

packer.nvim:

use 'bluz71/vim-moonfly-colors'

Usage

Enable the colorscheme after the plugin declaration.

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

Statusline

  • The moonfly colorscheme supports lightline. To enable the moonfly lightline colorscheme please add the following to your initialization file:
let g:lightline = { 'colorscheme': 'moonfly' }
  • The moonfly colorscheme supports vim-airline. For modern versions of vim-airline the moonfly theme will automatically be loaded.

  • The moonfly colorscheme supports lualine. To enable the moonfly theme please add the following to your initialization file:

require('lualine').setup({options = {theme = 'moonfly'}})
  • Lastly, my own vim-moonfly-statusline is available for those that just want a very simple yet informative moonfly themed status line.

🔧 Options

The moonflyCursorColor 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:moonflyCursorColor = 1
-- Lua initialization file
vim.g.moonflyCursorColor = 1

The moonflyItalics 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:moonflyItalics = 0
-- Lua initialization file
vim.g.moonflyItalics = 0

The moonflyNormalFloat option specifies whether to use moonfly 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 moonfly colors instead then add the following to your configuration:

" Vimscript initialization file
let g:moonflyNormalFloat = 1
-- Lua initialization file
vim.g.moonflyNormalFloat = 1

💡 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'
    }
  )
  local opts = {noremap = true, silent = true}
  vim.api.nvim_buf_set_keymap(0, 'n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next({severity_limit = "Warning", popup_opts = {border = "single"}})<CR>', opts)
  vim.api.nvim_buf_set_keymap(0, 'n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev({severity_limit = "Warning", popup_opts = {border = "single"}})<CR>', opts)

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

" Vimscript initialization file
let g:moonflyTerminalColors = 0
-- Lua initialization file
vim.g.moonflyTerminalColors = 0

The moonflyTransparent 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:moonflyTransparent = 1
-- Lua initialization file
vim.g.moonflyTransparent = 1

The moonflyUndercurls 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:moonflyUndercurls = 0
-- Lua initialization file
vim.g.moonflyUndercurls = 0

The moonflyUnderlineMatchParen 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:moonflyUnderlineMatchParen = 1
-- Lua initialization file
vim.g.moonflyUnderlineMatchParen = 1

The moonflyVertSplits option specifies whether to show vertical split columns. By default vertical split columns will be visible. If you would like vertical split columns to not be visible then add the following to your configuration:

" Vimscript initialization file
let g:moonflyVertSplits = 0
-- Lua initialization file
vim.g.moonflyVertSplits = 0

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.

A list of popular terminals that support true colors:

On terminals that support true colors, and when termguicolors is set, the moonfly colorscheme will not require any terminal configuration to emit the correct theme colors.

For the true color moonfly 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"

Terminal Themes

A collection of moonfly-flavoured terminal themes are provided for those using moonfly with termguicolors (cterm users should refer to the next section and not use these terminal themes):

  • iTerm2 users on macOS can import this colorscheme.

  • Alacritty users can copy this theme into their alacritty.yml configuration.

  • kitty users can use this theme.

  • Gnome Terminal users can run this script to create a Moonfly profile. Before executing the script, please install the dconf-cli command line utility for modern versions of Gnome (3.28 and later), for example sudo apt install dconf-cli. After executing the script, please set the cursor and selection colors by hand, with the appropriate color values listed above, in Preferences / Moonfly / Colors.

For other terminals please configure appropriately with the following colors:

Type Category Value Color
Background Background #080808 background
Foreground Foreground #b2b2b2 background
Bold Bold #eeeeee background
Cursor Cursor #9e9e9e background
Cursor Text Cursor Text #080808 background
Selection Selection #b2ceee background
Selection Text Selection Text #080808 background
Color 1 Black (normal) #323437 background
Color 2 Red (normal) #ff5454 background
Color 3 Green (normal) #8cc85f background
Color 4 Yellow (normal) #e3c78a background
Color 5 Blue (normal) #80a0ff background
Color 6 Purple (normal) #d183e8 background
Color 7 Cyan (normal) #79dac8 background
Color 8 White (normal) #c6c6c6 background
Color 9 Black (bright) #949494 background
Color 10 Red (bright) #ff5189 background
Color 11 Green (bright) #36c692 background
Color 12 Yellow (bright) #bfbf97 background
Color 13 Blue (bright) #74b2ff background
Color 14 Purple (bright) #ae81ff background
Color 15 Cyan (bright) #85dc85 background
Color 16 White (bright) #e4e4e4 background

📺 Legacy 256 Color Terminals

The moonfly colorscheme, when used absent termguicolors, requires the host terminal be configured with a specific color palette. In that case the legacy moonfly cterm 256 color terminal theme will be used.

‼️ Nowadays it is strongly recommended to use a true color terminal with a modern version of Vim or Neovim with termguicolors set.

If that is not possible, then the terminal emulator must be configured for 256 colors, which usually means setting the terminal's type to xterm-256color, or screen-256color when used inside tmux.

The terminal should then be configured with the following moonfly colors:

Background:               #080808
Foreground:               #b2b2b2
Bold:                     #eeeeee
Cursor:                   #9e9e9e
Cursor Text:              #080808
Selection:                #b2ceee
Selection Text:           #080808
Color 1 (Black):          #323437
Color 2 (Red):            #ff5454
Color 3 (Green):          #8cc85f
Color 4 (Yellow):         #e3c78a
Color 5 (Blue):           #80a0ff
Color 6 (Purple):         #d183e8
Color 7 (Cyan):           #79dac8
Color 8 (White):          #de935f
Color 9 (Bright Black):   #f09479
Color 10 (Bright Red):    #ff5189
Color 11 (Bright Green):  #36c692
Color 12 (Bright Yellow): #bfbf97
Color 13 (Bright Blue):   #74b2ff
Color 14 (Bright Purple): #ae81ff
Color 15 (Bright Cyan):   #85dc85
Color 16 (Bright White):  #e2637f

License

License: MIT