feat: configurable brightness of the Day style

This commit is contained in:
Folke Lemaitre
2021-05-19 08:49:33 +02:00
parent 48b2bee03c
commit 6be063284b
4 changed files with 6 additions and 2 deletions

View File

@@ -48,6 +48,7 @@ function M.setup(config)
colors.bg = "#1a1b26"
end
util.bg = colors.bg
util.day_brightness = config.dayBrightness
colors.diff = {
add = util.darken(colors.green2, 0.15),

View File

@@ -17,6 +17,7 @@ end
config = {
style = opt("style", "storm"),
dayBrightness = opt("day_brightness", 0.3),
transparent = opt("transparent", false),
commentStyle = opt("italic_comments", true) and "italic" or "NONE",
keywordStyle = opt("italic_keywords", true) and "italic" or "NONE",

View File

@@ -7,6 +7,7 @@ util.colorCache = {}
util.bg = "#000000"
util.fg = "#ffffff"
util.day_brightness = 0.3
local function hexToRgb(hex_str)
local hex = "[abcdef0-9][abcdef0-9]"
@@ -56,7 +57,7 @@ function util.invertColor(color)
local hsl = hsluv.hex_to_hsluv(color)
hsl[3] = 100 - hsl[3]
if hsl[3] < 40 then
hsl[3] = hsl[3] + (100 - hsl[3]) * 0.3
hsl[3] = hsl[3] + (100 - hsl[3]) * util.day_brightness
end
return hsluv.hsluv_to_hex(hsl)
end