Skip to content

Commit 5421df0

Browse files
authored
feat: add initial simple_syntax_colors option (#66)
feat: add initial simple_syntax_color option This decrease the amount of colors that are used for main parts of highlighting as some people find too many colors distracting
1 parent d9ac783 commit 5421df0

File tree

4 files changed

+39
-15
lines changed

4 files changed

+39
-15
lines changed

lua/astrotheme/groups/lsp.lua

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local function callback()
1+
local function callback(opts)
22
local error = C.ui.red
33
local hint = C.ui.cyan
44
local info = C.ui.blue
@@ -23,16 +23,31 @@ local function callback()
2323
["@lsp.type.keyword"] = { link = "Keyword" },
2424
["@lsp.type.operator"] = { link = "Operator" },
2525
["@lsp.type.parameter"] = { link = "@parameter" },
26-
["@lsp.type.property"] = { link = "@property" },
26+
-- ["@lsp.type.property"] = { link = "@property" },
2727
["@lsp.type.variable"] = { link = "@lsp.type.variable" },
28-
["@lsp.typemod.enumMember.defaultLibrary"] = { fg = C.syntax.cyan, bg = C.none },
29-
["@lsp.typemod.function.defaultLibrary"] = { fg = C.syntax.cyan, bg = C.none },
30-
["@lsp.typemod.function.global"] = { fg = C.syntax.cyan, bg = C.none },
31-
["@lsp.typemod.method.defaultLibrary"] = { fg = C.syntax.cyan, bg = C.none },
28+
["@lsp.typemod.enumMember.defaultLibrary"] = {
29+
fg = opts.simple_syntax_colors and C.syntax.blue or C.syntax.cyan,
30+
bg = C.none,
31+
},
32+
["@lsp.typemod.function.defaultLibrary"] = {
33+
fg = opts.simple_syntax_colors and C.syntax.blue or C.syntax.cyan,
34+
bg = C.none,
35+
},
36+
["@lsp.typemod.function.global"] = {
37+
fg = opts.simple_syntax_colors and C.syntax.blue or C.syntax.cyan,
38+
bg = C.none,
39+
},
40+
["@lsp.typemod.method.defaultLibrary"] = {
41+
fg = opts.simple_syntax_colors and C.syntax.blue or C.syntax.cyan,
42+
bg = C.none,
43+
},
3244
["@lsp.typemod.method.reference"] = { link = "Function" },
3345
["@lsp.typemod.method.trait"] = { link = "Function" },
3446
["@lsp.typemod.selfKeyword.defaultLibrary"] = { link = "Keyword" },
35-
["@lsp.typemod.variable.defaultLibrary"] = { fg = C.syntax.yellow, bg = C.none },
47+
["@lsp.typemod.variable.defaultLibrary"] = {
48+
fg = opts.simple_syntax_colors and C.syntax.cyan or C.syntax.yellow,
49+
bg = C.none,
50+
},
3651
["@lsp.typemod.variable.readonly"] = { link = "Constant" },
3752

3853
-- rust

lua/astrotheme/groups/plugins/nvim-treesitter.lua

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local function callback()
1+
local function callback(opts)
22
return {
33

44
-- misc
@@ -30,15 +30,18 @@ local function callback()
3030

3131
-- function
3232
["@function"] = { link = "Function" },
33-
["@function.builtin"] = { fg = C.syntax.cyan },
33+
["@function.builtin"] = { fg = opts.simple_syntax_colors and C.syntax.blue or C.syntax.cyan },
3434
["@function.call"] = { link = "@function" },
3535
["@function.macro"] = { fg = C.syntax.yellow },
3636

3737
["@method"] = { link = "@function" },
3838
["@method.call"] = { link = "@method" },
3939

4040
["@constructor"] = { link = "@function" },
41-
["@parameter"] = { fg = C.syntax.orange },
41+
["@parameter"] = {
42+
fg = opts.simple_syntax_colors and C.syntax.text or C.syntax.orange,
43+
-- underline = opts.simple_syntax_colors,
44+
},
4245

4346
-- keyword
4447
["@keyword"] = { link = "Keyword" },
@@ -65,12 +68,17 @@ local function callback()
6568

6669
["@storageclass"] = { link = "StorageClass" },
6770
["@attribute"] = { fg = C.syntax.yellow },
68-
["@field"] = { link = "@property" },
69-
["@property"] = { fg = C.syntax.red },
71+
["@field"] = {
72+
fg = opts.simple_syntax_colors and C.syntax.text or C.syntax.red,
73+
},
74+
["@property"] = { fg = opts.simple_syntax_colors and C.syntax.text or C.syntax.red },
7075

7176
-- identifiers
7277
["@variable"] = { link = "Identifier" },
73-
["@variable.builtin"] = { fg = C.syntax.cyan },
78+
["@variable.builtin"] = {
79+
fg = opts.simple_syntax_colors and C.syntax.text or C.syntax.cyan,
80+
bold = opts.simple_syntax_colors,
81+
},
7482

7583
["@constant"] = { link = "Constant" },
7684
["@constant.builtin"] = { link = "@constant" },

lua/astrotheme/groups/syntax.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ local function callback(opts)
1313
-- Comment
1414
Comment = { fg = C.syntax.comment, bg = C.none, italic = opts.italic_comments }, -- any comment
1515
-- Constant
16-
Constant = { fg = C.syntax.yellow, bg = C.none }, -- any constant
16+
Constant = { fg = opts.simple_syntax_colors and C.syntax.cyan or C.syntax.yellow, bg = C.none }, -- any constant
1717
String = { fg = C.syntax.green, bg = C.none }, -- a string constant: "this is a string"
1818
Character = { fg = C.syntax.green, bg = C.none }, -- a character constant: 'c', '\n'
1919
Number = { fg = C.syntax.orange, bg = C.none }, -- a number constant: 234, 0xff
@@ -27,7 +27,7 @@ local function callback(opts)
2727
Conditional = { fg = C.syntax.purple, bg = C.none }, -- if, then, else, endif, switch, etc.
2828
Repeat = { fg = C.syntax.purple, bg = C.none }, -- for, do, while, etc.
2929
Label = { fg = C.syntax.blue, bg = C.none }, -- case, default, etc.
30-
Operator = { fg = C.syntax.text, bg = C.none }, -- "sizeof", "+", "*", etc.
30+
Operator = { fg = opts.simple_syntax_colors and C.syntax.purple or C.syntax.text, bg = C.none }, -- "sizeof", "+", "*", etc.
3131
Keyword = { fg = C.syntax.purple, bg = C.none }, -- any other keyword
3232
Exception = { fg = C.syntax.purple, bg = C.none }, -- try, catch, throw
3333
-- Preproc

lua/astrotheme/lib/config.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ M.default = {
1212
popup = true,
1313
neotree = true,
1414
italic_comments = true,
15+
simple_syntax_colors = false,
1516
},
1617
background = {
1718
light = "astrolight",

0 commit comments

Comments
 (0)