Top Related Projects
Quick Overview
onedark.vim is a color scheme for Vim and Neovim inspired by the Atom One Dark theme. It provides a dark, modern look for your code editor with carefully chosen colors to enhance readability and reduce eye strain during long coding sessions.
Pros
- Closely mimics the popular Atom One Dark theme
- Supports both true color and 256-color terminals
- Includes airline and lightline themes for a cohesive look
- Offers customization options for fine-tuning colors
Cons
- May require additional configuration for optimal appearance in some terminals
- Limited to dark theme only (no light version available)
- Some users may find certain syntax highlighting choices subjective
Getting Started
To install onedark.vim using a plugin manager like vim-plug, add the following to your .vimrc
or init.vim
:
Plug 'joshdick/onedark.vim'
Then run :PlugInstall
in Vim.
To enable the color scheme, add this to your configuration file:
colorscheme onedark
For airline support, add:
let g:airline_theme='onedark'
For true color support in compatible terminals, include:
if (has("termguicolors"))
set termguicolors
endif
Customize colors by adding overrides before setting the colorscheme:
let g:onedark_color_overrides = {
\ "black": {"gui": "#2F343F", "cterm": "235", "cterm16": "0" },
\ "purple": { "gui": "#C678DD", "cterm": "170", "cterm16": "5" }
\}
Competitor Comparisons
Adaptation of one-light and one-dark colorschemes for Vim
Pros of vim-one
- Offers both light and dark themes, providing more versatility
- Includes support for a wider range of plugins and file types
- Generally considered to have better contrast and readability
Cons of vim-one
- Less frequently updated compared to onedark.vim
- May require more configuration to achieve optimal appearance
- Some users report inconsistencies in syntax highlighting across different languages
Code Comparison
vim-one:
let g:one_allow_italics = 1
colorscheme one
set background=dark
onedark.vim:
let g:onedark_terminal_italics = 1
colorscheme onedark
Both color schemes offer similar ease of use, but vim-one requires an additional line to set the background. onedark.vim automatically sets a dark background.
Summary
vim-one offers more theme options and broader plugin support, while onedark.vim provides a more focused, consistently maintained dark theme. The choice between the two largely depends on personal preference and specific needs for light/dark themes or plugin compatibility.
Retro groove color scheme for Vim
Pros of Gruvbox
- More color scheme variants (light and dark modes, plus contrast options)
- Wider language support and syntax highlighting
- Larger community and more active development
Cons of Gruvbox
- Slightly more complex setup and configuration
- May be considered less modern or trendy compared to One Dark
- Potentially overwhelming color palette for some users
Code Comparison
Gruvbox:
let g:gruvbox_contrast_dark = 'hard'
let g:gruvbox_italic = 1
colorscheme gruvbox
One Dark:
let g:onedark_terminal_italics = 1
colorscheme onedark
Both color schemes offer easy setup, but Gruvbox provides more customization options out of the box. One Dark's setup is simpler, which may be preferable for users who want a quick, hassle-free installation.
Gruvbox and One Dark are both popular Vim color schemes with their own strengths. Gruvbox offers more versatility and customization, while One Dark provides a sleek, modern look with minimal setup. The choice between them often comes down to personal preference and specific use cases.
🧛🏻♂️ Dark theme for Vim
Pros of Dracula
- More vibrant and colorful palette, which can enhance code readability
- Wider range of supported applications and platforms beyond Vim
- Active community with frequent updates and contributions
Cons of Dracula
- May be too bright or distracting for some users who prefer muted colors
- Slightly higher learning curve due to more color options and customizations
- Can be less consistent across different applications compared to OneDark
Code Comparison
OneDark:
highlight Normal guifg=#abb2bf guibg=#282c34
highlight Comment guifg=#5c6370 gui=italic
highlight Keyword guifg=#c678dd
Dracula:
highlight Normal guifg=#f8f8f2 guibg=#282a36
highlight Comment guifg=#6272a4 gui=italic
highlight Keyword guifg=#ff79c6
Both color schemes offer excellent syntax highlighting for various programming languages, but Dracula tends to use brighter and more saturated colors, while OneDark opts for a more subdued palette. The choice between the two often comes down to personal preference and the specific coding environment.
An arctic, north-bluish clean and elegant Vim theme.
Pros of Nord
- More comprehensive ecosystem with support for various applications beyond Vim
- Offers a softer, more muted color palette that may be easier on the eyes
- Actively maintained with frequent updates and improvements
Cons of Nord
- Less contrast between some syntax elements, which may affect readability
- Slightly more complex setup process compared to One Dark
- May require additional configuration for optimal appearance in certain file types
Code Comparison
One Dark:
hi Comment ctermfg=59 guifg=#5C6370 cterm=italic gui=italic
hi Constant ctermfg=173 guifg=#D19A66
hi String ctermfg=107 guifg=#98C379
Nord:
hi Comment ctermfg=14 guifg=#4C566A
hi Constant ctermfg=6 guifg=#88C0D0
hi String ctermfg=14 guifg=#A3BE8C
Both color schemes offer distinct aesthetics and functionality for Vim users. One Dark provides a vibrant, high-contrast look inspired by the Atom editor, while Nord offers a cooler, more subdued palette inspired by Arctic ice. The choice between them often comes down to personal preference and specific use cases. One Dark may be preferred for its simplicity and readability, while Nord might appeal to those seeking a more cohesive cross-application theme or a gentler color scheme for extended coding sessions.
Modern theme for modern VIMs
Pros of ayu-vim
- Offers three distinct color schemes (light, mirage, and dark) for different preferences and environments
- Provides a more vibrant and colorful palette, which may be preferred by some users
- Includes specific support for various plugins and file types
Cons of ayu-vim
- May have less widespread adoption and community support compared to onedark.vim
- Could be considered less "neutral" in its color choices, which might not suit all users or environments
Code Comparison
onedark.vim:
let g:onedark_color_overrides = {
\ "black": {"gui": "#2F343F", "cterm": "235", "cterm16": "0" },
\ "purple": { "gui": "#C678DD", "cterm": "170", "cterm16": "5" }
\}
ayu-vim:
let ayucolor="light" " for light version
let ayucolor="mirage" " for mirage version
let ayucolor="dark" " for dark version
Both themes offer customization options, but ayu-vim provides a simpler way to switch between its three color schemes. onedark.vim allows for more granular color overrides, which may appeal to users who want to fine-tune their color scheme.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
A dark Vim/Neovim color scheme for the GUI and 16/256/true-color terminals, based on FlatColor, with colors inspired by the excellent One Dark syntax theme for the Atom text editor.
Color Reference
Breaking Changes
Pull request #271, merged July 11, 2021, contained several breaking changes, especially for 16-color users.
If you are an existing onedark.vim user that is suddenly having issues after this PR was merged, see the PR description for details.
Supported Plugins
onedark.vim includes support for the following Vim and Neovim plugins:
- airblade/vim-gitgutter
- dense-analysis/ale
- easymotion/vim-easymotion
- itchyny/lightline.vim
- lewis6991/gitsigns.nvim
- mhinz/vim-signify
- neoclide/coc.nvim
- neomake/neomake
- Neovim LSP
- plasticboy/vim-markdown
- prabirshrestha/vim-lsp
- tpope/vim-fugitive
- vim-airline/vim-airline
Installation
-
Install the theme using your Vim plug-in manager of choice (or manually, by placing
colors/onedark.vim
in your~/.vim/colors/
directory andautoload/onedark.vim
in your~/.vim/autoload/
directory.)The theme also supports being installed as a Vim 8 package. Simply clone this repository into
~/.vim/pack/*/opt/
(so that the local path to this README would end up being~/.vim/pack/*/opt/onedark.vim/README.md
) and addpackadd! onedark.vim
to your~/.vimrc
. (The*
in the path can be any value; see:help packages
for more information.) -
If you use Vim in a terminal, do the following to test whether your terminal emulator supports 24-bit/"true" color, then add relevant
~/.vimrc
configuration if so:Note: GUI (non-terminal) Vim will always display 24-bit color regardless of the configuration done in this step.
Run the following snippet in your shell:
printf "\x1b[38;2;255;100;0mTRUECOLOR\x1b[0m\n"
If your terminal emulator does NOT display the word
TRUECOLOR
in red, it does not support 24-bit color. If you don't want to switch to a different terminal emulator that supports 24-bit color, proceed to step 3. (After installation, theg:onedark_termcolors
option may interest you.)If your terminal emulator displays the word
TRUECOLOR
in red, it supports 24-bit color, and you should add the following lines to your~/.vimrc
to enable 24-bit color terminal support inside Vim.(If you use tmux, be sure to view the tmux-related notes in the first few lines.)
"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux. "If you're using tmux version 2.2 or later, you can remove the outermost $TMUX check and use tmux's 24-bit color support "(see < http://sunaku.github.io/tmux-24bit-color.html#usage > for more information.) if (empty($TMUX)) if (has("nvim")) "For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 > let $NVIM_TUI_ENABLE_TRUE_COLOR=1 endif "For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 > "Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd > " < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 > if (has("termguicolors")) set termguicolors endif endif
-
Add the following to your
~/.vimrc
(below any lines you may have added in steps 1 and 2):syntax on colorscheme onedark
-
Installing the sheerun/vim-polyglot plug-in is recommended for improved syntax highlighting for various languages, but is not required.
Options
Note: All options should be set before the colorscheme onedark
line in your ~/.vimrc
.
-
g:onedark_hide_endofbuffer
: Set to1
if you want to hide end-of-buffer filler lines (~) for a cleaner look;0
otherwise (the default). -
g:onedark_termcolors
(see Troubleshooting (below) for more information about this option): Set to256
for 256-color terminals (the default), or set to16
to use your terminal emulator's native 16 colors. -
g:onedark_terminal_italics
: Set to1
if your terminal emulator supports italics;0
otherwise (the default).
lightline.vim Colorscheme
This repository includes a companion lightline.vim colorscheme for use with onedark.vim.
The lightline.vim colorscheme:
- Depends on
autoload/onedark.vim
for its colors, and must therefore be used in conjunction with it. - Works with both color modes available in onedark.vim (16 or 256 colors), as specified in the configuration for onedark.vim.
Installation
(These instructions assume that lightline.vim and onedark.vim are already installed and configured to your liking.)
Place onedark.vim/autoload/lightline/colorscheme/onedark.vim
in your ~/.vim/autoload/lightline/colorscheme/
directory either manually or by using your Vim plug-in manager of choice, then add the following lines to your ~/.vimrc
(or merge them into your existing lightline.vim configuration):
let g:lightline = {
\ 'colorscheme': 'onedark',
\ }
vim-airline Theme
This repository includes a companion vim-airline theme for use with onedark.vim.
The vim-airline theme:
- Depends on
autoload/onedark.vim
for its colors, and must therefore be used in conjunction with it. - Works with both color modes available in onedark.vim (16 or 256 colors), as specified in the configuration for onedark.vim.
- Is based on vim-airline's "tomorrow" theme.
Installation
(These instructions assume that vim-airline and onedark.vim are already installed and configured to your liking.)
Place onedark.vim/autoload/airline/themes/onedark.vim
in your ~/.vim/autoload/airline/themes/
directory either manually or by using your Vim plug-in manager of choice, then add the following line to your ~/.vimrc
:
let g:airline_theme='onedark'
Troubleshooting
Why do the colors in terminal Vim look totally crazy?
If Vim looks similar to the screenshot above, you have enabled Vim's 24-bit color terminal support, but your terminal doesn't support 24 bit color. Remove the relevant ~/.vimrc
configuration for enabling 24-bit color support to get things looking better.
Why do the colors in terminal Vim look slightly off/not like the preview image at the top of this README?
If your terminal doesn't support 24-bit color as described in the Installation section of this README, or 24-bit color support is not always available everywhere you use your Vim configuration, colors will not look like they do in the preview image.
However, you can use the g:onedark_termcolors
option to control onedark.vim's fallback colors in situations where 24-bit color terminal support is not available.
g:onedark_termcolors
can be set to one of two values, 256
for 256-color mode (the default), or 16
for 16-color mode (which uses your terminal emulator's native 16 colors.)
When Vim/Neovim are configured to use 24-bit color, the g:onedark_termcolors
option is ignored. However, g:onedark_termcolors
can still coexist with 24-bit color configuration. For instance, when tmux 2.1 or earlier and/or older Vim/Neovim versions that don't support 24-bit color are used, the g:onedark_termcolors
option will take effect.
-
256-color mode is enabled by default with no additional configuration, but colors are less accurate since they are approximated using a 256-color palette. The background color will appear darker than in the preview image, and most other colors will appear brighter than in the preview image. If you don't want to change your terminal's color palette as described in the 16-color mode section below, and your terminal doesn't support 24-bit color, 256-color mode is your only option.
Although 256-color mode is enabled by default (when not using 24-bit color as described above), you can explicitly enable it by adding the following line to your
~/.vimrc
:let g:onedark_termcolors=256
-
16-color mode is the preferred option, since its colors are more accurate than those of 256-color mode. However, you'll need to set your terminal emulator's color palette to this color scheme's custom 16-color palette, since 16-color mode will cause the color scheme to use your terminal emulator's native 16 colors. If you don't use the custom 16-color palette in your terminal emulator when 16-color mode is enabled, onedark.vim's colors will not display correctly in Vim.
The canonical version of the 16-color palette is an Xresources file located in this repository at
term/One Dark.Xresources
. Color schemes for various terminal emulators are also provided interm/
. (The iTerm2 color scheme works with iTerm2 versions 2.9.x and later.) You should be able to easily convert the Xresources color scheme for use with your terminal emulator of choice either by hand, or automatically by using termcolors.Assuming your terminal emulator is configured to use the custom 16-color palette as described above, add the following line to your
~/.vimrc
to enable 16-color mode:let g:onedark_termcolors=16
Why do all comments look like they're highlighted?
If all comments look like the one in the screenshot above, you have enabled italics in onedark.vim by setting g:onedark_terminal_italics=1
in your ~/.vimrc
, but your terminal isn't displaying italics correctly. You can either remove the option or try to fix your terminal. If you're using iTerm2 on macOS, you might need to use a special TERMINFO to get italics working.
Why do colors look washed out when using iTerm2?
Make sure that in Preferences, Profiles -> [Active Profile] -> Colors -> Minimum Contrast is turned all the way down. See #145 for more information.
Miscellaneous
Customizing onedark.vim's look without forking the repository
onedark.vim exposes onedark#extend_highlight
and onedark#set_highlight
functions that you can call from within your ~/.vimrc
in order to customize the look of onedark.vim.
onedark#extend_highlight
onedark#extend_highlight
allows you to customize individual aspects of onedark.vim's existing highlight groups, overriding only the keys you provide. (To completely redefine/override an existing highlight group, see onedark#set_highlight
below.)
onedark#extend_highlight
's first argument should be the name of a highlight group, and its second argument should be partial style data.
Place the following lines before the colorscheme onedark
line in your ~/.vimrc
, then change the example overrides to suit your needs:
if (has("autocmd"))
augroup colorextend
autocmd!
" Make `Function`s bold in GUI mode
autocmd ColorScheme * call onedark#extend_highlight("Function", { "gui": "bold" })
" Override the `Statement` foreground color in 256-color mode
autocmd ColorScheme * call onedark#extend_highlight("Statement", { "fg": { "cterm": 128 } })
" Override the `Identifier` background color in GUI mode
autocmd ColorScheme * call onedark#extend_highlight("Identifier", { "bg": { "gui": "#333333" } })
augroup END
endif
onedark#set_highlight
onedark#set_highlight
allows you to completely redefine/override highlight groups of your choosing.
onedark#set_highlight
's first argument should be the name of a highlight group, and its second argument should be complete style data.
For example, to remove the background color only when running in terminals (outside GUI mode and for use in transparent terminals,) place the following lines before the colorscheme onedark
line in your ~/.vimrc
:
" onedark.vim override: Don't set a background color when running in a terminal;
" just use the terminal's background color
" `gui` is the hex color code used in GUI mode/nvim true-color mode
" `cterm` is the color code used in 256-color mode
" `cterm16` is the color code used in 16-color mode
if (has("autocmd") && !has("gui_running"))
augroup colorset
autocmd!
let s:white = { "gui": "#ABB2BF", "cterm": "145", "cterm16" : "7" }
autocmd ColorScheme * call onedark#set_highlight("Normal", { "fg": s:white }) " `bg` will not be styled since there is no `bg` setting
augroup END
endif
Global color overrides
You can override colors across all highlights by adding color definitions to the g:onedark_color_overrides
dictionary in your ~/.vimrc
like so:
let g:onedark_color_overrides = {
\ "background": {"gui": "#2F343F", "cterm": "235", "cterm16": "0" },
\ "purple": { "gui": "#C678DF", "cterm": "170", "cterm16": "5" }
\}
This also needs to be done before colorscheme onedark
.
More examples of highlight group names and style data can be found in onedark.vim's source code (colors/onedark.vim
inside this repository).
tmux theme
If you'd like a tmux theme that complements onedark.vim, @odedlaz has you covered.
Contributing
If you'd like to contribute to onedark.vim, check out the contribution guidelines.
Relatives of onedark.vim
Several other themes and projects have reused code and/or colors from this project, or were otherwise inspired by it.
If onedark.vim isn't meeting your needs, try one of its relatives!
- drewtempelmeyer/palenight.vim
- KeitaNakamura/neodark.vim
- base16-onedark.vim
- Associated base16 scheme: tilal6991/base16-onedark-scheme
- rakr/vim-one
- For Neovim >= 0.5 with treesitter support: navarasu/onedark.nvim or monsonjeremy/onedark.nvim
- Neovim-only Lua port: ii14/onedark.nvim
Preview images
Preview images were taken using:
- iTerm2 terminal emulator on macOS
- 13 pt. PragmataPro Mono font
- vim-polyglot plug-in
Top Related Projects
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot