From 39b165a8e5d79402c0c5dd865f0be0170e6266cc Mon Sep 17 00:00:00 2001 From: siduck76 Date: Sat, 5 Jun 2021 22:10:23 +0530 Subject: [PATCH] move bufferline highlights in different file --- init.lua | 2 +- lua/colors.lua | 118 +++++++++++++++++++++++++++++++++++++++++ lua/top-bufferline.lua | 71 ------------------------- 3 files changed, 119 insertions(+), 72 deletions(-) create mode 100644 lua/colors.lua diff --git a/init.lua b/init.lua index c222ef1..4a70073 100644 --- a/init.lua +++ b/init.lua @@ -24,7 +24,7 @@ cmd "syntax on" local base16 = require "base16" base16(base16.themes["onedark"], true) -require "custom_highlights" +require "colors" -- blankline diff --git a/lua/colors.lua b/lua/colors.lua new file mode 100644 index 0000000..b3cd92b --- /dev/null +++ b/lua/colors.lua @@ -0,0 +1,118 @@ +local cmd = vim.cmd +-- blankline + +cmd "hi IndentBlanklineChar guifg=#282c34" + +-- misc -- +cmd "hi LineNr guifg=#42464e" +cmd "hi Comment guifg=#42464e" +cmd "hi NvimInternalError guifg=#f9929b" +cmd "hi VertSplit guifg=#2a2e36" +cmd "hi EndOfBuffer guifg=#1e222a" + +-- Pmenu +cmd "hi PmenuSel guibg=#98c379" +cmd "hi Pmenu guibg=#282c34" +cmd "hi PmenuSbar guibg =#353b45" +cmd "hi PmenuThumb guibg =#81A1C1" + +-- inactive statuslines as thin splitlines +cmd("highlight! StatusLineNC gui=underline guifg=#383c44") + +-- line n.o +cmd "hi clear CursorLine" +cmd "hi cursorlinenr guifg=#abb2bf" + +-- git signs --- +cmd "hi DiffAdd guifg=#81A1C1 guibg = none" +cmd "hi DiffChange guifg =#3A3E44 guibg = none" +cmd "hi DiffModified guifg = #81A1C1 guibg = none" + +-- NvimTree +cmd "hi NvimTreeFolderIcon guifg = #61afef" +cmd "hi NvimTreeFolderName guifg = #61afef" +cmd "hi NvimTreeIndentMarker guifg=#383c44" +cmd "hi NvimTreeNormal guibg=#1b1f27" +cmd "hi NvimTreeVertSplit guifg=#1e222a" +cmd "hi NvimTreeRootFolder guifg=#1b1f27" + +-- telescope +cmd "hi TelescopeBorder guifg=#2a2e36" +cmd "hi TelescopePromptBorder guifg=#2a2e36" +cmd "hi TelescopeResultsBorder guifg=#2a2e36" +cmd "hi TelescopePreviewBorder guifg=#525865" + +-- LspDiagnostics --- + +-- error / warnings +cmd "hi LspDiagnosticsSignError guifg=#f9929b" +cmd "hi LspDiagnosticsVirtualTextError guifg=#BF616A" +cmd "hi LspDiagnosticsSignWarning guifg=#EBCB8B" +cmd "hi LspDiagnosticsVirtualTextWarning guifg=#EBCB8B" + +-- info +cmd "hi LspDiagnosticsSignInformation guifg=#A3BE8C" +cmd "hi LspDiagnosticsVirtualTextInformation guifg=#A3BE8C" + +-- hint +cmd "hi LspDiagnosticsSignHint guifg=#b6bdca" +cmd "hi LspDiagnosticsVirtualTextHint guifg=#b6bdca" + +-- bufferline + +local function add_hi(item, fg, bg) + local buf_hi = "hi BufferLine" .. item .. " guifg=" .. fg .. " guibg=" .. bg + + if item == "BufferSelected" then + vim.cmd(buf_hi .. " gui=bold") + else + vim.cmd(buf_hi) + end +end + +local function bufferline_colors() + -- colors --- + local fg = "#565c64" + local bg = "#252931" + + -- active buffer + local darkerBg = "#1e222a" -- nvim's bg + local activeBuffer_fg = "#c8ccd4" + + -- unfocused opened buffer + + local grey_dark = "#9298a0" + + -- tabs + local bg2 = "#30343c" -- should be lighter than bg + local red = "#d47d85" + + -- modified buffers + local green = "#A3BE8C" + + add_hi("Background", fg, bg) + add_hi("Fill", fg, bg) + + add_hi("BufferSelected", activeBuffer_fg, darkerBg) + add_hi("BufferVisible", grey_dark, bg) + + add_hi("Tab", grey_dark, bg2) + add_hi("TabSelected", bg, "#81A1C1") + add_hi("TabClose", red, bg) + + -- making separates transparent + + add_hi("Indicator", bg, bg) + add_hi("IndicatorSelected", bg, bg) + + add_hi("Separator", bg, bg) + add_hi("SeparatorVisible", bg, bg) + add_hi("SeparatorSelected", darkerBg, darkerBg) + + -- modified buffers + add_hi("Modified", red, bg) + add_hi("ModifiedVisible", red, bg) + add_hi("ModifiedSelected", green, darkerBg) +end + +bufferline_colors() diff --git a/lua/top-bufferline.lua b/lua/top-bufferline.lua index ab7de42..b61f888 100644 --- a/lua/top-bufferline.lua +++ b/lua/top-bufferline.lua @@ -1,8 +1,3 @@ --- define some colors - -local bar_fg = "#565c64" -local activeBuffer_fg = "#c8ccd4" - require "bufferline".setup { options = { offsets = {{filetype = "NvimTree", text = ""}}, @@ -20,72 +15,6 @@ require "bufferline".setup { show_buffer_close_icons = true, separator_style = "thin", mappings = "true" - }, - - -- bar colors!! - highlights = { - fill = { - guifg = bar_fg, - guibg = "#252931" - }, - background = { - guifg = bar_fg, - guibg = "#252931" - }, - - -- buffer - buffer_selected = { - guifg = activeBuffer_fg, - guibg = "#1e222a", - gui = "bold" - }, - buffer_visible = { - guifg = "#9298a0", - guibg = "#252931" - }, - - -- tabs over right - tab = { - guifg = "#9298a0", - guibg = "#30343c" - }, - tab_selected = { - guifg = "#30343c", - guibg = "#9298a0" - }, - tab_close = { - guifg = "#d47d85", - guibg = "#252931" - }, - - -- buffer separators - separator = { - guifg = "#252931", - guibg = "#252931" - }, - separator_selected = { - guifg = "#1e222a", - guibg = "#1e222a" - }, - separator_visible = { - guifg = "#252931", - guibg = "#252931" - }, - - indicator_selected = { - guifg = "#252931", - guibg = "#252931" - }, - - -- modified files (but not saved) - modified_selected = { - guifg = "#A3BE8C", - guibg = "#1e222a" - }, - modified_visible = { - guifg = "#BF616A", - guibg = "#23272f" - } } }