Skip to content

Commit

Permalink
fix(treesitter): update default color as typescript color
Browse files Browse the repository at this point in the history
  • Loading branch information
loctvl842 committed Jan 31, 2024
1 parent f3200bf commit e730188
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 28 deletions.
5 changes: 4 additions & 1 deletion lua/monokai-pro/theme/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ local function get_hl_group_tbl(colorscheme)
local hl_group_tbl = {}
hl_group_tbl = vim.tbl_deep_extend("force", hl_group_tbl, editor, syntax, semantic_tokens, extra)
for _, name in ipairs(PLUGINS) do
local config_ok, plugin = xpcall(require, function(...) Util.log("Failed to load highlight group: " .. name .. "\n" .. debug.traceback(...), "error")return ... end, "monokai-pro.theme.plugins." .. name)
local config_ok, plugin = xpcall(require, function(...)
Util.log("Failed to load highlight group: " .. name .. "\n" .. debug.traceback(...), "error")
return ...
end, "monokai-pro.theme.plugins." .. name)
if config_ok then
hl_group_tbl = vim.tbl_deep_extend("force", hl_group_tbl, plugin.setup(colorscheme, Config, Helper))
end
Expand Down
7 changes: 4 additions & 3 deletions lua/monokai-pro/theme/plugins/bufferline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ M.setup = function(c, config, hp)
local isBackgroundClear = vim.tbl_contains(config.background_clear, "bufferline")

local tabsBackground = isBackgroundClear and c.editor.background or c.editorGroupHeader.tabsBackground
local amt = 10
M.tab = vim.tbl_deep_extend("force", c.tab, isBackgroundClear and {
activeBackground = hp.lighten(c.tab.activeBackground, 10),
inactiveBackground = hp.lighten(c.tab.inactiveBackground, 10),
unfocusedActiveBackground = hp.lighten(c.tab.unfocusedActiveBackground, 10),
activeBackground = hp.lighten(c.tab.activeBackground, amt),
inactiveBackground = hp.lighten(c.tab.inactiveBackground, amt),
unfocusedActiveBackground = hp.lighten(c.tab.unfocusedActiveBackground, amt),
} or {})

---@param underline_type "fill" | "visible" | "selected"
Expand Down
55 changes: 31 additions & 24 deletions lua/monokai-pro/theme/plugins/nvim-treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,43 @@ local M = {}
M.setup = function(c, config, _)
local styles = config.styles
local spec = {
["@include"] = { fg = c.base.red }, -- `import`
["@variable"] = { fg = c.base.white },
["@punctuation.delimiter"] = { fg = c.base.dimmed2 }, -- `;`
["@punctuation.bracket"] = { fg = c.base.dimmed2 }, -- `(`
["@constructor"] = { fg = c.base.red }, -- `StrictMode` in `<React.StrictMode>`
["@tag.delimiter"] = { fg = c.base.dimmed2 }, -- `<`, `>` in `<div>`
["@operator"] = { fg = c.base.red }, -- `=`, `=>`
["@keyword"] = { fg = c.base.cyan, italic = styles.keyword.italic }, -- `const`, `export`, `default`
["@parameter"] = { fg = c.base.blue, italic = styles.parameter.italic },
["@string.documentation"] = { fg = c.base.dimmed3 },
["@type.builtin"] = { fg = c.base.cyan, italic = styles.type.italic },
["@_isinstance"] = { fg = c.base.green },

["@keyword.return"] = { fg = c.base.red },
---typescript
["@annotation"] = { fg = c.base.cyan, italic = styles.annotation.italic },
-- ["@attribute"] = { fg = c.base.cyan },
["@boolean"] = { fg = c.base.magenta },
["@constant.builtin"] = { fg = c.base.magenta },
["@constructor"] = { fg = c.base.red },
["@conditional"] = { fg = c.base.red },
["@field"] = { fg = c.base.red },
["@function"] = { fg = c.base.green },
["@function.method.call"] = { fg = c.base.green }, -- Can be `green` or `white`. `green` is better.
["@include"] = { fg = c.base.red },
["@keyword"] = { fg = c.base.red, italic = styles.keyword.italic }, -- `export`, `class`, `implements`, `const`
["@keyword.function"] = { fg = c.base.cyan, bold = true, italic = styles.keyword.italic },
["@keyword.import"] = { fg = c.base.red }, -- `import`
["@keyword.operator"] = { fg = c.base.red },
["@keyword.return"] = { fg = c.base.red },
["@method.call"] = { fg = c.base.green },
["@number"] = { fg = c.base.magenta },
["@operator"] = { fg = c.base.red }, -- `=`, `=>`
["@parameter"] = { fg = c.base.blue, italic = styles.parameter.italic },
["@property"] = { fg = c.base.white },
["@function"] = { fg = c.base.green },
["@constant.builtin"] = { fg = c.base.magenta },
["@punctuation.bracket"] = { fg = c.base.blue }, -- `(`
["@punctuation.delimiter"] = { fg = c.base.dimmed2 }, -- `;`
["@punctuation.special"] = { fg = c.base.red }, -- `?` (e.g. {name?: string})
["@repeat"] = { fg = c.base.red },
["@string.documentation"] = { fg = c.base.dimmed3 },
["@tag"] = { fg = c.base.red },
["@tag.attribute"] = { fg = c.base.cyan, italic = styles.tag_attribute.italic },
["@attribute"] = { fg = c.base.cyan },
["@conditional"] = { fg = c.base.red },
["@repeat"] = { fg = c.base.red },
["@keyword.function"] = { fg = c.base.cyan, bold = true, italic = styles.keyword.italic },
["@number"] = { fg = c.base.magenta },
["@boolean"] = { fg = c.base.magenta },
["@tag.delimiter"] = { fg = c.base.dimmed2 }, -- `<`, `>` in `<div>`
["@type"] = { fg = c.base.cyan }, -- All types, interfaces, class names
["@type.builtin"] = { fg = c.base.cyan, italic = styles.type.italic },
["@type.qualifier"] = { fg = c.base.red, italic = styles.type.italic },
["@annotation"] = { fg = c.base.cyan, italic = styles.annotation.italic },
["@field"] = { fg = c.base.red },
["@variable"] = { fg = c.base.white },
["@variable.builtin"] = { fg = c.base.dimmed1, italic = true },
["@variable.member"] = { fg = c.base.magenta }, -- class members
["@variable.parameter"] = { fg = c.base.blue, italic = true },
["@_isinstance"] = { fg = c.base.green },
-- scss
["@keyword.scss"] = { fg = c.base.red },
["@function.scss"] = { fg = c.base.cyan },
Expand Down

0 comments on commit e730188

Please sign in to comment.