diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2022-10-29 12:15:16 +0200 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2022-10-29 12:15:16 +0200 |
commit | dec91c292e4c94b30ab3e749ef5464ee165f9e8b (patch) | |
tree | 0a5be9c1c3e4247fa8e4d3470deafd7c809f6917 /lua | |
parent | 3234b296d7f70cc78ac37a51fc3cff28e7871812 (diff) |
Update loading of colorscheme
Diffstat (limited to 'lua')
-rw-r--r-- | lua/no-clown-fiesta/highlight-group/treesitter.lua | 14 | ||||
-rw-r--r-- | lua/no-clown-fiesta/highlights.lua | 19 | ||||
-rw-r--r-- | lua/no-clown-fiesta/init.lua | 15 | ||||
-rw-r--r-- | lua/no-clown-fiesta/palette.lua | 1 | ||||
-rw-r--r-- | lua/no-clown-fiesta/settings.lua | 23 |
5 files changed, 42 insertions, 30 deletions
diff --git a/lua/no-clown-fiesta/highlight-group/treesitter.lua b/lua/no-clown-fiesta/highlight-group/treesitter.lua index 6d5f8c6..ad576f4 100644 --- a/lua/no-clown-fiesta/highlight-group/treesitter.lua +++ b/lua/no-clown-fiesta/highlight-group/treesitter.lua @@ -1,18 +1,18 @@ local M = {} -function M.highlight(palette, opts) +function M.highlight(palette, options) return { - ["@comment"] = { fg = palette.medium_gray, style = opts.comments }, + ["@comment"] = { fg = palette.medium_gray, style = options.comments }, ["@annotation"] = { fg = palette.white }, ["@attribute"] = { fg = palette.white }, ["@constructor"] = { fg = palette.cyan }, - ["@type"] = { fg = palette.white, style = opts.type }, + ["@type"] = { fg = palette.white, style = options.type }, ["@type.builtin"] = { fg = palette.white }, ["@conditional"] = { fg = palette.gray_blue }, ["@exception"] = { fg = palette.red }, ["@include"] = { fg = palette.red }, - ["@keyword"] = { fg = palette.gray_blue, style = opts.keywords }, - ["@keyword.function"] = { fg = palette.gray_blue, style = opts.keywords }, + ["@keyword"] = { fg = palette.gray_blue, style = options.keywords }, + ["@keyword.function"] = { fg = palette.gray_blue, style = options.keywords }, ["@label"] = { fg = palette.white }, ["@namespace"] = { fg = palette.white }, ["@repeat"] = { fg = palette.gray_blue }, @@ -23,12 +23,12 @@ function M.highlight(palette, opts) ["@boolean"] = { fg = palette.red }, ["@character"] = { fg = palette.light_green }, ["@error"] = { fg = palette.error_red }, - ["@function"] = { fg = palette.cyan, style = opts.functions }, + ["@function"] = { fg = palette.cyan, style = options.functions }, ["@function.builtin"] = { fg = palette.cyan }, ["@method"] = { fg = palette.cyan }, ["@const.macro"] = { fg = palette.cyan }, ["@function.macro"] = { fg = palette.cyan }, - ["@variable"] = { fg = palette.white, style = opts.variables }, + ["@variable"] = { fg = palette.white, style = options.variables }, ["@variable.builtin"] = { fg = palette.white }, ["@property"] = { fg = palette.white }, ["@operator"] = { fg = palette.white }, diff --git a/lua/no-clown-fiesta/highlights.lua b/lua/no-clown-fiesta/highlights.lua index 5ebbc45..4a26b51 100644 --- a/lua/no-clown-fiesta/highlights.lua +++ b/lua/no-clown-fiesta/highlights.lua @@ -1,8 +1,11 @@ local M = {} -function M.highlight(palette, opts) +function M.highlight(palette, options) return { - Normal = { fg = palette.fg, bg = opts.transparent_background }, + Normal = { + fg = palette.fg, + bg = options.transparent and palette.none or palette.bg, + }, SignColumn = { bg = palette.bg }, MsgArea = { fg = palette.fg, bg = palette.bg }, ModeMsg = { fg = palette.fg, bg = palette.bg }, @@ -16,7 +19,7 @@ function M.highlight(palette, opts) PmenuSel = { fg = palette.blue, bg = palette.alt_bg }, WildMenu = { fg = palette.blue, bg = palette.alt_bg }, CursorLineNr = { fg = palette.light_gray, style = "bold" }, - Comment = { fg = palette.medium_gray, style = opts.comments }, + Comment = { fg = palette.medium_gray, style = options.comments }, Folded = { fg = palette.light_gray, bg = palette.alt_bg }, FoldColumn = { fg = palette.light_gray, bg = palette.alt_bg }, LineNr = { fg = palette.gray }, @@ -60,7 +63,7 @@ function M.highlight(palette, opts) Question = { fg = palette.cyan }, EndOfBuffer = { fg = palette.bg }, NonText = { fg = palette.bg }, - Variable = { fg = palette.white, style = opts.variables }, + Variable = { fg = palette.white, style = options.variables }, String = { fg = palette.medium_gray_blue }, Character = { fg = palette.light_green }, Constant = { fg = palette.white }, @@ -68,13 +71,13 @@ function M.highlight(palette, opts) Boolean = { fg = palette.red }, Float = { fg = palette.red }, Identifier = { fg = palette.white }, - Function = { fg = palette.cyan, style = opts.functions }, + Function = { fg = palette.cyan, style = options.functions }, Operator = { fg = palette.white }, - Type = { fg = palette.white, style = opts.type }, + Type = { fg = palette.white, style = options.type }, StorageClass = { fg = palette.gray_blue }, Structure = { fg = palette.gray_blue }, Typedef = { fg = palette.white }, - Keyword = { fg = palette.gray_blue, style = opts.keywords }, + Keyword = { fg = palette.gray_blue, style = options.keywords }, Statement = { fg = palette.gray_blue }, Conditional = { fg = palette.gray_blue }, Repeat = { fg = palette.gray_blue }, @@ -90,7 +93,7 @@ function M.highlight(palette, opts) Tag = { fg = palette.pale_purple }, Debug = { fg = palette.red }, Delimiter = { fg = palette.white }, - SpecialComment = { fg = palette.medium_gray, style = opts.comments }, + SpecialComment = { fg = palette.medium_gray, style = options.comments }, Underlined = { style = "underline" }, Bold = { style = "bold" }, Italic = { style = "italic" }, diff --git a/lua/no-clown-fiesta/init.lua b/lua/no-clown-fiesta/init.lua index 170a4d2..1cfc291 100644 --- a/lua/no-clown-fiesta/init.lua +++ b/lua/no-clown-fiesta/init.lua @@ -1,10 +1,15 @@ local M = {} -function M.setup(opts) +function M.setup(options) local settings = require "no-clown-fiesta.settings" - if opts then - opts = settings.set(opts) + if options then + settings.set(options) end +end + +function M.load() + local settings = require "no-clown-fiesta.settings" + local options = settings.options vim.api.nvim_command "hi clear" if vim.fn.exists "syntax_on" then @@ -17,7 +22,7 @@ function M.setup(opts) local util = require "no-clown-fiesta.util" local palette = require "no-clown-fiesta.palette" - local highlights = require("no-clown-fiesta.highlights").highlight(palette, opts) + local highlights = require("no-clown-fiesta.highlights").highlight(palette, options) local alpha = require("no-clown-fiesta.highlight-group.alpha").highlight(palette) local git = require("no-clown-fiesta.highlight-group.git").highlight(palette) @@ -40,7 +45,7 @@ function M.setup(opts) ) local treesitter = require("no-clown-fiesta.highlight-group.treesitter").highlight( palette, - opts + options ) local whichkey = require("no-clown-fiesta.highlight-group.whichkey").highlight( palette diff --git a/lua/no-clown-fiesta/palette.lua b/lua/no-clown-fiesta/palette.lua index 911c7e5..246785e 100644 --- a/lua/no-clown-fiesta/palette.lua +++ b/lua/no-clown-fiesta/palette.lua @@ -1,4 +1,5 @@ local colors = { + none = "NONE", fg = "#E1E1E1", bg = "#151515", alt_bg = "#171717", diff --git a/lua/no-clown-fiesta/settings.lua b/lua/no-clown-fiesta/settings.lua index e41380c..a289600 100644 --- a/lua/no-clown-fiesta/settings.lua +++ b/lua/no-clown-fiesta/settings.lua @@ -1,17 +1,20 @@ local M = {} -local palette = require "no-clown-fiesta.palette" -local default = { - transparent_background = palette.bg, - comments = "NONE", - keywords = "NONE", - functions = "NONE", - variables = "NONE", - type = "NONE", +local DEFAULT = { + transparent = false, + styles = { + comments = {}, + keywords = {}, + functions = {}, + variables = {}, + type = { bold = true }, + }, } -function M.set(opts) - return vim.tbl_extend("force", default, opts) +M.options = {} + +function M.setup(options) + M.options = vim.tbl_extend("force", DEFAULT, options) end return M |