Coder Social home page Coder Social logo

folke / tokyonight.nvim Goto Github PK

View Code? Open in Web Editor NEW
5.2K 17.0 347.0 804 KB

πŸ™ A clean, dark Neovim theme written in Lua, with support for lsp, treesitter and lots of plugins. Includes additional themes for Kitty, Alacritty, iTerm and Fish.

License: Apache License 2.0

Lua 93.76% Shell 3.93% Vim Script 0.04% C 0.93% JavaScript 1.34%
neovim neovim-theme neovim-lua vim vim-theme neovim-colorscheme vim-colorscheme alacritty-theme alacritty-colorscheme kitty-themes

tokyonight.nvim's Introduction

πŸ™ Tokyo Night

A dark and light Neovim theme written in Lua ported from the Visual Studio Code TokyoNight theme. Includes extra themes for Kitty, Alacritty, iTerm and Fish.

Storm

image

Night

image

Moon

image

Day

image

✨ Features

  • Supports the latest Neovim 0.9.0 features.
  • Enhances terminal colors.
  • Introduces a darker background option for sidebar-like windows.
  • Supports all major plugins.
  • Provides TokyoNight extras for numerous other applications.

🍭 Extras

⚑️ Requirements

πŸ“¦ Installation

Install the theme with your preferred package manager, such as folke/lazy.nvim:

{
  "folke/tokyonight.nvim",
  lazy = false,
  priority = 1000,
  opts = {},
}

πŸš€ Usage

Vim Script

colorscheme tokyonight

" There are also colorschemes for the different styles.
colorscheme tokyonight-night
colorscheme tokyonight-storm
colorscheme tokyonight-day
colorscheme tokyonight-moon
vim.cmd[[colorscheme tokyonight]]

External Plugins

-- Lua
require('barbecue').setup {
  -- ... your barbecue config
  theme = 'tokyonight',
  -- ... your barbecue config
}
-- Lua
require('lualine').setup {
  options = {
    -- ... your lualine config
    theme = 'tokyonight'
    -- ... your lualine config
  }
}
" Vim Script
let g:lightline = {'colorscheme': 'tokyonight'}

βš™οΈ Configuration

❗️ Set the configuration BEFORE loading the color scheme with colorscheme tokyonight.

The theme offers four styles: storm, moon, night, and day.

The day style is used when { style = "day" } is passed to setup(options) or when vim.o.background = "light".

TokyoNight uses the default options, unless setup is explicitly called.

require("tokyonight").setup({
  -- your configuration comes here
  -- or leave it empty to use the default settings
  style = "storm", -- The theme comes in three styles, `storm`, `moon`, a darker variant `night` and `day`
  light_style = "day", -- The theme is used when the background is set to light
  transparent = false, -- Enable this to disable setting the background color
  terminal_colors = true, -- Configure the colors used when opening a `:terminal` in [Neovim](https://github.com/neovim/neovim)
  styles = {
    -- Style to be applied to different syntax groups
    -- Value is any valid attr-list value for `:help nvim_set_hl`
    comments = { italic = true },
    keywords = { italic = true },
    functions = {},
    variables = {},
    -- Background styles. Can be "dark", "transparent" or "normal"
    sidebars = "dark", -- style for sidebars, see below
    floats = "dark", -- style for floating windows
  },
  sidebars = { "qf", "help" }, -- Set a darker background on sidebar-like windows. For example: `["qf", "vista_kind", "terminal", "packer"]`
  day_brightness = 0.3, -- Adjusts the brightness of the colors of the **Day** style. Number between 0 and 1, from dull to vibrant colors
  hide_inactive_statusline = false, -- Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine** and **LuaLine**.
  dim_inactive = false, -- dims inactive windows
  lualine_bold = false, -- When `true`, section headers in the lualine theme will be bold

  --- You can override specific color groups to use other groups or a hex color
  --- function will be called with a ColorScheme table
  ---@param colors ColorScheme
  on_colors = function(colors) end,

  --- You can override specific highlights to use other groups or a hex color
  --- function will be called with a Highlights and ColorScheme table
  ---@param highlights Highlights
  ---@param colors ColorScheme
  on_highlights = function(highlights, colors) end,
})

πŸͺ“ Overriding Colors & Highlight Groups

How the highlight groups are calculated:

  1. colors are determined based on your configuration, with the ability to override them using config.on_colors(colors).
  2. These colors are utilized to generate the highlight groups.
  3. config.on_highlights(highlights, colors) can be used to override highlight groups.

For default values of colors and highlights, please consult the storm, moon, night, and day themes.

Settings and color alteration demonstration

require("tokyonight").setup({
  -- use the night style
  style = "night",
  -- disable italic for functions
  styles = {
    functions = {}
  },
  sidebars = { "qf", "vista_kind", "terminal", "packer" },
  -- Change the "hint" color to the "orange" color, and make the "error" color bright red
  on_colors = function(colors)
    colors.hint = colors.orange
    colors.error = "#ff0000"
  end
})
require("tokyonight").setup({
  on_highlights = function(hl, c)
    local prompt = "#2d3149"
    hl.TelescopeNormal = {
      bg = c.bg_dark,
      fg = c.fg_dark,
    }
    hl.TelescopeBorder = {
      bg = c.bg_dark,
      fg = c.bg_dark,
    }
    hl.TelescopePromptNormal = {
      bg = prompt,
    }
    hl.TelescopePromptBorder = {
      bg = prompt,
      fg = prompt,
    }
    hl.TelescopePromptTitle = {
      bg = prompt,
      fg = prompt,
    }
    hl.TelescopePreviewTitle = {
      bg = c.bg_dark,
      fg = c.bg_dark,
    }
    hl.TelescopeResultsTitle = {
      bg = c.bg_dark,
      fg = c.bg_dark,
    }
  end,
})

Fix undercurls in Tmux

To have undercurls show up and in color, add the following to your Tmux configuration file:

# Undercurl
set -g default-terminal "${TERM}"
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'  # undercurl support
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'  # underscore colours - needs tmux-3.0

🍭 Extras

Extra color configs for Kitty, Alacritty, Fish, WezTerm, iTerm and foot can be found in extras. To use them, refer to their respective documentation.

image

You can easily use the color palette for other plugins inside your Neovim configuration:

local colors = require("tokyonight.colors").setup() -- pass in any of the config options as explained above
local util = require("tokyonight.util")

aplugin.background = colors.bg_dark
aplugin.my_error = util.lighten(colors.red1, 0.3) -- number between 0 and 1. 0 results in white, 1 results in red1

πŸ”₯ Contributing

Pull requests are welcome.

For the extras, we use a simple template system that can be used to generate themes for the different styles.

How to add a new extra template:

  1. Create a file like lua/tokyonight/extra/cool-app.lua.

  2. Add the name and output file extension to the extras table in lua/tokyonight/extra/init.lua.

  3. Run the following command to generate new extra themes from the tokyonight plugin directory:

    nvim --headless "+lua require('tokyonight.extra').setup()" +qa
  4. Check the newly created themes in the extra/ directory. Please DO NOT commit them, as they are already automatically built by the CI.

tokyonight.nvim's People

Contributors

amaanq avatar augustocdias avatar catossun avatar christianchiarulli avatar folke avatar ful1e5 avatar gaetan-puleo avatar github-actions[bot] avatar jpe90 avatar kristoferssolo avatar laughingman-hass avatar lkhphuc avatar mertzt89 avatar nullchilly avatar otavioschwanck avatar pato avatar petertriho avatar riley-martine avatar sam-hobson avatar skoch13 avatar ssiyad avatar stevearc avatar strayer avatar stsewd avatar thomascft avatar timtyrrell avatar tymekdev avatar typicode avatar vinnya3 avatar wangl-cc 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tokyonight.nvim's Issues

Duplicate of #25 and #28 for Iterm2

I noticed that Zsh autocomplete suggestions are very hard to read so I checked to see if any issues had been opened before.

#25 and #28 seem to address the same issue but for other terminals. I was just letting you know that the color is still on the old version for Iterm2. I'm not entirely sure how color schemes work for Iterm2 since I've never written one myself but I can try looking into how to change it.

Screen Shot 2021-05-13 at 8 34 41 PM

LSP highlight colors are off

I only noticed this with bashls so far, but when the LSP highlights the word under the cursor, it looks incredibly ugly:

grafik

This is how the highlighting works by searching for me (I think this is how it should look like):

grafik

This doesn't happen when I stop bashls with :LspStop <id>, so this really seems to be related to the "Highlight occurrences" feature by that language server.

Issues with vim-plug installation in neovim

Hi there,

My neovim init sources ~/.vimrc and there I added install of this plugin using vim-plug. When I reload neovim, I get this error:

Error detected while processing /Users/amer/.config/nvim/autoload/plugged/tokyonight.nvim/colors/tokyonight.vim:
line    9:
E5105: Error while calling lua chunk: ...toload/plugged/tokyonight.nvim/lua/tokyonight/config.lua:9: attempt to index field 'g' (a nil value)
Press ENTER or type command to continue

The elements I have added to ~/.vimrc are:

  1. Installation of plugin:
    Plug 'folke/tokyonight.nvim'
    
  2. Config of the colorscheme:
    colorscheme tokyonight
    
  3. Some theme settings at the bottom:
    let g:tokyonight_style = 'night'
    let g:tokyonight_italic_functions = true
    let g:tokyonight_sidebars = [ 'quickfix', '__vista__', 'terminal' ]
    
    
    

So nothing that I see which I could be doing wrong, but still have that error.

overriding colors

What's the best way to override some of the colors in this scheme?

I have a highlights.lua that I've tried sourcing before and after the colorscheme (require "highlights")

Also tried this in packer:

use {
"folke/tokyonight.nvim",
config = [[require('highlights')]]
}

Also tried for example this:

vim.api.nvim_exec([[
augroup MyColors
	autocmd!
	autocmd ColorScheme * highlight DashboardHeader guifg=#FFba00
augroup END
]], false) 

When I load nvim the dashboard header flashes yellow briefly before the colorscheme changes it to the regular blue color.

If I manually source with 'luafile lue/highlights.lua' everything works great.

Cheers for the great colorscheme!

Italic for variables

I think I found my new go-to vim theme, thanks!

As a math nerd, the one thing I'd like to add is the option to make variables italic, rather than functions and keywords, which usually are not, in a math context.

Set theme for lualine

Your theme is really nice! good job!

I try to set the theme for lualine but It doesn't work well.
Screenshot from 2021-04-20 22-47-44

I tried to enable the option with this setting.

require('lualine').setup {
  theme = 'tokyonight'
}

Just some compliments and a question

Wow, I've been using your colorscheme for a couple of days now and I'm just blown away with how good it is.
Good job man, this has to be the best colorscheme for Vim/NeoVim in existence right now.

Also I've been wondering, since I've been working on my material.nvim scheme. It has been using colorbuddy.nvim which I've wanted to ditch for some time now, because it has been holding me back in some aspects. would it be okay if I used your source code as a guide for rewriting my theme?
Of course, not to make an exact clone with different colors, but just the basic stuff like loading highlight groups and figuring out different options like that darker nvim-tree background.

Error when setting background to transparent

Cool theme! Really like the colors

However, I really want to have my background transparent. But when I set it using vim.g.tokyonight_transparent = true, I get this error:

E5108: Error executing lua ...ack/packer/start/tokyonight.nvim/lua/tokyonight/util.lua:13: hex_to_rgb: invalid hex_str: none

after which the bg is transparent, but the colorscheme either doesn't load at all or the colors are all over the place.

Any suggestions how to fix?

Low contrast in Substitute

Love the theme! But maybe there is room for improvement when searching and replacing (Substitute)?
I find it hard to read the white on top of pink (it could also just be me getting old :)).
Maybe use the same colors as for IncSearch?

Thank you for all the excellent work!!

searchnreplace

diff colors hard to see

Hello @folke, u made great theme. But I can barely see the gitsings for added/changed lines.
obraz

Your diff colors work quite ok on diff-split though...
obraz

Example from well balanced Edge theme - author is using different color for diff-split and gitsigns making gitsigns clearly visible:
obraz
Notice the perceived brightness of darker diff-split background colors is similar. Same goes for brighter gitsigns color - they are very similar in value.

If you could equalize blue, green brightness compared to red (they are to dark vs red).
And maybe make separate diff colors for diff-split and gitsigns (which could be +3 brighter in one to ten scale)

Theme colors are very wrong

I have this set as my alacritty and neovim themes. On another device I have identical configuration and it looks fine but my colors seem way off here. Config is synced between them with git so I'm not sure what the difference could be. Do you have any idea?

E: The tabline and statusline are wrong on purpose, I was flipping different themes off and on to see if one of them had a conflict.

image

Fern colors

I have some issues with nvim-tree.lua.

I installed Fern, this theme needs to be tweaked a little to look good.

I am working on it, I will create a PR when it's ready!

Add support for fzf

It will be great if tokyonight support fzf. This is a snippet that I have used for highlighting fzf with the edge theme. I guess it would help.

	export FZF_DEFAULT_OPTS=$FZF_DEFAULT_OPTS' 
	--color=fg:#c5cdd9,bg:#262729,hl:#6cb6eb 
	--color=fg+:#c5cdd9,bg+:#262729,hl+:#5dbbc1 
	--color=info:#88909f,prompt:#ec7279,pointer:#d38aea 
	--color=marker:#a0c980,spinner:#ec7279,header:#5dbbc1'

Suggestion: different semantic coloring for lsp hints

Currently hints (unused vars etc) are displayed in green (labelled as teal, but mediumseagreen according to Eye Dropper), which looks good in the theme but is arguably confusing semantically if it's supposed to indicate (potential) issues.

Maybe it could be changed to orange (did this for my fork) or a different shade of yellow from warnings.

Bat theme

bat
Here is an application widely used and a theme for this would be great. Thanks

Conceal color too dark

Concealed math symbols in LaTeX are too dark to see.

conceal

Conceal is linked to fg_gutter so I would need to override fg_gutter which then affects a number of other elements that depend on fg_gutter. Could the default be changed to something brighter?

Bump line number brightness

The line numbers are not clearly visible:
image
I have to squint my eyes every time when I do relative jump by line number. Maybe it is just my bad eyesight :). Imo the brightness of comments is on the threshold where they are still visible, but line numbers goes below that threshold.

Alacritty theme bright black

Hi! I love this theme thanks for porting it to NeoVim

One thing I noticed with the alacritty theme (night) is that the bright black color is the same as the normal black so in certain contexts it makes the text unreadable like zsh autocomplete suggestions, I haven't tried with other theme variations.

Screenshot from 2021-05-01 16-59-01

So I changed that color from 0x15161E to 0x565f89 which is the comment color variant

image

I could try to make a PR if you think it's necessary

Thanks again!

Directories are barely differenciable

Hi, thanks for the awesome color theme. I love it!

My only problem so far: the directories are barely readable when using netrw or dirvish.

image

  • Do you agree that we should have a more readable color?
  • How would I override the theme in a clean way? If I want to say Directory is now theme.cyan_3 or whatever color.

Thanks 😊

Question/ possible documentation issue

what are all the available color setting we can do using vim.g.tokyonight_colors = {} I would like to change my Normal highlight group from what it is to #2C2C3A.

Indent blankline keeping highlighting when scrolled past

Using the latest indent-blankline from the lua branch.

When vim.wo.cursorline = true is set and vim.cmd 'colorscheme = toykonight' it will cause blank indentlines to keep the background highlighting from cursorline when scrolled past.

Before scrolling
After scrolling

Tmux

Nice colorscheme, considering moving from falcon which I used for years.

Tried to adapt my tmux configuration today, and failed miserably; nothing I came up with was visually pleasing and usable at the same time.

Given your artistic abilities, would you consider adding tmux colorscheme to extras?

It's fine if you are not using tmux or can't be bothered. Close it straight away. 😁

Thanks!

Error sourcing init.vim after installation

I'm new to Neovim and want to try this awesome theme out. But I have trouble running it. I'm using WSL on a windows machine.

When I run :source % after installing the theme via vim-plug, I got this error :

Error detected while processing /home/cdclaw/.local/share/nvim/plugged/tokyonight.nvim/colors/tokyonight.vim:
line    9:
E5105: Error while calling lua chunk: ...e/nvim/plugged/tokyonight.nvim/lua/tokyonight/config.lua:9: attempt to index field 'g' (a nil value)

Unable to set options in vimscript

Hi,

The README seems to be incorrect with the reference to false|true:

let g:tokyonight_italic_functions = true

This throws an error. I've also tried the following:

let g:tokyonight_italic_functions = 'NONE'
let g:tokyonight_italic_functions = 0

Neither of this have an effect either. What am I missing? Thanks

Two shades of black in terminal

I noticed there are two shades of black, one for terminal (Alacritty in my case) and Neovim terminal. This screenshot illustrates it.

Screen Shot 2021-04-29 at 10 07 51 AM

Having the darker version makes text unreadable in certain cases when black or brightblack is used against the already dark background.

I noticed that you are setting the lighter black here and was wondering if we could address the delta in black shades. The swatches for white and brightwhite have different shades as seen in the screenshot. Wondering if we could apply that precedence to the black variables.

Thanks for the work on the color scheme btw.

Use background feature

Hi! Thank you for the awesome theme!
I noticed that you added a light variant as a separate style. But can we use Neovim's "background" feature? I mean just respect user background setting to choose between light and dark variant and take style into account only for a dark background?

Bufferline slant separator is white

Hi, I am using the 'slant' separator_style on my nvim-bufferline config.

If you use this config for nvim-bufferline you will get the result below

require'bufferline'.setup{
	options = {
		separator_style = "slant",
		mappings = true,
		offsets = {{filetype = "NvimTree", text = "File Explorer", highlight = "Directory", text_align = "left"}},
		always_show_bufferline = false,
		diagnostics = "nvim_lsp",
		diagnostics_indicator = function(count, level, diagnostics_dict)
			return "("..count..")"
		end
	}
}

Screenshot from 2021-05-18 13-44-39

Invalid buffer id

When I execute :set background = light #or dark before opening NvimTree (e.g. no valid NvimTree buffers exists), I get the following error:

E5108: Error executing lua ...ack/plugins/opt/nvim-tree.lua/lua/nvim-tree/renderer.lua:344: Invalid buffer id: 2

Create PRs in nvim-treesitter repo for queries instead of defining them here

I noticed this repo had it's own queries directory. It'd be more useful to the nvim community if these queries were added to the main nvim-treesitter/nvim-treesitter repo, since those can be used by all colorschemes, and are updated more frequently, reducing "maintenance costs" for everyone.

For example the @keyword.function query in this repo has since been added to the ecmascript grammar queries (so it's applied twice if tokyonight is in the runtimepath). It'd be great if you could make these contributions to that repo in the future.

Cool colorscheme btw πŸ‘

Did tokyonight_style stop working?

I think that a recent change has stopped the tokyonight_style setting from working correctly.

When I use my (out of date) fork the background colour changes fine, but after updating today it seems to be stuck on "storm". Therefore setting to "night" seems to not work as expected.

Day mode colours off?

Is it just me or are all the colours slightly off from the original TokyoNight light theme? Is this intentional? I love your dark themes but I find the day version quite harsh on the eyes in comparison to the original. It feels a lot more... blue.

Screenshot 2021-05-18 at 13 47 39

Colors look strange in vim running in tmux

For some reason colors are not looking right when I open Vim inside a tmux 3.2 session.
I have theme installed for both Vim and the Kitty terminal.

Screenshot 2021-05-29 at 00 24 00

Outside of tmux, everything looks fine:
Screenshot 2021-05-29 at 00 31 07

error while calling lua chunk

Arch Linux, Neovim 0.4.4 Konsole terminal

Installed following isntructions for Vim-plug. Installed ok.

Set in init.vim as:


let g:tokyonight_style = "storm"
let g:tokyonight_italic_functions = 1
let g:tokyonight_sidebars = [ "qf", "vista_kind", "terminal", "packer" ]

" Load the colorscheme
colorscheme tokyonight

detected error processing /home/jose/.vim/plugged/tokyonight.nvim/colors/tokyonight.vim:
lΓ­ne 9
E5105: Error while calling lua chunk: ...e/.vim/plugged/tokyonight.nvim/lua/tokyonight/config.lua:9: attempt to index field 'g' (a nil value)

How to get the diagnostic icons in the gutter?

I have the theme, neovim lsp and a nerdfonts patched font setup and configured, but instead of a fancy icon, I get a red E in the gutter.

image

How do I get the nice icon like in your screenshots?
Thanks for the awesome theme!

Colorscheme not being set

I have configured tokyonight to use day version but it isn't getting set but when i do lua print(vim.g.tokyonight_style) it prints day. So it is getting configured but not getting set for some reason. Same for the night, it gets set to storm always.

Screenshot from 2021-06-25 16-35-20

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.