olimorris / onedarkpro.nvim Goto Github PK
View Code? Open in Web Editor NEW๐จ Atom's iconic One Dark theme. Cacheable, fully customisable, Tree-sitter and LSP semantic token support. Comes with variants
License: MIT License
๐จ Atom's iconic One Dark theme. Cacheable, fully customisable, Tree-sitter and LSP semantic token support. Comes with variants
License: MIT License
The majority of issues raised are about highlight groups not being applied or other plugins changing colors. To prevent this, I've included an example minimal.lua
file which can be run with:
nvim --clean -u minimal.lua
Note: Just place the
minimal.lua
file in any directory and run the command. No need to mess around with your existing config!
-- ignore default config and plugins
vim.opt.runtimepath:remove(vim.fn.expand("~/.config/nvim"))
vim.opt.packpath:remove(vim.fn.expand("~/.local/share/nvim/site"))
-- append test directory
local test_dir = "/tmp/onedarkpro"
vim.opt.runtimepath:append(vim.fn.expand(test_dir))
vim.opt.packpath:append(vim.fn.expand(test_dir))
-- install packer
local install_path = test_dir .. "/pack/packer/start/packer.nvim"
local install_plugins = false
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
vim.cmd("!git clone https://github.com/wbthomason/packer.nvim " .. install_path)
vim.cmd("packadd packer.nvim")
install_plugins = true
end
local packer = require("packer")
packer.init({
package_root = test_dir .. "/pack",
compile_path = test_dir .. "/plugin/packer_compiled.lua",
})
packer.startup(function(use)
-- Packer can manage itself
use("wbthomason/packer.nvim")
use({ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" })
use("olimorris/onedarkpro.nvim")
if install_plugins then
packer.sync()
end
end)
local ok, treesitter = pcall(require, "nvim-treesitter.configs")
if ok then
treesitter.setup({
ensure_installed = "all",
ignore_install = { "phpdoc" }, -- list of parser which cause issues or crashes
highlight = { enable = true },
})
end
local ok, onedarkpro = pcall(require, "onedarkpro")
if ok then
vim.cmd("colorscheme onedarkpro")
end
Does this plugin support lualine?
I have the following in my onedarkpro setup file
colors = {}, -- Override default colors. Can specify colors for "onelight" or "onedark" themes by passing in a table
hlgroups = { -- Override default highlight groups
Cursorline = { bg="Grey20" , },
MatchParen = { bg='Grey20' },
MatchBackground = { bg='Grey20', fg="Grey40" },
},
However, I am still not able to get a distinct background for the line shown by vim-matchup for start of a function
Currently working on a feature to enable custom highlight groups by filetype.
Hello.
I have this bug akinsho/toggleterm.nvim#173 with neovim plugin https://github.com/akinsho/toggleterm.nvim
The bug is only with OneDarkPro, if disabled OneDarkPro, i didn't have any bug.
Can you help me ?
Hi,
If I have a setup like:
local onedarkpro = require('onedarkpro')
local p = {
fg = '#abb2bf',
pmenu = '#333841',
}
onedarkpro.setup({
theme = 'onedark',
colors = p,
hlgroups = {
NormalFloat = { link = 'Pmenu' },
Pmenu = { fg = p.fg, bg = p.pmenu },
},
})
Then the NormalFloat "link" is not respected and defaults to whatever onedarkpro default is. In order for it to work I need to rewrite it as:
NormalFloat = { fg = p.fg, bg = p.pmenu },
Is this a bug or a feature? Thanks in advance.
The italics look pretty!
I thought I'd begin by sharing how I have Telescope
formatted:
colors = {
dark = {
telescope_prompt = "require('onedarkpro.helpers').darken('bg', 1, 'onedark')",
telescope_results = "require('onedarkpro.helpers').darken('bg', 4, 'onedark')",
telescope_preview = "require('onedarkpro.helpers').darken('bg', 6, 'onedark')",
telescope_selection = "require('onedarkpro.helpers').darken('bg', 8, 'onedark')",
},
light = {
telescope_prompt = "require('onedarkpro.helpers').darken('bg', 2, 'onelight')",
telescope_results = "require('onedarkpro.helpers').darken('bg', 5, 'onelight')",
telescope_preview = "require('onedarkpro.helpers').darken('bg', 7, 'onelight')",
telescope_selection = "require('onedarkpro.helpers').darken('bg', 9, 'onelight')",
},
},
highlights = {
TelescopeBorder = {
fg = "${telescope_results}",
bg = "${telescope_results}",
},
TelescopePromptBorder = {
fg = "${telescope_prompt}",
bg = "${telescope_prompt}",
},
TelescopePromptCounter = { fg = "${fg}" },
TelescopePromptNormal = { fg = "${fg}", bg = "${telescope_prompt}" },
TelescopePromptPrefix = {
fg = "${purple}",
bg = "${telescope_prompt}",
},
TelescopePromptTitle = {
fg = "${telescope_prompt}",
bg = "${purple}",
},
TelescopePreviewTitle = {
fg = "${telescope_results}",
bg = "${green}",
},
TelescopeResultsTitle = {
fg = "${telescope_results}",
bg = "${telescope_results}",
},
TelescopeMatching = { fg = "${blue}" },
TelescopeNormal = { bg = "${telescope_results}" },
TelescopeSelection = { bg = "${telescope_selection}" },
TelescopePreviewNormal = { bg = "${telescope_preview}" },
TelescopePreviewBorder = { fg = "${telescope_preview}", bg = "${telescope_preview}" },
}
Note: The config for Telescope itself was taken from the awesome NvChad!
Could you change the current Folded
highlight group?
Currently it makes it harder to distinguish folded text from comments.
I can change it in :
onedarkpro.setup({
hlgroups = {}
})
but many other highlight groups are linked to it.
Solution
Change LineNr
to
LineNr = { bg = theme.options.transparency, fg = theme.colors.gray }, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set.
and link it in place of Folded
If you'd like to have a different background color, you can do so by following the README.md, here. That way you can stay up to date with the plugin and not have to worry about maintaining a fork ๐
The SpellBad, SpellCap, SpellLocal, and SpellRare are not set in onedarkpro
After merging 43bfe7d, the theme now has the ability to specify highlight groups by filetype. Creating this issue for us to share our custom configs to get filetypes looking as close to One Dark Pro as possible.
After pasting some yaml
and ruby
code into VS Code and comparing the colors, this is where I've ended up:
filetype_hlgroups = {
yaml = {
TSField = { fg = "${red}" },
}
}
filetype_hlgroups = {
ruby = {
TSFunction = { fg = "${blue}", style = "bold" },
TSInclude = { fg = "${blue}", style = "italic" },
TSParameter = { fg = "${fg}" },
TSSymbol = { fg = "${cyan}" },
}
}
This is kind of dumb but, I've been using a different OneDark color scheme from https://github.com/navarasu/onedark.nvim and my setup looked like this.
So, after I switched to yours, it looks something like this.
I'm using the Item2's default dark color palette with the background set to 10% gray. You can see that the contrast a bit low in the line highlight and lualine. How can I make it look like my old config? (also I really don't like the purple accent on everything, any way I can change that? ๐ )
Hi
Your theme is awesome it's the reason that I'm trying to switch from vim to nvim, I'm trying to get the same results as the images that you share, but at the moment (since I downloaded the theme) the name of the variables and most of the text is in gray, only the name of functions, objects , primitive types and keywords of the language are in colors, name of the variables and arguments of functions are in gray too.
Besides the vim plug part this is my config on init.vim file
`
" Vim Colors Configuration
syntax enable
syntax on
set cursorline
if exists('+termguicolors')
"let &t_8f = "<Esc>[38;2;%lu;%lu;%lum"
"let &t_8b = "<Esc>[48;2;%lu;%lu;%lum"
set termguicolors
endif
set t_Co=256
colorscheme onedarkpro
`
As of commit 43bfe7d, I encounter this error on startup using LunarVim:
Error detected while processing /home/james/.local/share/lunarvim/lvim/init.lua:
E5113: Error while calling lua chunk: ...es/.local/share/lunarvim/lvim/lua/lvim/plugin-loader.lua:99:
Vim(lua):E5108: Error executing lua ...ck/packer/start/onedarkpro.nvim/lua/onedarkpro/utils.lua:167:
bad argument #1 to 'pairs' (table expected, got nil)
stack traceback:
[C]: in function 'pairs'
...ck/packer/start/onedarkpro.nvim/lua/onedarkpro/utils.lua:167: in function 'template_table'
...ck/packer/start/onedarkpro.nvim/lua/onedarkpro/utils.lua:336: in function 'load'
[string ":lua"]:1: in main chunk
[C]: in function 'cmd'
...es/.local/share/lunarvim/lvim/lua/lvim/plugin-loader.lua:99: in function 'load'
/home/james/.local/share/lunarvim/lvim/init.lua:13: in main chunk
stack traceback:
[C]: in function 'cmd'
...es/.local/share/lunarvim/lvim/lua/lvim/plugin-loader.lua:99: in function 'load'
/home/james/.local/share/lunarvim/lvim/init.lua:13: in main chunk
It would be OK to use the same style as Normal
.
Hey,
First, I'd like to say I really love Onedarkpro theme! I think this turns to be my favorite!
It seems like indent blankline is not colored when you hover on it.
Also, YAML keys are not highlighted (is this expected behavior?)
Last but not least, can this be supported with base16?
Thank you for this!
One of the concessions I had to make with trying to make the theme match VS Code's One Dark Pro was to sacrifice how YAML
files are highlighted.
The highlight group responsible is TSField
. Treesitter sees YAML
files as a collection of fields and highlights them accordingly. However it also applies TSField
to certain elements in Python
files. So we end up with a trade off. Do we wish to have YAML
files highlighted nicely or make Python
stick as close to the original One Dark Pro as best we can? I guess the choice is up to you.
If you wish to customise the TSField
highlight group so YAML
files are highlighted, you can do so by providing a highlight group override as per the readme:
local onedarkpro = require('onedarkpro')
onedarkpro.setup({
hlgroups = {
TSField = { fg = "${red}" }
}
})
onedarkpro.load()
I use onedarkpro
to switch between the onedark
and onelight
themes throughout the day. I also have custom colors and hlgroups which I apply depending on which theme is loaded.
I've noticed in recent times that as I flick between the two themes, certain hlgroups, which I've specified in my config, are ignored. This became most obvious with my telescope
prompts. For example, I may have the following config:
TelescopePromptTitle = {
fg = "${telescope_prompt}",
bg = "${purple}",
},
Which is then parsed by the theme's utilities to become:
TelescopePromptTitle = {
fg = "#2e323a",
bg = "#c678dd",
},
This works fine until I have two different values for ${telescope_prompt}
, for each theme:
colors = {
onedark = {
telescope_prompt = "#2e323a"
},
onelight = {
telescope_prompt = "#f5f5f5"
}
}
What happens then is that the theme only replaces telescope_prompt
once, when the theme is initialised. So when I toggle between onedark
and onelight
, the hlgroup for TelescopePromptTitle
will never change.
... = { ... style = "strikethrough" }
should be an option
thx
Somehow I can't change the nvim-cmp documentation, documentation border and item menu highlights.
I tried:
hlgroups = {
CmpDocumentation = { bg = colors.yellow },
CmpDocumentationBorder = { bg = colors.blue },
CmpItemMenu = { bg = colors.perple },
}
Error in packer_compiled: .../start/onedarkpro.nvim/lua/onedarkpro/colors/onedark.lua:38: attempt to call field 'lighten' (a nil value)
my config-
use {
'olimorris/onedarkpro.nvim',
config = [[require('config.onedarkpro')]]
}
vim.o.background = "dark" -- to load onedark
local onedarkpro = require("onedarkpro")
local config = {dark_theme = "onedark_vivid", light_theme = "onelight"}
onedarkpro.setup({
dark_theme = "onedark_vivid", -- The default dark theme
light_theme = "onelight", -- The default light theme
-- Theme can be overwritten with 'onedark' or 'onelight' as a string
theme = function()
if vim.o.background == "dark" then
return config.dark_theme
else
return config.light_theme
end
end,
colors = {onedark = {bg = '#27292d'}}, -- Override default colors by specifying colors for 'onelight' or 'onedark' themes
options = {
bold = false, -- Use the themes opinionated bold styles?
italic = true, -- Use the themes opinionated italic styles?
underline = false, -- Use the themes opinionated underline styles?
undercurl = false, -- Use the themes opinionated undercurl styles?
cursorline = true, -- Use cursorline highlighting?
transparency = false, -- Use a transparent background?
terminal_colors = false, -- Use the theme's colors for Neovim's :terminal?
window_unfocussed_color = false -- When the window is out of focus, change the normal background?
}
})
require('onedarkpro').load()
I have copied the default config and changed the transparency option from false to true and reload, but it didn't work. Nvim style reamain the same as before.
Hey there! Not an issue, just sharing info for anyone else interested.
I personally liked the vivid colors from One Dark in VS Code (specifically https://github.com/Binaryify/OneDark-Pro).
If anyone wants to recreate them in this theme, I think this is all that's needed:
local onedarkpro = require('onedarkpro')
onedarkpro.setup({
theme = "onedark",
colors = {
onedark = {
-- Vivid colors from https://github.com/Binaryify/OneDark-Pro
red = "#ef596f",
green = "#89ca78",
cyan = "#2bbac5",
purple = "#d55fde",
},
},
})
onedarkpro.load()
Hey @olimorris, I can't seem to find the hlgroup for nvim-cmp selected item. I have tried PmenuSel but it doesn't seem to work. This also applies to telescope or any popup menu/float. I get this very light color. โ
I also only noticed now that the Telescope title is very light. Any way to fix these ?
Exist a option to change value of VertSplit?
As per conversation in 6007bed
If you apply the color scheme, change to different one, and then try to re-apply it, nothing happens.
colorscheme onedark
colorscheme default
colorscheme onedark " Nothing happens
I try change color of vertical split with hlgroups but is not change.
Hi there
Thank you for this very beautiful and configurable theme, I love it.
I have only one issue currently, which is the following
The foreground color (text color) of the unfocused windows is to similar to the background color so that the information is not readable.
This is especially noticeable when using e.g. dap_ui which annotates the windows contents in the window bar. Or if I want to read what file the other window is.
Is this a design decision? Can I somehow override it? I tried to override the hlgroup lualine_b_inactive and lualine_c_inactive with no success.
It would be great to be able to switch between the light and the dark version of the color scheme simply by changing the :h 'bg'
option.
Would it be possible to disable the autoload behaviour from 5d90d33? I have multiple colorschemes enabled and use this plugin as a secondary colorscheme, so overriding the colorscheme by automatically loading it is messing with all my configs. Thanks!
Hi,
This is a suggestion.
I end up changing many highlights and colors to represent the onedarkpro for vscode that has over 4M downloads, a standard onedarkpro theme. If this repo is for everyone to enjoy the standard onedarkpro theme with neovim you should represent the exact onedarkpro.
For example, the default backgroud color should be bg = "#282c34"
, the next line should be purple and not italic TSInclude = { fg = theme.colors.blue, style = theme.options.italic }, -- For includes: "#include" in C, "use" or "extern crate" in Rust, or "require" in Lua.
and so on.
People should start from the standard theme and then change settings/highlights/colors if needed. But, if this repo is for yourself just ignore what I just said.
One last suggestion, the plugins by default should be set to false, so we can keep the onedarkpro.settup clean as much as possible.
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.