Skip to content

Commit

Permalink
feat(extensions): extend neogit pallete and highlights (#153)
Browse files Browse the repository at this point in the history
* Provide custom palette directly to neogit

* Better highlights; Removed neogit.setup() call
  • Loading branch information
gldtn authored Dec 22, 2024
1 parent 7312900 commit 2ee87ea
Showing 1 changed file with 98 additions and 21 deletions.
119 changes: 98 additions & 21 deletions lua/cyberdream/extensions/neogit.lua
Original file line number Diff line number Diff line change
@@ -1,32 +1,109 @@
local M = {}
local util = require("cyberdream.util")

--- Get extension configuration
--- @param opts Config
--- @param t CyberdreamPalette
function M.get(opts, t)
opts = opts or {}
local p = {
-- redifined for further customization
bg = t.bg,
white = t.fg,
grey = t.grey,
cyan = t.cyan,
blue = t.blue,
pink = t.pink,
orange = t.orange,
yellow = t.yellow,
purple = t.purple,
magenta = t.magenta,
bg_solid = t.bg_solid,
-- blended colors
red = util.blend(t.bg_solid, t.red, 0.20),
green = util.blend(t.bg_solid, t.green, 0.20),
bg_red = util.blend(t.bg_solid, t.red, 0.65),
bg_green = util.blend(t.bg_solid, t.green, 0.65),
diffbg_red = util.blend(t.bg_solid, t.red, 0.85),
diffbg_green = util.blend(t.bg_solid, t.green, 0.85),
bg_cyan = util.blend(t.bg_solid, t.cyan, 0.20),
bg_blue = util.blend(t.bg_solid, t.blue, 0.20),
bg_magenta = util.blend(t.bg_solid, t.magenta, 0.20),
bg_alt = util.blend(t.bg_solid, t.bgHighlight, 0.02),
-- styles
bold = true,
italic = true,
underline = true,
}
local highlights = {
NeogitNormal = { bg = t.bg },
NeogitPopupSwitchKey = { fg = t.orange },
NeogitPopupOptionKey = { fg = t.orange },
NeogitPopupActionKey = { fg = t.orange },
NeogitPopupBranchName = { fg = t.cyan, bold = true },
NeogitPopupSectionTitle = { fg = t.pink, bold = true },
NeogitFold = { fg = t.fg },
NeogitRemote = { fg = t.cyan },
NeogitBranch = { fg = t.pink, bold = true },
NeogitBranchHead = { fg = t.pink, bold = true },
NeogitWinSeparator = { bg = t.bg, fg = t.bgHighlight },
NeogitChangeDeleted = { fg = t.red, bold = true, italic = true },
NeogitChangeModified = { fg = t.blue, bold = true, italic = true },
NeogitSectionHeader = { fg = t.orange, bold = true },
NeogitCommitViewHeader = { bg = t.pink, fg = t.bgAlt },
NeogitHunkHeader = { bg = t.cyan, fg = t.bgAlt, bold = true },
NeogitHunkHeaderHighlight = { bg = t.pink, fg = t.bgAlt, bold = true },
NeogitDiffHeader = { bg = t.fg, fg = t.bgAlt },
NeogitDiffContext = { bg = t.bg },
NeogitDiffHeaderHighlight = { bg = t.bgHighlight, fg = t.orange, bold = true, italic = true },
NeogitDiffContextHighlight = { bg = t.bgHighlight },
NeogitGraphAuthor = { fg = p.orange },
NeogitGraphRed = { fg = p.red },
NeogitGraphWhite = { fg = p.white },
NeogitGraphYellow = { fg = p.yellow },
NeogitGraphGreen = { fg = p.green },
NeogitGraphCyan = { fg = p.cyan },
NeogitGraphBlue = { fg = p.blue },
NeogitGraphPurple = { fg = p.purple },
NeogitGraphGray = { fg = p.grey },
NeogitGraphOrange = { fg = p.orange },
NeogitGraphBoldOrange = { fg = p.orange, bold = p.bold },
NeogitGraphBoldRed = { fg = p.red, bold = p.bold },
NeogitGraphBoldWhite = { fg = p.white, bold = p.bold },
NeogitGraphBoldYellow = { fg = p.yellow, bold = p.bold },
NeogitGraphBoldGreen = { fg = p.green, bold = p.bold },
NeogitGraphBoldCyan = { fg = p.cyan, bold = p.bold },
NeogitGraphBoldBlue = { fg = p.blue, bold = p.bold },
NeogitGraphBoldPurple = { fg = p.purple, bold = p.bold },
NeogitGraphBoldGray = { fg = p.grey, bold = p.bold },
NeogitHunkMergeHeader = { fg = p.bg_alt, bg = p.grey, bold = p.bold },
NeogitHunkMergeHeaderHighlight = { fg = p.bg, bg = p.bg_cyan, bold = p.bold },
NeogitHunkMergeHeaderCursor = { fg = p.bg, bg = p.bg_cyan, bold = p.bold },
NeogitHunkHeader = { fg = p.bg, bg = p.grey, bold = p.bold },
NeogitHunkHeaderHighlight = { fg = p.bg, bg = p.bg_magenta, bold = p.bold },
NeogitHunkHeaderCursor = { fg = p.bg, bg = p.bg_magenta, bold = p.bold },
NeogitDiffContext = { bg = p.bg_alt },
NeogitDiffContextHighlight = { bg = p.bg_alt },
NeogitDiffContextCursor = { bg = p.bg_alt },
NeogitDiffAdditions = { fg = p.bg_green },
NeogitDiffAdd = { bg = p.diffbg_green, fg = p.bg_green },
NeogitDiffAddHighlight = { bg = p.diffbg_green, fg = p.green },
NeogitDiffAddCursor = { bg = p.bg_alt, fg = p.green },
NeogitDiffDeletions = { fg = p.bg_red },
NeogitDiffDelete = { bg = p.diffbg_red, fg = p.bg_red },
NeogitDiffDeleteHighlight = { bg = p.diffbg_red, fg = p.red },
NeogitDiffDeleteCursor = { bg = p.bg_alt, fg = p.red },
NeogitPopupSectionTitle = { fg = p.blue },
NeogitPopupBranchName = { fg = p.cyan },
NeogitPopupBold = { bold = p.bold },
NeogitPopupSwitchKey = { fg = p.magenta },
NeogitPopupSwitchEnabled = { link = "NeogitPopupSwitchKey" },
NeogitPopupOptionKey = { link = "NeogitPopupSwitchKey" },
NeogitPopupConfigKey = { link = "NeogitPopupSwitchKey" },
NeogitPopupActionKey = { link = "NeogitPopupSwitchKey" },
NeogitFilePath = { fg = p.blue, italic = p.italic },
NeogitCommitViewHeader = { bg = p.bg_cyan, fg = p.bg_solid },
NeogitDiffHeader = { bg = p.bg_alt, fg = p.blue, bold = p.bold },
NeogitDiffHeaderHighlight = { bg = p.bg_alt, fg = p.orange, bold = p.bold },
NeogitBranch = { fg = p.cyan, bold = p.bold },
NeogitBranchHead = { fg = p.blue, bold = p.bold, underline = p.underline },
NeogitRemote = { fg = p.blue, bold = p.bold },
NeogitUnmergedInto = { fg = p.pink, bold = p.bold },
NeogitUnpushedTo = { fg = p.pink, bold = p.bold },
NeogitUnpulledFrom = { fg = p.pink, bold = p.bold },
NeogitChangeModified = { fg = p.blue, bold = p.bold, italic = p.italic },
NeogitChangeAdded = { fg = p.green, bold = p.bold, italic = p.italic },
NeogitChangeDeleted = { fg = p.red, bold = p.bold, italic = p.italic },
NeogitChangeRenamed = { fg = p.purple, bold = p.bold, italic = p.italic },
NeogitChangeUpdated = { fg = p.orange, bold = p.bold, italic = p.italic },
NeogitChangeCopied = { fg = p.cyan, bold = p.bold, italic = p.italic },
NeogitChangeUnmerged = { fg = p.yellow, bold = p.bold, italic = p.italic },
NeogitChangeNewFile = { fg = p.green, bold = p.bold, italic = p.italic },
NeogitSectionHeader = { fg = p.green, bold = p.bold },
NeogitTagName = { fg = p.yellow },
NeogitTagDistance = { fg = p.cyan },
NeogitFloatHeader = { bg = p.bg, bold = p.bold },
NeogitFloatHeaderHighlight = { bg = p.bg_alt, fg = p.cyan, bold = p.bold },
NeogitActiveItem = { bg = p.orange, fg = p.bg_solid, bold = p.bold },
}

return highlights
Expand Down

0 comments on commit 2ee87ea

Please sign in to comment.