Code Monkey home page Code Monkey logo

onedarkpro.nvim's Introduction

OneDarkPro.nvim

Atom's iconic One Dark theme for Neovim.
Fully customisable, with Tree-sitter, LSP semantic tokens and support for many common plugins.

Based on the amazing One Dark Pro theme for Visual Studio Code.

๐Ÿฆ Themes

Note

All bolds and italics in the screenshots below are completely customisable. Additional screenshots of more languages can be found here.

Onedarkonedark

Onelightonelight

Onedark Vividonedark vivid

Onedark Darkonedark dark

โœจ Features

  • ๐Ÿ“ฉ Automatic caching for faster load times
  • ๐ŸŒฒ Full Tree-sitter support and bespoke queries
  • ๐ŸŽŸ๏ธ Support for LSP semantic tokens
  • ๐Ÿ”Œ Support for many popular plugins
  • ๐Ÿ”ฆ Filetype highlighting to allow for greater customisation across different languages
  • ๐Ÿ“ Override everything - styles, colors, tokens, highlight groups and filetype groups
  • ๐Ÿ–Œ๏ธ Create custom highlight groups and even highlight groups by filetypes

โšก Requirements

  • Neovim 0.9.2+
  • termguicolors enabled for true color support
  • tree-sitter for full syntax highlighting
  • For semantic tokens, an LSP server that supports them

๐Ÿ“ฆ 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

๐Ÿš€ Commands

The colorscheme comes with some useful commands:

  • :OnedarkproCache force generate new cache files for the themes (you won't often need this)
  • :OnedarkproClean removes existing cache files for the themes
  • :OnedarkproColors output all of the current themes colors to a scratch buffer

The theme comes with the ability to export colors to Alacritty, Kitty, Foot, Wezterm, Rio, Windows Terminal and Zellij using the following commands:

  • :OnedarkproExportToAlacritty
  • :OnedarkproExportToFoot
  • :OnedarkproExportToKitty
  • :OnedarkproExportToWezterm
  • :OnedarkproExportToWindowsTerminal
  • :OnedarkproExportToRio
  • :OnedarkproExportToZellij

The templates for these themes can be found in the extra folder.

๐Ÿ”ง Configuration

Default configuration

Note

You only need to the call the setup function if you wish to change any of the defaults.

Click to see the default configuration
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,
    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,
    copilot = true,
    dashboard = true,
    flash_nvim = true,
    gitsigns = true,
    hop = true,
    indentline = true,
    leap = true,
    lsp_saga = true,
    lsp_semantic_tokens = true,
    marks = true,
    mini_indentscope = 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,
    op_nvim = true,
    packer = true,
    polygot = true,
    rainbow_delimiters = 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?
  }
})

Setting a theme

Currently, there are four themes in the colorscheme:

  • onedark
  • onelight
  • onedark_vivid
  • onedark_dark

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:

  1. Using specific hex colors and styles:
require("onedarkpro").setup({
  highlights = {
    Comment = { fg = "#FF0000", bg = "#FFFF00", italic = true }
  }
})
  1. Referencing the name of colors:
require("onedarkpro").setup({
  highlights = {
    Comment = { fg = "${my_new_red}", bg = "${yellow}", italic = true }
  }
})
  1. Linking to other highlight groups:
require("onedarkpro").setup({
  highlights = {
    Comment = { link = "Substitute" }
  }
})
  1. Extending existing highlight groups:
require("onedarkpro").setup({
  highlights = {
    Comment = { underline = true, extend = true }
  }
})

Note

In the example above, an underline style has been applied to the existing Comment highlight group.

Creating highlight groups

You can also create your own highlight groups:

require("onedarkpro").setup({
  highlights = {
    MyNewHighlightGroup = { fg = "${red}" }
  }
})

or, if you'd like to disable certain highlight groups:

require("onedarkpro").setup({
  highlights = {
    ["@lsp.type.comment"] = {}
  }
})

Note

This can be useful to prevent LSP servers from applying semantic highlights

Specifying highlight attributes by theme or background

As with colors, highlight attributes may be specified by using the theme name or the background color. For example:

require("onedarkpro").setup({
  highlights = {
    Comment = {
      fg = { onedark = "${yellow}", onelight = "${my_new_red}" }
    }
  }
})

Alternatively, by background color:

require("onedarkpro").setup({
  highlights = {
    Comment = {
      fg = { dark = "${yellow}", light = "${my_new_red}" }
    }
  }
})

Namespacing highlight groups

Neovim supports the application of highlights to specific buffers via namespaces. To apply highlight groups to a specific namespace, use the ns_id key:

require("onedarkpro").setup({
  highlights = {
    Comment = { ns_id = 1, fg = "${light_gray}" }
  }
})

Configuring styles

Note

For a list of available styles, please refer to the Neovim documentation

Styles can be applied to highlight groups:

require("onedarkpro").setup({
  highlights = {
    Comment = { italic = true },
    Directory = { bold = true },
    ErrorMsg = { italic = true, bold = true }
  }
})

Within the theme, collections of highlight groups have been grouped together into styles. For users who use monospaced fonts with nice italics, this can go someway to enhancing the aesthetic of a theme with minimal effort. These styles may be configured as shown in the example below:

require("onedarkpro").setup({
  styles = {
    types = "NONE",
    methods = "NONE",
    numbers = "NONE",
    strings = "NONE",
    comments = "italic",
    keywords = "bold,italic",
    constants = "NONE",
    functions = "italic",
    operators = "NONE",
    variables = "NONE",
    parameters = "NONE",
    conditionals = "italic",
    virtual_text = "NONE",
  }
})

Configuring filetype highlighting

Note

Please see the Contributing guide if you would like add support for new filetypes.

The theme supports opinionated highlighting for filetypes, just like the original Visual Studio Code theme. By default, all of the filetypes supported are loaded at runtime. The theme currently has support for:

  • comment
  • go
  • html
  • java
  • javascript
  • json
  • lua
  • markdown
  • php
  • python
  • ruby
  • rust
  • scss
  • toml
  • typescript
  • typescriptreact
  • vue
  • xml
  • yaml

Specific filetypes can be disabled as follows:

require("onedarkpro").setup({
  filetypes = {
    markdown = false,
    ruby = false,
  }
})

Alternatively, all of the filetypes can be disabled:

require("onedarkpro").setup({
  filetypes = {
    all = false
  }
})

Or, all of the filetypes can be disabled with a select few enabled:

require("onedarkpro").setup({
  filetypes = {
    all = false,
    markdown = true,
    ruby = true,
  }
})

Adding or modifying filetype highlights

It's likely that you'll wish to add additional filetype highlights or even change the defaults. This can be achieved by adding them as custom highlight groups in the theme:

require("onedarkpro").setup({
  highlights = {
    ["@field.yaml"] = { fg = "${blue}", italic = true }
  }
})

In the example above, we have set the field tree-sitter highlight group to be blue, but only when the filetype is yaml. More information can be found via :h treesitter-highlight-groups.

To determine which highlight group is being applied in Neovim, see the FAQ section.

Configuring LSP semantic tokens

Note

Semantic tokens are only available in Neovim 0.9+ and with selected LSP servers.

In Neovim, some LSP servers may send tokens to the editor to allow for more intelligent highlighting such as variable scope; a feature which is impossible with tree-sitter alone.

Semantic highlighting in Neovim sees highlight groups set which have a priority greater than those of tree-sitter and the base vim highlight groups (see :h lsp-semantic_tokens for more information). A full list of available semantic tokens can be found here.

The colorscheme has defined some semantic tokens (to match the Visual Studio Code theme as closely as possible) and applies them as part of the filetype highlighting. To determine what tokens are available to set or override, use the :Inspect command.

Finally, the colorscheme has defined some non-filetype tokens as a plugin, named lsp_semantic_tokens. See the section below for how to disable this.

Configuring plugins

Note

Please see the Contributing guide if you would like add support for new plugins.

By default, all of the plugins supported by the theme are loaded at runtime. Specific plugins can be disabled as follows:

require("onedarkpro").setup({
  plugins = {
    nvim_lsp = false,
    polygot = false,
    treesitter = false
  }
})

Alternatively, all of the plugins can be disabled:

require("onedarkpro").setup({
  plugins = {
    all = false
  }
})

Or, all of the plugins can be disabled with a select few enabled:

require("onedarkpro").setup({
  plugins = {
    all = false,
    nvim_lsp = true,
    treesitter = true
  }
})

Configuring options

Cursorline

Cursorline highlighting is supported in the theme using a cursorline color (which may of course be overridden). This can be enabled with the following:

require("onedarkpro").setup({
  colors = {
    cursorline = "#FF0000" -- This is optional. The default cursorline color is based on the background
  },
  options = {
    cursorline = true
  }
})

Transparency

The theme supports transparent backgrounds:

require("onedarkpro").setup({
  options = {
    transparency = true
  }
})

By setting the transparency option to true, the Normal, Folded, SignColumn, Statusline and Tabline groups will have NONE as the background color. Additional transparency may be achieved by overriding more highlight groups.

Terminal Colors

By default, the colorscheme changes the colors for Neovim's :terminal to the current theme. This can be turned off if required.

require("onedarkpro").setup({
  options = {
    terminal_colors = false
  }
})

Highlighting Inactive Windows

The theme supports changing the color of the main window in Neovim when the focus is lost. For example, when a telescope or packer pop up appears:

require("onedarkpro").setup({
  options = {
    highlight_inactive_windows = true
  }
})

๐ŸŒˆ Helpers

The theme comes with a set of helpers which enable you to interact with and modify colors. The helper file can be accessed via require("onedarkpro.helpers").

Using colors from a theme

It can be useful to access a theme's colors for use within other plugins (such as your statusline) after its loaded. For this, the get_colors helper can be used:

local color = require("onedarkpro.helpers")

local colors = color.get_colors()
print(colors.purple) -- #c678dd (if using the Onedark theme)

Without specifying a theme name, the helper will get the colors for the currently loaded theme. Alternatively, specify a theme name, such as get_colors("onelight").

You can also use the command :OnedarkproColors to open a scratch buffer with the colors from the currently loaded theme. This then allows a colorizer plugin to highlight the colors.

Note

Please ensure that the colorscheme loads ahead of any plugins which may wish to use the theme's colors.

Using colors before a theme loads

Whilst the get_colors method is useful in most cases, it may be necessary to get a theme's colors before it has fully loaded. The common use case is for creating custom colors which are based on the theme's own palette and incorporating them back into the theme. For this, the get_preloaded_colors method can be used:

local color = require("onedarkpro.helpers")

local colors = color.get_preloaded_colors()
print(colors.purple) -- #c678dd (if using the Onedark theme)

Note

This will only output the theme's core color palette and not any generated colors.

Darken/Lighten/Brighten colors

The theme also contain helpers darken, lighten and brighten, to allow you to modify custom colors or the theme's own. All three helpers follow the same format and take three parameters:

  • color (string) - The name of the color to load (if specifying a theme) or a hex value
  • amount (number) - The amount to darken/lighten/brighten the color by (range from -100 to 100)
  • theme (string) (optional) - The name of the theme to load a color from

To use this in practice:

local color = require("onedarkpro.helpers")

-- Load the red color from the onedark theme and lighten it by an amount of 7
print(color.lighten("red", 7, "onedark")) -- #e68991

Alternatively:

local color = require("onedarkpro.helpers")

-- Darken Red1 by an amount of 10
print(color.darken("#FF0000", 10)) -- #cc0000

A common use case is to modify colors and incorporate them into theme. There are a number of ways to accomplish this and the most efficient is to pass a function (as a string) to the colors table in the theme's configuration:

require("onedarkpro").setup({
  colors = {
    dark_red = "require('onedarkpro.helpers').darken('red', 10, 'onedark')",
  },
  highlights = {
    CustomRedHighlight = {
      fg = "${dark_red}",
    },
  }
})

This prevents the theme from trying to resolve the color before the whole of the configuration has been parsed. This also ensures that the startup time for the theme remains small.

๐Ÿ”Œ Supported Plugins

The theme supports the following plugins:

๐ŸŽ Extras

Lualine

The theme has Lualine support out of the box for all of its themes. This can be found in the Lualine folder.

Toggling between themes

To enable the easy switching between dark and light colorschemes, the following helper function could be used:

function ToggleTheme()
  if vim.o.background == "dark" then
    vim.cmd("colorscheme onelight")
  else
    vim.cmd("colorscheme onedark")
  end
end

โ“ FAQs

I want to change a highlight group but I don't know what it is. How do I find out?

If you're using Neovim 0.9+, the :Inspect command is available.

If you're on an earlier version of Neovim and are using Tree-sitter, install Playground as this gives you access to the powerful :TSHighlightCapturesUnderCursor command. This shows any Tree-sitter or syntax highlight groups under the cursor.

I think the theme would look better if we changed the highlight group of X. Would you accept a PR?

As mentioned at the top of this readme, the theme is based on the One Dark Pro theme for Visual Studio Code. Where possible, I will always reconcile back to that. Unless something looks terrible or the readability can be signficantly improved, I'll nearly always default to what the original theme has done. Remember that you can apply your own customisations to the theme by configuring highlight groups.

Ok then, but I've noticed some differences between the theme and the original Visual Studio Code theme. Why is this?

I've tried to ensure that the theme resembles the original Visual Studio Code theme as much as possible. To that end we have carefully applied custom Tree-sitter queries to certain filetypes as well as mapped LSP semantic token colors. If you notice any differences, please raise a discussion with supporting screenshots.

๐Ÿ‘ Credits

The following colorschemes serve as inspiration:

  • One Dark Pro - The inspiration for this colorscheme
  • Catppuccin/nvim - For the genius idea of hashing and caching and pushing the envelope of Neovim colorschemes and the kind PRs
  • Nightfox - For the original code structure
  • GitHub nvim theme - For the logo inspiration

onedarkpro.nvim's People

Contributors

anthony-s93 avatar github-actions[bot] avatar harry-lees avatar hougesen avatar lc0117 avatar maxmx03 avatar metainsight7 avatar mmirus avatar mo8it avatar mrjones2014 avatar mrstrik3 avatar nickp-real avatar nullchilly avatar olimorris avatar oscarfsbs avatar rj1 avatar robstumborg avatar tristan957 avatar vidocqh avatar vpavliashvili avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

onedarkpro.nvim's Issues

Share your custom highlights

Telescope

I thought I'd begin by sharing how I have Telescope formatted:

Screenshots

Screen Shot 2023-01-17 at 18 15 15@2x

Screen Shot 2023-01-17 at 18 15 39@2x

Highlights

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!

Changing higlight groups for vim-matchup

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

Error in theme

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()

Disable autoload on setup

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!

The color of OneDarkPro Background is Blue

I don't know what I'm doing wrong, because I installed the Plugin through Plug and I used the lua script that you can see in photo bellow. How can I solved my problem?

Screen Shot 2022-03-21 at 18 41 39

Screen Shot 2022-03-21 at 18 47 11

Highlight "link" not honored

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.

Custom config is only parsed on initial 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.

YAML files are not highlighted

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.

Python with TSField set to foreground (default)

Screen Shot 2021-11-28 at 11 14 16@2x

Python with TSField set to red (which highlights YAML files)

Screen Shot 2021-11-28 at 11 15 08@2x

YAML with TSField set to foreground (default)

Screen Shot 2021-11-28 at 11 21 30@2x

YAML with TSField set to red

Screen Shot 2021-11-28 at 11 15 37@2x

Your configuration

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()

nvim-cmp hlgroup. (and telescope title)

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. โ†“

Screenshot 2022-06-05 at 16 05 39

Screenshot 2022-06-05 at 16 07 29

I also only noticed now that the Telescope title is very light. Any way to fix these ?

vscode onedarkpro vs this one

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

Minimal.lua file to use when testing onedarkpro

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!

minimal.lua

-- 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

Transparency option didn't work

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.

Changing background color

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 ๐Ÿ˜„

Unfocused window lua bar unreadable

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.

image

How do I make the colors a bit dimmer?

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.
image

So, after I switched to yours, it looks something like this.
image

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? ๐Ÿ˜„ )

Share your custom filetype highlights

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:

Yaml

filetype_hlgroups = {
  yaml = {
    TSField = { fg = "${red}" },
  }
}

Ruby

filetype_hlgroups = {
  ruby = {
    TSFunction = { fg = "${blue}", style = "bold" },
    TSInclude = { fg = "${blue}", style = "italic" },
    TSParameter = { fg = "${fg}" },
    TSSymbol = { fg = "${cyan}" },
  }
}

Telescope missing borders

After a update (unsure if onedarkpro or telescope) the borders of telescope are missing.

image

With a different colorscheme it looks like this
image

Indent blankline is not colored

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!

Question: how to setup the theme properly for python?

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

`

Change folded highlight group

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

"Vivid" colors

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()

SCSS color VSCode

Hello.
I don't understand why i didn't have the same color :
Vscode One Dark Pro SCSS:
image

Neovim One Dark Pro SCSS :
image

I use neovim v0.6.1
Lastest Treesitter and OneDarkPro (no custom config)

Could you help me please ?

Custom highlight groups feature causes startup error

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

Line number color

Hi,

The colortheme worked perfectly but suddenly the line numbers did change color and i can't find a way to fix it. The linenumbers are some sort of purple? Also the CursorLineNr is not applied anymore.

1647282173

I tried reinstalling but it did not change anything.

Any ideas where it goes wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.