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

Rename module to vscode-theme #217

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
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
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ The theme is manipulating the treesitter highlight queries as follows:
] @keyword.conditional
```

this mimics the behavior of VSCode's default theme more closely. Be aware that
this mimics the behavior of VSCode's default theme more closely. Be aware that
this is not a perfect solution but as far as we know, there is no better way to
achieve this and most popular themes are doing the same thing.

Expand All @@ -73,8 +73,8 @@ vim.o.background = 'dark'
-- For light theme
vim.o.background = 'light'

local c = require('vscode.colors').get_colors()
require('vscode').setup({
local c = require('vscode-theme.colors').get_colors()
require('vscode-theme').setup({
-- Alternatively set style in setup
-- style = 'light'

Expand All @@ -90,22 +90,22 @@ require('vscode').setup({
-- Disable nvim-tree background color
disable_nvimtree_bg = true,

-- Override colors (see ./lua/vscode/colors.lua)
-- Override colors (see ./lua/vscode-theme/colors.lua)
color_overrides = {
vscLineNumber = '#FFFFFF',
},

-- Override highlight groups (see ./lua/vscode/theme.lua)
-- Override highlight groups (see ./lua/vscode-theme/theme.lua)
group_overrides = {
-- this supports the same val table as vim.api.nvim_set_hl
-- use colors from this colorscheme by requiring vscode.colors!
-- use colors from this colorscheme by requiring vscode-theme.colors!
Cursor = { fg=c.vscDarkBlue, bg=c.vscLightGreen, bold=true },
}
})
-- require('vscode').load()
-- require('vscode-theme').load()

-- load the theme without affecting devicon colors.
vim.cmd.colorscheme "vscode"
vim.cmd.colorscheme "vscode-theme"
```


Expand All @@ -115,7 +115,7 @@ If you are using [`lualine`](https://github.com/hoob3rt/lualine.nvim), you can a
require('lualine').setup({
options = {
-- ...
theme = 'vscode',
theme = 'vscode-theme',
-- ...
},
})
Expand Down Expand Up @@ -189,8 +189,8 @@ require("bufferline").setup({
## Switching theme

```
:lua require('vscode').load('light')
:lua require('vscode').load('dark')
:lua require('vscode-theme').load('light')
:lua require('vscode-theme').load('dark')
```

## 🍭 Extra folder
Expand Down
2 changes: 2 additions & 0 deletions colors/vscode-theme.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
local vscode_theme = require('vscode-theme')
vscode_theme.load()
2 changes: 0 additions & 2 deletions colors/vscode.lua

This file was deleted.

20 changes: 10 additions & 10 deletions lua/lualine/themes/vscode.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Copyright (c) 2020-2021 Mofiqul Islam
-- MIT license, see LICENSE for more details.
local config = require('vscode.config')
local vscode = {}
local config = require('vscode-theme.config')
local vscode_theme = {}
local colors = {}

if vim.o.background == 'dark' then
Expand All @@ -28,45 +28,45 @@ else
colors.pink = '#FFA3A3'
end

vscode.normal = {
vscode_theme.normal = {
a = { fg = vim.o.background == 'dark' and colors.fg or colors.bg, bg = colors.blue, gui = 'bold' },
b = { fg = colors.blue, bg = config.opts.transparent and 'NONE' or colors.bg2 },
c = { fg = colors.fg, bg = config.opts.transparent and 'NONE' or colors.bg },
}

vscode.visual = {
vscode_theme.visual = {
a = { fg = colors.bg, bg = colors.yellow, gui = 'bold' },
b = { fg = colors.yellow, bg = config.opts.transparent and 'NONE' or colors.bg },
}

vscode.inactive = {
vscode_theme.inactive = {
a = { fg = colors.fg, bg = colors.bg, gui = 'bold' },
b = { fg = colors.inactive, bg = config.opts.transparent and 'NONE' or colors.bg },
c = { fg = colors.inactive, bg = config.opts.transparent and 'NONE' or colors.bg },
}

vscode.replace = {
vscode_theme.replace = {
a = { fg = vim.o.background == 'dark' and colors.bg or colors.fg, bg = colors.red, gui = 'bold' },
b = { fg = colors.red, bg = config.opts.transparent and 'NONE' or colors.bg2 },
c = { fg = colors.fg, bg = config.opts.transparent and 'NONE' or colors.bg },
}

vscode.insert = {
vscode_theme.insert = {
a = { fg = colors.bg, bg = colors.green, gui = 'bold' },
b = { fg = colors.green, bg = config.opts.transparent and 'NONE' or colors.bg2 },
c = { fg = colors.fg, bg = config.opts.transparent and 'NONE' or colors.bg },
}

vscode.terminal = {
vscode_theme.terminal = {
a = { fg = vim.o.background == 'dark' and colors.bg or colors.fg, bg = colors.green, gui = 'bold' },
b = { fg = colors.fg, bg = config.opts.transparent and 'NONE' or colors.bg2 },
c = { fg = colors.fg, bg = config.opts.transparent and 'NONE' or colors.bg },
}

vscode.command = {
vscode_theme.command = {
a = { fg = vim.o.background == 'dark' and colors.bg or colors.fg, bg = colors.pink, gui = 'bold' },
b = { fg = colors.pink, bg = config.opts.transparent and 'NONE' or colors.bg2 },
c = { fg = colors.fg, bg = config.opts.transparent and 'NONE' or colors.bg },
}

return vscode
return vscode_theme
2 changes: 1 addition & 1 deletion lua/vscode/colors.lua → lua/vscode-theme/colors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ colors.get_colors = function()
mycolors.vscPopupHighlightLightBlue = '#d7eafe'

-- Extend the colors with overrides passed by `color_overrides`
local config = require('vscode.config')
local config = require('vscode-theme.config')
if config.opts.color_overrides then
mycolors = vim.tbl_extend('force', mycolors, config.opts.color_overrides)
end
Expand Down
File renamed without changes.
18 changes: 9 additions & 9 deletions lua/vscode/init.lua → lua/vscode-theme/init.lua
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
-- vscode.nvim color scheme
-- Lua port of https://github.com/tomasiser/vim-code-dark
-- By http://github.com/mofiqul
local vscode = {}
local config = require('vscode.config')
local theme = require('vscode.theme')
local utils = require('vscode.utils')
local vscode_theme = {}
local config = require('vscode-theme.config')
local theme = require('vscode-theme.theme')
local utils = require('vscode-theme.utils')

-- Pass setup to config module
vscode.setup = config.setup
vscode_theme.setup = config.setup

-- Load colorscheme with a given or default style
---@param style? string
vscode.load = function(style)
vscode_theme.load = function(style)
vim.cmd('hi clear')
if vim.fn.exists('syntax_on') then
vim.cmd('syntax reset')
end

vim.o.termguicolors = true
vim.g.colors_name = 'vscode'
vim.g.colors_name = 'vscode-theme'
if config.opts.terminal_colors then
utils.terminal(require('vscode.colors').get_colors())
utils.terminal(require('vscode-theme.colors').get_colors())
end

local background = style or config.opts.style
Expand All @@ -39,4 +39,4 @@ vscode.load = function(style)
end
end

return vscode
return vscode_theme
2 changes: 1 addition & 1 deletion lua/vscode/theme.lua → lua/vscode-theme/theme.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local hl = vim.api.nvim_set_hl
local theme = {}

theme.set_highlights = function(opts)
local c = require('vscode.colors').get_colors()
local c = require('vscode-theme.colors').get_colors()
local isDark = vim.o.background == 'dark'

hl(0, 'Normal', { fg = c.vscFront, bg = c.vscBack })
Expand Down
File renamed without changes.