From ee8d34c0f7fbefcefd953727d602247d2a8ba6dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Pankowski?= Date: Wed, 6 Dec 2023 06:23:55 +0100 Subject: [PATCH] add setup function --- colors/lupan.lua | 4 +- lua/lupancolors/lupan.lua | 85 +++++++--------------------------- lua/lupancolors/lupandark.lua | 73 +++++++++++++++++++++++++++++ lua/lupancolors/lupanlight.lua | 8 ++-- 4 files changed, 97 insertions(+), 73 deletions(-) create mode 100644 lua/lupancolors/lupandark.lua diff --git a/colors/lupan.lua b/colors/lupan.lua index b9d58fb..179ffcc 100644 --- a/colors/lupan.lua +++ b/colors/lupan.lua @@ -1,7 +1,7 @@ vim.g.colors_name = 'lupan' if vim.o.background == "dark" then - package.loaded["lupancolors.lupan"] = nil - require("lush")(require("lupancolors.lupan")) + package.loaded["lupancolors.lupandark"] = nil + require("lush")(require("lupancolors.lupandark")) else package.loaded["lupancolors.lupanlight"] = nil require("lush")(require("lupancolors.lupanlight")) diff --git a/lua/lupancolors/lupan.lua b/lua/lupancolors/lupan.lua index 554c9a5..c692fd0 100644 --- a/lua/lupancolors/lupan.lua +++ b/lua/lupancolors/lupan.lua @@ -1,72 +1,23 @@ local lush = require('lush') -local hsl = lush.hsl -- We'll use hsl a lot so its nice to bind it separately +local hsl = lush.hsl ----@diagnostic disable: undefined-global -local theme = lush(function() - local base = hsl(210, 40, 75) - local red = base.hue(0) - local orange = base.hue(30) - local yellow = base.hue(60) - local yellow_green = base.hue(90) - local green = base.hue(120) - local aquamarine = base.hue(150) - local cyan = base.hue(180) - local blue = base.hue(210) - local lavender = base.hue(240) - local purple = base.hue(270) - local fuchsia = base.hue(300) - local hot_pink = base.hue(330) - return { - -- See: h highlight-groups - Normal { bg = base.de(65).da(75), fg = base.de(25) }, - CursorLine { bg = Normal.bg.li(10) }, - Visual { bg = Normal.bg.sa(20).li(20) }, - Comment { fg = base.de(75).da(20) }, - CursorColumn { CursorLine }, - LineNr { Comment, gui = "italic" }, - CursorLineNr { fg = blue, bg = CursorLine.bg, gui = "italic" }, - Search { bg = yellow, fg = Normal.bg }, - IncSearch { bg = yellow_green, fg = Normal.bg }, - String { fg = blue }, - PreProc { fg = lavender }, - Statement { fg = orange }, - Type { fg = yellow }, - Identifier { fg = Normal.fg }, - Function { fg = green }, - Operator { fg = aquamarine }, - Special { fg = purple }, - Constant { fg = cyan }, - NonText { fg = Normal.bg.li(10) }, - DiffAdd { fg = green }, - DiffDelete { fg = red }, - diffRemoved { fg = red }, - DiffChange { fg = blue }, - diffChanged { fg = blue }, - SignColumn { Normal }, - diffAdded { DiffAdd }, - MoreMsg { fg = green, gui = "bold" }, - Question { fg = green, gui = "bold" }, - TelescopeSelection { CursorLine }, - WhichKeyFloat { bg = Normal.bg.li(15) }, - DiagnosticError { fg = red }, - DiagnosticWarn { fg = orange }, - DiagnosticInfo { fg = cyan }, - Pmenu { bg = Normal.bg.li(20) }, - PmenuSel { bg = Normal.bg.li(25).sa(20) }, - Error { bg = red.da(25), fg = Normal.bg }, - ErrorMsg { Error }, - MatchParen { fg = hot_pink, gui = "bold" }, - SpecialKey { fg = red }, - Directory { fg = cyan }, - Title { fg = fuchsia, gui = "bold" }, - Conceal { bg = blue.da(40).de(50) }, - SpellBad { fg = red, gui = "underline" }, - SpellRare { fg = Type.fg, gui = "underline" }, - SpellLocal { fg = DiagnosticInfo.fg, gui = "underline" }, - SpellCap { fg = String.fg, gui = "underline" }, +local M = {} + +local default = { + dark = { + base = hsl(210, 40, 75), + }, + light = { + base = hsl(210, 50, 35), } -end) +} -return theme +function M.setup(options) + if options then + M.options = options + else + M.options = default + end +end --- vi:nowrap:number +return M diff --git a/lua/lupancolors/lupandark.lua b/lua/lupancolors/lupandark.lua new file mode 100644 index 0000000..9135c25 --- /dev/null +++ b/lua/lupancolors/lupandark.lua @@ -0,0 +1,73 @@ +local lush = require('lush') +local hsl = lush.hsl + +local base = require('lupancolors.lupan').options.dark.base + +---@diagnostic disable: undefined-global +local theme = lush(function() + local red = base.hue(0) + local orange = base.hue(30) + local yellow = base.hue(60) + local yellow_green = base.hue(90) + local green = base.hue(120) + local aquamarine = base.hue(150) + local cyan = base.hue(180) + local blue = base.hue(210) + local lavender = base.hue(240) + local purple = base.hue(270) + local fuchsia = base.hue(300) + local hot_pink = base.hue(330) + return { + -- See: h highlight-groups + Normal { bg = base.de(65).da(75), fg = base.de(25) }, + CursorLine { bg = Normal.bg.li(10) }, + Visual { bg = Normal.bg.sa(20).li(20) }, + Comment { fg = base.de(75).da(20) }, + CursorColumn { CursorLine }, + LineNr { Comment, gui = "italic" }, + CursorLineNr { fg = blue, bg = CursorLine.bg, gui = "italic" }, + Search { bg = yellow, fg = Normal.bg }, + IncSearch { bg = yellow_green, fg = Normal.bg }, + String { fg = blue }, + PreProc { fg = lavender }, + Statement { fg = orange }, + Type { fg = yellow }, + Identifier { fg = Normal.fg }, + Function { fg = green }, + Operator { fg = aquamarine }, + Special { fg = purple }, + Constant { fg = cyan }, + NonText { fg = Normal.bg.li(10) }, + DiffAdd { fg = green }, + DiffDelete { fg = red }, + diffRemoved { fg = red }, + DiffChange { fg = blue }, + diffChanged { fg = blue }, + SignColumn { Normal }, + diffAdded { DiffAdd }, + MoreMsg { fg = green, gui = "bold" }, + Question { fg = green, gui = "bold" }, + TelescopeSelection { CursorLine }, + WhichKeyFloat { bg = Normal.bg.li(15) }, + DiagnosticError { fg = red }, + DiagnosticWarn { fg = orange }, + DiagnosticInfo { fg = cyan }, + Pmenu { bg = Normal.bg.li(20) }, + PmenuSel { bg = Normal.bg.li(25).sa(20) }, + Error { bg = red.da(25), fg = Normal.bg }, + ErrorMsg { Error }, + MatchParen { fg = hot_pink, gui = "bold" }, + SpecialKey { fg = red }, + Directory { fg = cyan }, + Title { fg = fuchsia, gui = "bold" }, + Conceal { bg = blue.da(40).de(50) }, + SpellBad { fg = red, gui = "underline" }, + SpellRare { fg = Type.fg, gui = "underline" }, + SpellLocal { fg = DiagnosticInfo.fg, gui = "underline" }, + SpellCap { fg = String.fg, gui = "underline" }, + } +end) + +return theme + +-- vi:nowrap:number diff --git a/lua/lupancolors/lupanlight.lua b/lua/lupancolors/lupanlight.lua index 4c6a9e9..ca04c0b 100644 --- a/lua/lupancolors/lupanlight.lua +++ b/lua/lupancolors/lupanlight.lua @@ -1,9 +1,10 @@ local lush = require('lush') -local hsl = lush.hsl -- We'll use hsl a lot so its nice to bind it separately +local hsl = lush.hsl + +local base = require('lupancolors.lupan').options.light.base ---@diagnostic disable: undefined-global local theme = lush(function() - local base = hsl(210, 50, 35) local red = base.hue(0) local orange = base.hue(30) local yellow = base.hue(60) @@ -18,7 +19,7 @@ local theme = lush(function() local hot_pink = base.hue(330) return { -- See: h highlight-groups - Normal { bg = base.de(70).li(90), fg = base.de(25) }, + Normal { bg = base.de(70).li(90), fg = base.de(75) }, CursorLine { bg = Normal.bg.da(4) }, Visual { bg = base.de(55).li(65) }, Comment { fg = base.de(60).li(20) }, @@ -67,7 +68,6 @@ local theme = lush(function() } end) - return theme -- vi:nowrap:number