diff --git a/lua/tokyonight/colors.lua b/lua/tokyonight/colors.lua index 8c8f87e..107aedf 100644 --- a/lua/tokyonight/colors.lua +++ b/lua/tokyonight/colors.lua @@ -44,6 +44,12 @@ function M.setup(config) } 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 colors.git.ignore = colors.dark3 colors.black = util.darken(colors.bg, 0.8, "#000000") diff --git a/lua/tokyonight/theme.lua b/lua/tokyonight/theme.lua index be12a3a..e35401f 100644 --- a/lua/tokyonight/theme.lua +++ b/lua/tokyonight/theme.lua @@ -18,9 +18,9 @@ function M.setup(config) Comment = { fg = c.comment, style = config.commentStyle }, -- any comment 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') - Cursor = { style = "reverse" }, -- character under the cursor - lCursor = { style = "reverse" }, -- the character under the cursor when |language-mapping| is used (see 'guicursor') - CursorIM = { style = "reverse" }, -- like Cursor, but used when in IME mode |CursorIM| + Cursor = { fg = c.bg, bg = c.fg }, -- character under the cursor + lCursor = { fg = c.bg, bg = c.fg }, -- the character under the cursor when |language-mapping| is used (see 'guicursor') + 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. 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) @@ -260,14 +260,14 @@ function M.setup(config) NeogitDiffAddHighlight = { fg = c.git.add, bg = c.diff.add }, -- GitGutter - GitGutterAdd = { fg = c.diff.add }, -- diff mode: Added line |diff.txt| - GitGutterChange = { fg = c.diff.change }, -- diff mode: Changed line |diff.txt| - GitGutterDelete = { fg = c.diff.delete }, -- diff mode: Deleted line |diff.txt| + GitGutterAdd = { fg = c.gitSigns.add }, -- diff mode: Added line |diff.txt| + GitGutterChange = { fg = c.gitSigns.change }, -- diff mode: Changed line |diff.txt| + GitGutterDelete = { fg = c.gitSigns.delete }, -- diff mode: Deleted line |diff.txt| -- GitSigns - GitSignsAdd = { fg = c.diff.add }, -- diff mode: Added line |diff.txt| - GitSignsChange = { fg = c.diff.change }, -- diff mode: Changed line |diff.txt| - GitSignsDelete = { fg = c.diff.delete }, -- diff mode: Deleted line |diff.txt| + GitSignsAdd = { fg = c.gitSigns.add }, -- diff mode: Added line |diff.txt| + GitSignsChange = { fg = c.gitSigns.change }, -- diff mode: Changed line |diff.txt| + GitSignsDelete = { fg = c.gitSigns.delete }, -- diff mode: Deleted line |diff.txt| -- Telescope TelescopeBorder = { fg = c.border_highlight }, diff --git a/lua/tokyonight/util.lua b/lua/tokyonight/util.lua index 68fe304..0507ee8 100644 --- a/lua/tokyonight/util.lua +++ b/lua/tokyonight/util.lua @@ -1,3 +1,5 @@ +local hsluv = require("tokyonight.hsluv") + local util = {} 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.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) - local hsluv = require("tokyonight.hsluv") if color ~= "NONE" then - local hsl = hsluv.hex_to_hsluv(color) - hsl[3] = 100 - hsl[3] - if hsl[3] < 40 then hsl[3] = hsl[3] + (100 - hsl[3]) * .3 end - return hsluv.hsluv_to_hex(hsl) + if color ~= "NONE" then + local hsl = hsluv.hex_to_hsluv(color) + hsl[3] = 100 - hsl[3] + if hsl[3] < 40 then hsl[3] = hsl[3] + (100 - hsl[3]) * .3 end + return hsluv.hsluv_to_hex(hsl) + end end return color end