feat: slighlty increase git signs brightness and make them configurable

This commit is contained in:
Folke Lemaitre
2021-04-25 11:42:59 +02:00
parent 07bcc91274
commit 49b3b90798
3 changed files with 31 additions and 14 deletions

View File

@@ -44,6 +44,12 @@ function M.setup(config)
} }
if config.style == "night" or config.style == "day" then colors.bg = "#1a1b26" end if config.style == "night" or config.style == "day" then colors.bg = "#1a1b26" end
colors.gitSigns = {
add = util.brighten(colors.diff.add, .2),
change = util.brighten(colors.diff.change, .2),
delete = util.brighten(colors.diff.delete, .2),
}
util.bg = colors.bg util.bg = colors.bg
colors.git.ignore = colors.dark3 colors.git.ignore = colors.dark3
colors.black = util.darken(colors.bg, 0.8, "#000000") colors.black = util.darken(colors.bg, 0.8, "#000000")

View File

@@ -18,9 +18,9 @@ function M.setup(config)
Comment = { fg = c.comment, style = config.commentStyle }, -- any comment Comment = { fg = c.comment, style = config.commentStyle }, -- any comment
ColorColumn = { bg = c.bg_visual }, -- used for the columns set with 'colorcolumn' ColorColumn = { bg = c.bg_visual }, -- used for the columns set with 'colorcolumn'
Conceal = { fg = c.fg_gutter }, -- placeholder characters substituted for concealed text (see 'conceallevel') Conceal = { fg = c.fg_gutter }, -- placeholder characters substituted for concealed text (see 'conceallevel')
Cursor = { style = "reverse" }, -- character under the cursor Cursor = { fg = c.bg, bg = c.fg }, -- character under the cursor
lCursor = { style = "reverse" }, -- the character under the cursor when |language-mapping| is used (see 'guicursor') lCursor = { fg = c.bg, bg = c.fg }, -- the character under the cursor when |language-mapping| is used (see 'guicursor')
CursorIM = { style = "reverse" }, -- like Cursor, but used when in IME mode |CursorIM| CursorIM = { fg = c.bg, bg = c.fg }, -- like Cursor, but used when in IME mode |CursorIM|
CursorColumn = { bg = c.bg_highlight }, -- Screen-column at the cursor, when 'cursorcolumn' is set. CursorColumn = { bg = c.bg_highlight }, -- Screen-column at the cursor, when 'cursorcolumn' is set.
CursorLine = { bg = c.bg_highlight }, -- Screen-line at the cursor, when 'cursorline' is set. Low-priority if foreground (ctermfg OR guifg) is not set. CursorLine = { bg = c.bg_highlight }, -- Screen-line at the cursor, when 'cursorline' is set. Low-priority if foreground (ctermfg OR guifg) is not set.
Directory = { fg = c.blue }, -- directory names (and other special names in listings) Directory = { fg = c.blue }, -- directory names (and other special names in listings)
@@ -260,14 +260,14 @@ function M.setup(config)
NeogitDiffAddHighlight = { fg = c.git.add, bg = c.diff.add }, NeogitDiffAddHighlight = { fg = c.git.add, bg = c.diff.add },
-- GitGutter -- GitGutter
GitGutterAdd = { fg = c.diff.add }, -- diff mode: Added line |diff.txt| GitGutterAdd = { fg = c.gitSigns.add }, -- diff mode: Added line |diff.txt|
GitGutterChange = { fg = c.diff.change }, -- diff mode: Changed line |diff.txt| GitGutterChange = { fg = c.gitSigns.change }, -- diff mode: Changed line |diff.txt|
GitGutterDelete = { fg = c.diff.delete }, -- diff mode: Deleted line |diff.txt| GitGutterDelete = { fg = c.gitSigns.delete }, -- diff mode: Deleted line |diff.txt|
-- GitSigns -- GitSigns
GitSignsAdd = { fg = c.diff.add }, -- diff mode: Added line |diff.txt| GitSignsAdd = { fg = c.gitSigns.add }, -- diff mode: Added line |diff.txt|
GitSignsChange = { fg = c.diff.change }, -- diff mode: Changed line |diff.txt| GitSignsChange = { fg = c.gitSigns.change }, -- diff mode: Changed line |diff.txt|
GitSignsDelete = { fg = c.diff.delete }, -- diff mode: Deleted line |diff.txt| GitSignsDelete = { fg = c.gitSigns.delete }, -- diff mode: Deleted line |diff.txt|
-- Telescope -- Telescope
TelescopeBorder = { fg = c.border_highlight }, TelescopeBorder = { fg = c.border_highlight },

View File

@@ -1,3 +1,5 @@
local hsluv = require("tokyonight.hsluv")
local util = {} local util = {}
util.colorsUsed = {} util.colorsUsed = {}
@@ -35,13 +37,22 @@ end
function util.darken(hex, amount, bg) return util.blend(hex, bg or util.bg, math.abs(amount)) end function util.darken(hex, amount, bg) return util.blend(hex, bg or util.bg, math.abs(amount)) end
function util.lighten(hex, amount, fg) return util.blend(hex, fg or util.fg, math.abs(amount)) end function util.lighten(hex, amount, fg) return util.blend(hex, fg or util.fg, math.abs(amount)) end
function util.brighten(color, percentage)
local hsl = hsluv.hex_to_hsluv(color)
local larpSpace = 100 - hsl[3]
if percentage < 0 then larpSpace = hsl[3] end
hsl[3] = hsl[3] + larpSpace * percentage
return hsluv.hsluv_to_hex(hsl)
end
function util.getDayColor(color) function util.getDayColor(color)
local hsluv = require("tokyonight.hsluv")
if color ~= "NONE" then if color ~= "NONE" then
local hsl = hsluv.hex_to_hsluv(color) if color ~= "NONE" then
hsl[3] = 100 - hsl[3] local hsl = hsluv.hex_to_hsluv(color)
if hsl[3] < 40 then hsl[3] = hsl[3] + (100 - hsl[3]) * .3 end hsl[3] = 100 - hsl[3]
return hsluv.hsluv_to_hex(hsl) if hsl[3] < 40 then hsl[3] = hsl[3] + (100 - hsl[3]) * .3 end
return hsluv.hsluv_to_hex(hsl)
end
end end
return color return color
end end