Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support lightline #39

Merged
merged 1 commit into from
May 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ A dark and light Neovim theme written in Lua ported from the Visual Studio Code
+ [Dashboard](https://github.com/glepnir/dashboard-nvim)
+ [BufferLine](https://github.com/akinsho/nvim-bufferline.lua)
+ [Lualine](https://github.com/hoob3rt/lualine.nvim)
+ [Lightline](https://github.com/itchyny/lightline.vim)
+ [Neogit](https://github.com/TimUntersberger/neogit)
+ [vim-sneak](https://github.com/justinmk/vim-sneak)

## ⚡️ Requirements

+ Neovim >= 0.5.0

## 📦 Installation

Install the theme with your preferred package manager:
Expand Down Expand Up @@ -88,6 +89,13 @@ require('lualine').setup {
}
```

To enable the `tokyonight` colorscheme for `Lightline`:

```vim
" Vim Script
let g:lightline = {'colorscheme': 'tokyonight'}
```

## ⚙️ Configuration

> ❗️ configuration needs to be set **BEFORE** loading the color scheme with `colorscheme tokyonight`
Expand Down
2 changes: 2 additions & 0 deletions autoload/lightline/colorscheme/tokyonight.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
let s:palette = v:lua.require('lightline.colorscheme.tokyonight')
let g:lightline#colorscheme#tokyonight#palette = lightline#colorscheme#fill(s:palette)
44 changes: 44 additions & 0 deletions lua/lightline/colorscheme/tokyonight.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
local config = require("tokyonight.config")
local colors = require("tokyonight.colors").setup(config)
local util = require("tokyonight.util")

local tokyonight = {}

tokyonight.normal = {
left = {{ colors.black, colors.blue }, { colors.blue, colors.bg }},
middle = {{ colors.blue, colors.fg_gutter }},
right = {{ colors.fg_sidebar, colors.bg_statusline }, { colors.blue, colors.bg }},
error = {{ colors.black, colors.error }},
warning = {{ colors.black, colors.warning }},
}

tokyonight.insert = {
left = {{ colors.black, colors.green }, { colors.blue, colors.bg }},
}

tokyonight.visual = {
left = {{ colors.black, colors.magenta }, { colors.blue, colors.bg }},
}

tokyonight.replace = {
left = {{ colors.black, colors.red }, { colors.blue, colors.bg }},
}

tokyonight.inactive = {
left = {{ colors.blue, colors.bg_statusline }, {colors.dark3, colors.bg }},
middle = {{ colors.fg_gutter, colors.bg_statusline }},
right = {{ colors.fg_gutter, colors.bg_statusline }, {colors.dark3, colors.bg }},
}

if vim.o.background == "light" then
for _, mode in pairs(tokyonight) do
for _, section in pairs(mode) do
for _, subsection in pairs(section) do
subsection[1] = util.getColor(subsection[1])
subsection[2] = util.getColor(subsection[2])
end
end
end
end

return tokyonight