Awesome
<h1 align="left"> <picture> <source media="(prefers-color-scheme: light)" srcset="https://github.com/navarasu/onedark.nvim/assets/20145075/620d5f32-4788-4397-adb7-3fc3abc8bc29"> <img height="100" src="https://github.com/navarasu/onedark.nvim/assets/20145075/5dfe9607-977f-48d9-836f-88a556ec57a3"> </picture> </h1> <h4><div align="right"> <a href="#installation">Installation</a> <span> | </span> <a href="#default-configuration">Configuration</a> <span> | </span> <a href="#customization">Customization</a> <span> </span> </div></h4>Dark and Light Themes for neovim >= 0.5 based on Atom One Dark & Atom One Light theme written in lua with TreeSitter syntax highlight.
For Vim / Neovim < 0.5, prefer joshdick/onedark.vim
For latest TreeSitter syntax highlight, upgraded to Neovim 0.8.0 or later built with tree-sitter 0.20.3+
Features
- 8 theme styles (One Dark + 5 variants) and (One Light + 1 variant)
- Supporting multiple plugins with hand picked proper colors
- Customize
Colors
,Highlights
andCode style
of the theme as you like (Refer Customization) - Toggle the theme style without exiting Neovim using
toggle_style_key
(Refer Config)
Themes
<p float="left"> <img width="412" alt="Onedark - dark" src="https://user-images.githubusercontent.com/20145075/144289835-cbbbcb22-4eae-41f1-a5a3-e1800a37ae41.png"> <img width="412" alt="Onedark - darker" src="https://user-images.githubusercontent.com/20145075/144293945-ee3b7dca-b119-4709-96d3-50391c7b8aba.png"> </div></p> <p float="left"> <img width="412" alt="Onedark - cool" src="https://user-images.githubusercontent.com/20145075/144298826-5c51eb3a-5529-4fe7-bce2-56508eda93d7.png"> <img width="412" alt="Onedark - deep" src="https://user-images.githubusercontent.com/20145075/144299487-a7e886c7-2cc9-4d85-9aac-8517170432fc.png"> </div></p> <p float="left"> <img width="412" alt="Onedark - warm" src="https://user-images.githubusercontent.com/20145075/144304677-abbf6cc1-4adc-48b4-b675-6f6a5a98b426.png"> <img width="412" alt="Onedark - warmer" src="https://user-images.githubusercontent.com/20145075/144304700-1e333a12-6994-4fb2-9053-1e7f294d41a6.png"> </div></p>Installation
Install via your favourite package manager
" Using Vim-Plug
Plug 'navarasu/onedark.nvim'
-- Using Packer
use 'navarasu/onedark.nvim'
Configuration
Enable theme
-- Lua
require('onedark').load()
" Vim
colorscheme onedark
Change default style
-- Lua
require('onedark').setup {
style = 'darker'
}
require('onedark').load()
" Vim
let g:onedark_config = {
\ 'style': 'darker',
\}
colorscheme onedark
Options: dark, darker, cool, deep, warm, warmer, light
Default Configuration
-- Lua
require('onedark').setup {
-- Main options --
style = 'dark', -- Default theme style. Choose between 'dark', 'darker', 'cool', 'deep', 'warm', 'warmer' and 'light'
transparent = false, -- Show/hide background
term_colors = true, -- Change terminal color as per the selected theme style
ending_tildes = false, -- Show the end-of-buffer tildes. By default they are hidden
cmp_itemkind_reverse = false, -- reverse item kind highlights in cmp menu
-- toggle theme style ---
toggle_style_key = nil, -- keybind to toggle theme style. Leave it nil to disable it, or set it to a string, for example "<leader>ts"
toggle_style_list = {'dark', 'darker', 'cool', 'deep', 'warm', 'warmer', 'light'}, -- List of styles to toggle between
-- Change code style ---
-- Options are italic, bold, underline, none
-- You can configure multiple style with comma separated, For e.g., keywords = 'italic,bold'
code_style = {
comments = 'italic',
keywords = 'none',
functions = 'none',
strings = 'none',
variables = 'none'
},
-- Lualine options --
lualine = {
transparent = false, -- lualine center bar transparency
},
-- Custom Highlights --
colors = {}, -- Override default colors
highlights = {}, -- Override highlight groups
-- Plugins Config --
diagnostics = {
darker = true, -- darker colors for diagnostic
undercurl = true, -- use undercurl instead of underline for diagnostics
background = true, -- use background color for virtual text
},
}
Vimscript configuration
Onedark can be configured also with Vimscript, using the global dictionary g:onedark_config
.
NOTE: when setting boolean values use v:true
and v:false
instead of 0 and 1
Example:
let g:onedark_config = {
\ 'style': 'deep',
\ 'toggle_style_key': '<leader>ts',
\ 'ending_tildes': v:true,
\ 'diagnostics': {
\ 'darker': v:false,
\ 'background': v:false,
\ },
\ }
colorscheme onedark
Customization
Example custom colors and Highlights config
require('onedark').setup {
colors = {
bright_orange = "#ff8800", -- define a new color
green = '#00ffaa', -- redefine an existing color
},
highlights = {
["@keyword"] = {fg = '$green'},
["@string"] = {fg = '$bright_orange', bg = '#00ff00', fmt = 'bold'},
["@function"] = {fg = '#0000ff', sp = '$cyan', fmt = 'underline,italic'},
["@function.builtin"] = {fg = '#0059ff'}
}
}
Note that TreeSitter keywords have been changed after neovim version 0.8 and onwards. TS prefix is trimmed and lowercase words should be used separated with '.'
The old way before neovim 0.8 looks like this. For all keywords see this file from line 133 to 257
require('onedark').setup {
colors = {
bright_orange = "#ff8800", -- define a new color
green = '#00ffaa', -- redefine an existing color
},
highlights = {
TSKeyword = {fg = '$green'},
TSString = {fg = '$bright_orange', bg = '#00ff00', fmt = 'bold'},
TSFunction = {fg = '#0000ff', sp = '$cyan', fmt = 'underline,italic'},
TSFuncBuiltin = {fg = '#0059ff'}
}
}
Plugins Configuration
Enable lualine
To Enable the onedark
theme for Lualine
, specify theme as onedark
:
require('lualine').setup {
options = {
theme = 'onedark'
-- ... your lualine config
}
}
Plugins Supported
- TreeSitter
- LSPDiagnostics
- NvimTree
- Telescope
- WhichKey
- Dashboard
- Lualine
- GitGutter
- GitSigns
- VimFugitive
- DiffView
- Hop
- Mini
- Neo-tree
- Neotest
- Barbecue
- IndentBlankline
- vim-illuminate
Reference
Contributing
Pull requests are welcome 🎉👍.