Skip to content

Commit

Permalink
feat(treesitter): major syntax theme rework for better readability (#24)
Browse files Browse the repository at this point in the history
feat(treesitter)!: major syntax theme rework for better readability

Large rework on treesitter group with slight modifications to syntax
group and LSP module for much better readability. Still in early stages
may be some issues to fix later but mostly done.

Co-authored-by: A-Lamia <[email protected]>
  • Loading branch information
mehalter and A-Lamia authored Apr 11, 2023
1 parent d47d183 commit 90ea2ed
Show file tree
Hide file tree
Showing 3 changed files with 160 additions and 44 deletions.
3 changes: 3 additions & 0 deletions lua/astrotheme/groups/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ local function callback()
["@lsp.type.builtinType"] = { fg = C.yellow, bg = C.none },
["@lsp.type.keyword"] = { link = "Keyword" },
["@lsp.type.operator"] = { link = "Operator" },
["@lsp.type.parameter"] = { link = "@parameter" },
["@lsp.type.property"] = { link = "@property" },
["@lsp.type.variable"] = { link = "@lsp.type.variable" },
["@lsp.typemod.enumMember.defaultLibrary"] = { fg = C.cyan, bg = C.none },
["@lsp.typemod.function.defaultLibrary"] = { fg = C.cyan, bg = C.none },
["@lsp.typemod.function.global"] = { fg = C.cyan, bg = C.none },
Expand Down
195 changes: 154 additions & 41 deletions lua/astrotheme/groups/plugins/nvim-treesitter.lua
Original file line number Diff line number Diff line change
@@ -1,65 +1,178 @@
local function callback()
return {

-- misc
["@comment"] = { link = "Comment" },
["@define"] = { link = "Define" },
["@error"] = { link = "Error" },
["@operator"] = { link = "Operator" },
["@preproc"] = { link = "PreProc" },

-- data types
["@boolean"] = { link = "Boolean" },
["@number"] = { link = "Number" },
["@float"] = { link = "Float" },
["@string"] = { link = "String" },
["@string.escape"] = { fg = C.red },
["@string.regex"] = { link = "String" },
["@string.special"] = { link = "String" },
["@character"] = { link = "Character" },
["@character.special"] = { link = "SpecialChar" },

["@annotation"] = { fg = C.yellow },
["@attribute"] = { fg = C.red },
["@boolean"] = { fg = C.orange },
["@character"] = { fg = C.green },
["@conditional"] = { fg = C.purple },
["@constant"] = { fg = C.yellow },
["@constant.builtin"] = { fg = C.orange },
["@constant.macro"] = { fg = C.red },
["@constant.rust"] = { fg = C.cyan },

-- function
["@constructor"] = { fg = C.yellow },
["@error"] = { fg = C.red },
["@exception"] = { fg = C.purple },
["@field"] = { fg = C.red },
["@float"] = { fg = C.orange },
["@function"] = { fg = C.blue },
["@function.builtin"] = { fg = C.blue },
["@function"] = { link = "Function" },
["@function.builtin"] = { fg = C.cyan },
["@function.call"] = { link = "@function" },
["@function.macro"] = { fg = C.yellow },
["@function.macro.rust"] = { fg = C.orange },
["@include"] = { fg = C.purple },
["@method"] = { fg = C.cyan },
["@method.call"] = { link = "@method" },

-- identifiers
["@constant"] = { link = "Constant" },
["@constant.builtin"] = { fg = C.orange },
["@constant.macro"] = { fg = C.red },

["@namespace"] = { link = "Keyword" },
["@symbol"] = { link = "Special" },

["@variable"] = { link = "Identifier" },
["@variable.builtin"] = { fg = C.red },

["@property"] = { link = "@variable.builtin" },

-- keyword
["@conditional"] = { link = "Conditional" },
["@exception"] = { link = "Exception" },
["@include"] = { link = "Include" },

["@keyword"] = { link = "Keyword" },
["@keyword.export"] = { link = "Keyword" },
["@keyword.function"] = { link = "Keyword" },
["@keyword.function.rust"] = { fg = C.orange },
["@keyword.operator"] = { link = "Keyword" },
["@label"] = { fg = C.blue },
["@literal.markdown"] = { fg = C.green },
["@method"] = { fg = C.blue },
["@namespace"] = { link = "Keyword" },
["@namespace.rust"] = { fg = C.yellow },
["@none.markdown"] = { fg = C.text },
["@number"] = { fg = C.orange },
["@parameter"] = { fg = C.red },
["@keyword.return"] = { link = "Keyword" },

["@label"] = { link = "Label" },
["@parameter"] = { fg = C.orange },
["@parameter.reference"] = { fg = C.cyan },
["@property"] = { fg = C.yellow },

["@repeat"] = { link = "Repeat" },

-- punctuation
["@punctuation.bracket"] = { fg = C.text },
["@punctuation.delimiter"] = { fg = C.text },
["@punctuation.delimiter.markdown"] = { fg = C.text },
["@punctuation.special"] = { fg = C.text },
["@punctuation.special.markdown"] = { fg = C.red },
["@repeat"] = { fg = C.purple },
["@string"] = { fg = C.green },
["@string.escape"] = { fg = C.red },
["@string.regex"] = { fg = C.green },

-- tag
["@tag"] = { fg = C.red },
["@tag.attribute"] = { fg = C.cyan },
["@tag.delimiter"] = { fg = C.text },

-- semantic tokens
["@class"] = { fg = C.blue },
["@decorator"] = { fg = C.orange },
["@enum"] = { fg = C.cyan },
["@enumMember"] = { fg = C.orange },
["@event"] = { fg = C.orange },
["@interface"] = { fg = C.orange },
["@modifier"] = { fg = C.orange },
["@regexp"] = { fg = C.cyan },
["@struct"] = { fg = C.blue },
["@typeParameter"] = { fg = C.yellow },

-- text
["@text"] = { fg = C.text },
["@text.emphasis"] = { fg = C.purple, italic = true },
["@text.environment"] = { fg = C.orange },
["@text.environment.name"] = { fg = C.blue },
["@text.literal"] = { fg = C.text },
["@text.reference"] = { fg = C.yellow },
["@text.math"] = { fg = C.blue },
["@text.reference"] = { fg = C.yellow, bold = true },
["@text.strong"] = { fg = C.blue, bold = true },
["@text.title"] = { fg = C.text },
["@text.underline"] = { fg = C.text },
["@text.uri"] = { fg = C.green },
["@title.markdown"] = { fg = C.red },
["@type"] = { fg = C.blue },
["@type.builtin"] = { fg = C.blue },
["@type.qualifier.typescript"] = { link = "Keyword" },
["@text.strike"] = { fg = C.green, strikethrough = true },
["@text.title"] = { fg = C.text, bold = true },
["@text.underline"] = { link = "Underline" },
["@text.uri"] = { fg = C.green, italic = true, underline = true },

["@text.todo"] = { fg = C.base, bg = C.yellow },
["@text.todo.checked"] = { fg = C.green },
["@text.todo.danger"] = { fg = C.base, bg = C.red },
["@text.todo.note"] = { fg = C.base, bg = C.blue },
["@text.todo.unchecked"] = { fg = C.overlay1 },
["@text.todo.warning"] = { fg = C.base, bg = C.yellow },

["@text.diff.add"] = { link = "DiffAdded" },
["@text.diff.delete"] = { link = "DiffDelete" },

-- type
["@field"] = { fg = C.red },
["@storageclass"] = { link = "StorageClass" },

["@type"] = { link = "Type" },
["@type.builtin"] = { link = "@type" },
["@type.definition"] = { link = "@type" },
["@type.qualifier"] = { link = "@type" },

-----------------------
-- Language Specific --
-----------------------

-- cpp
["@property.cpp"] = { fg = C.orange },

-- css
["@number.css"] = { fg = C.cyan },
["@property.css"] = { fg = C.orange },
["@property.class.css"] = { fg = C.yellow },
["@property.id.css"] = { fg = C.blue },
["@string.plain.css"] = { fg = C.green },
["@type.tag.css"] = { fg = C.purple },
["@type.css"] = { fg = C.orange },

-- json
["@label.json"] = { fg = C.blue },

-- lua
["@constructor.lua"] = { fg = C.orange },
["@variable.lua"] = { link = "@variable" },

-- markdown
["@literal.markdown"] = { fg = C.green },
["@none.markdown"] = { fg = C.text },
["@punctuation.delimiter.markdown"] = { fg = C.text },
["@punctuation.special.markdown"] = { fg = C.red },
["@title.markdown"] = { fg = C.red, bold = true },

-- PHP
["@type.qualifier.php"] = { link = "Keyword" },
["@method.php"] = { link = "Function" },
["@method.call.php"] = { link = "Function" },

-- Ruby
["@symbol.ruby"] = { fg = C.orange },

-- rust
["@constant.rust"] = { fg = C.cyan },
["@function.macro.rust"] = { fg = C.orange },
["@keyword.function.rust"] = { fg = C.orange },
["@namespace.rust"] = { fg = C.yellow },
["@type.rust"] = { fg = C.yellow },
["@variable"] = { fg = C.red },
["@variable.builtin"] = { fg = C.yellow },

-- toml
["@property.toml"] = { fg = C.blue },

-- typescript
["@type.qualifier.typescript"] = { link = "Keyword" },

-- TSX (Typescript React)
["@constructor.tsx"] = { fg = C.lavender },
["@tag.attribute.tsx"] = { fg = C.purple, italic = true },

-- yaml
["@field.yaml"] = { fg = C.blue },
}
end

Expand Down
6 changes: 3 additions & 3 deletions lua/astrotheme/groups/syntax.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ local function callback()
Boolean = { fg = C.blue, bg = C.none }, -- a boolean constant: TRUE, false
Float = { fg = C.yellow, bg = C.none }, -- a floating point constant: 2.3e10
-- Identifier
Identifier = { fg = C.red, bg = C.none }, -- any variable name
Identifier = { fg = C.text, bg = C.none }, -- any variable name
Function = { fg = C.blue, bg = C.none }, -- function name (also: methods for classes)
-- Statement
Statement = { fg = C.purple, bg = C.none }, -- any statement
Conditional = { fg = C.light_purple, bg = C.none }, -- if, then, else, endif, switch, etc.
Conditional = { fg = C.purple, bg = C.none }, -- if, then, else, endif, switch, etc.
Repeat = { fg = C.purple, bg = C.none }, -- for, do, while, etc.
Label = { fg = C.blue, bg = C.none }, -- case, default, etc.
Operator = { fg = C.text, bg = C.none }, -- "sizeof", "+", "*", etc.
Expand All @@ -49,7 +49,7 @@ local function callback()
SpecialComment = { fg = C.subtext0, bg = C.none }, -- special things inside a comment
Debug = { fg = C.blue, bg = C.none }, -- debugging statements
-- Underlined
Underlined = { fg = C.cyan, bg = C.none }, -- text that stands out, HTML links
Underlined = { fg = C.cyan, bg = C.none, underline = true }, -- text that stands out, HTML links
-- Ignore
Ignore = { fg = C.none, bg = C.none }, -- left blank, hidden |hl-Ignore|
-- Error
Expand Down

0 comments on commit 90ea2ed

Please sign in to comment.