Onedarkpro.nvim
🎨 Atom's iconic One Dark theme. Cacheable, fully customisable, Tree-sitter and LSP semantic token support. Comes with variants
Install / Use
/learn @olimorris/Onedarkpro.nvimREADME
:icecream: Themes
<div align="center"> <p><strong>:new: Vaporwave</strong><img src="https://github.com/user-attachments/assets/37df30fa-e79d-44d2-af58-91d15152856c" alt="vaporwave" /></p> <p><strong>Onedark</strong><img src="https://github.com/olimorris/onedarkpro.nvim/assets/9512444/d1e15b89-0cec-4d5b-88b8-4a0246665cb4" alt="onedark" /></p> <p><strong>Onelight</strong><img src="https://github.com/olimorris/onedarkpro.nvim/assets/9512444/74736b59-f104-4d7f-b385-f8002f9c90d1" alt="onelight" /></p> <p><strong>Onedark Vivid</strong><img src="https://github.com/olimorris/onedarkpro.nvim/assets/9512444/8146401c-21cf-413b-bb18-85e39faea565" alt="onedark vivid" /></p> <p><strong>Onedark Dark</strong><img src="https://github.com/olimorris/onedarkpro.nvim/assets/9512444/cf9f0494-217e-4c8f-9857-aa1e4e56f7e1" alt="onedark dark" /></p> </div> <!-- panvimdoc-ignore-end -->[!NOTE] All bolds and italics in the screenshots below are completely customisable. Additional screenshots of more languages can be found here.
:sparkles: Features
- :envelope_with_arrow: Automatic caching for faster load times
- :evergreen_tree: Full Tree-sitter support and bespoke queries
- :tickets: Support for LSP semantic tokens
- :electric_plug: Support for many popular plugins
- :flashlight: Filetype highlighting to allow for greater customisation across different languages
- :memo: Override everything - styles, colors, tokens, highlight groups and filetype groups
- :paintbrush: Create custom highlight groups and even highlight groups by filetypes
:zap: Requirements
- Neovim 0.9.2+
termguicolorsenabled for true color supporttree-sitterfor full syntax highlighting- For semantic tokens, an LSP server that supports them
:package: Installation and usage
Install with your package manager of choice:
-- Lazy
{
"olimorris/onedarkpro.nvim",
priority = 1000, -- Ensure it loads first
}
-- somewhere in your config:
vim.cmd("colorscheme onedark")
-- Packer
use "olimorris/onedarkpro.nvim"
-- somewhere in your config:
vim.cmd("colorscheme onedark")
" Vim-Plug
Plug "olimorris/onedarkpro.nvim"
" somewhere in your config:
colorscheme onedark
:rocket: Commands
The colorscheme comes with some useful commands:
:OneDarkProCacheforce generate new cache files for the themes (you won't often need this):OneDarkProCleanremoves existing cache files for the themes:OneDarkProColorsoutput all of the current themes colors to a scratch buffer:OneDarkProExtrasgenerates the extras files from the/extrasfolder using your config
:wrench: Configuration
Default configuration
<details> <summary>Click to see the default configuration</summary>[!NOTE] You only need to the call the
setupfunction if you wish to change any of the defaults.
require("onedarkpro").setup({
colors = {}, -- Override default colors or create your own
highlights = {}, -- Override default highlight groups or create your own
styles = { -- For example, to apply bold and italic, use "bold,italic"
types = "NONE", -- Style that is applied to types
methods = "NONE", -- Style that is applied to methods
numbers = "NONE", -- Style that is applied to numbers
strings = "NONE", -- Style that is applied to strings
comments = "NONE", -- Style that is applied to comments
keywords = "NONE", -- Style that is applied to keywords
constants = "NONE", -- Style that is applied to constants
functions = "NONE", -- Style that is applied to functions
operators = "NONE", -- Style that is applied to operators
variables = "NONE", -- Style that is applied to variables
parameters = "NONE", -- Style that is applied to parameters
conditionals = "NONE", -- Style that is applied to conditionals
virtual_text = "NONE", -- Style that is applied to virtual text
},
filetypes = { -- Override which filetype highlight groups are loaded
c = true,
comment = true,
go = true,
html = true,
java = true,
javascript = true,
json = true,
latex = true,
lua = true,
markdown = true,
php = true,
python = true,
ruby = true,
rust = true,
scss = true,
toml = true,
typescript = true,
typescriptreact = true,
vue = true,
xml = true,
yaml = true,
},
plugins = { -- Override which plugin highlight groups are loaded
aerial = true,
barbar = true,
blink_cmp = true,
blink_indent = true,
blink_pairs = true,
codecompanion = true,
copilot = true,
csvview = true,
dashboard = true,
flash_nvim = true,
gitgraph_nvim = true,
gitsigns = true,
hop = true,
indentline = true,
leap = true,
lsp_saga = true,
lsp_semantic_tokens = true,
marks = true,
mason = true,
mini_diff = true,
mini_icons = true,
mini_indentscope = true,
mini_test = true,
neotest = true,
neo_tree = true,
nvim_cmp = true,
nvim_bqf = true,
nvim_dap = true,
nvim_dap_ui = true,
nvim_hlslens = true,
nvim_lsp = true,
nvim_navic = true,
nvim_notify = true,
nvim_tree = true,
nvim_ts_rainbow = true,
nvim_ts_rainbow2 = true,
op_nvim = true,
packer = true,
persisted = true,
polygot = true,
rainbow_delimiters = true,
render_markdown = true,
snacks = true,
startify = true,
telescope = true,
toggleterm = true,
treesitter = true,
trouble = true,
vim_ultest = true,
which_key = true,
vim_dadbod_ui = true,
},
options = {
cursorline = false, -- Use cursorline highlighting?
transparency = false, -- Use a transparent background?
terminal_colors = true, -- Use the theme's colors for Neovim's :terminal?
lualine_transparency = false, -- Center bar transparency?
highlight_inactive_windows = false, -- When the window is out of focus, change the normal background?
}
})
</details>
Setting a theme
Currently, there are five themes in the colorscheme:
onedarkonelightonedark_vividonedark_darkvaporwave
A theme can be set with:
vim.cmd("colorscheme onedark")
Configuring colors
A theme has a palette of 13 core colors alongside many additional ones which are used for menus and git diffs for example. These colors can be found in the themes.
The default colors can be changed by specifying the name of the color and a new hex code:
require("onedarkpro").setup({
colors = {
red = "#FF0000"
}
})
Specifying new colors
New colors may be created which will then be merged into a theme's color palette:
require("onedarkpro").setup({
colors = {
my_new_red = "#f44336",
my_new_green = "require('onedarkpro.helpers').darken('green', 10, 'onedark')"
}
})
[!NOTE] See the helpers section to understand how to use the color helpers.
These can then be used for custom highlight groups if desired:
require("onedarkpro").setup({
highlights = {
Error = {
fg = "${my_new_red}",
bg = "${my_new_green}"
},
}
})
Specifying colors by theme or background
It's possible to override default colors within a theme such as the bg color. This is a common question for those who wish to have a darker background than the default. Of course it would make sense to have different bg colors for the onedark and onelight themes. This can be achieved by specifying the theme name as a table, followed by the color:
require("onedarkpro").setup({
colors = {
onedark = { bg = "#FFFF00" }, -- yellow
onelight = { bg = "#00FF00" }, -- green
}
})
Alternatively, you can specify colors by the theme's background color:
require("onedarkpro").setup({
colors = {
dark = { bg = "#FFFF00" }, -- yellow
light = { bg = "#00FF00" }, -- green
}
})
Configuring highlight groups
The editor, syntax, filetype and plugin files use a large array of highlight groups. Some examples of how you can customize or override them:
- Using specific hex colors and styles:
require("onedarkpro").setup({
highlights = {
Comment = { fg = "#FF0000", bg = "#FFFF00",
