Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(highlights): add fzf-lua #79

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ A colorscheme for [Neovim](https://github.com/neovim/neovim). Pleasant and produ
- [Treesitter](https://github.com/nvim-treesitter/nvim-treesitter)
- [Native LSP](https://github.com/neovim/nvim-lspconfig)
- [Telescope](https://github.com/nvim-telescope/telescope.nvim)
- [Fzf-lua](https://github.com/ibhagwan/fzf-lua)
- [NvimTree](https://github.com/kyazdani42/nvim-tree.lua)
- [Neo-Tree](https://github.com/nvim-neo-tree/neo-tree.nvim)
- [Nvim-cmp](https://github.com/hrsh7th/nvim-cmp)
Expand Down
25 changes: 13 additions & 12 deletions lua/mellifluous/default_config.lua
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
return {
colorset = "mellifluous",
plugins = {
cmp = true,
aerial = true,
blink_cmp = true,
cmp = true,
fzf = true,
gitsigns = true,
indent_blankline = true,
nvim_tree = {
lazy = true,
mason = true,
neo_tree = {
enabled = true,
show_root = false,
},
neo_tree = {
neorg = true,
neotest = true,
nvim_notify = true,
nvim_tree = {
enabled = true,
show_root = false,
},
startify = true,
telescope = {
enabled = true,
nvchad_like = true,
},
startify = true,
gitsigns = true,
neorg = true,
nvim_notify = true,
aerial = true,
neotest = true,
lazy = true,
mason = true,
},
dim_inactive = false,
styles = { -- see :h attr-list for options. set {} for NONE, { option = true } for option
Expand Down
76 changes: 35 additions & 41 deletions lua/mellifluous/highlights/plugins/blink_cmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,52 @@ local M = {}
function M.set(hl, colors)
local shader = require("mellifluous.utils.shader")

local pmenu = hl.get("Pmenu")
local type = hl.get("Type")
local func = hl.get("Function")
local id = hl.get("Identifier")
local struct = hl.get("Structure")
local const = hl.get("Constant")
local pmenu_sel = hl.get("PmenuSel")
local dir = hl.get("Directory")
local normal_float = hl.get("NormalFloat")
local non_text = hl.get("NonText")

hl.set("BlinkCmpMenu", { bg = pmenu.bg })
hl.set("BlinkCmpMenuBorder", { bg = pmenu.bg })
hl.set("BlinkCmpMenuSelection", { bg = pmenu_sel.bg, fg = pmenu_sel.fg })
hl.set("BlinkCmpMenu", { bg = hl.get("Pmenu").bg })
hl.set("BlinkCmpMenuBorder", { bg = hl.get("Pmenu").bg })
hl.set("BlinkCmpMenuSelection", { bg = hl.get("PmenuSel").bg, fg = hl.get("PmenuSel").fg })
hl.set("BlinkCmpScrollBarThumb", { fg = hl.get("PmenuThumb").fg })
hl.set("BlinkCmpScrollBarGutter", { fg = hl.get("PmenuSbar").fg })
hl.set("BlinkCmpLabel", { fg = pmenu.fg })
hl.set("BlinkCmpLabelDeprecated", { fg = pmenu.fg, style = { strikethrough = true } })
hl.set("BlinkCmpLabel", { fg = hl.get("Pmenu").fg })
hl.set("BlinkCmpLabelDeprecated", { fg = hl.get("Pmenu").fg, style = { strikethrough = true } })
hl.set("BlinkCmpLabelMatch", { fg = colors.fg })
hl.set("BlinkCmpGhostText", { fg = non_text.fg })
hl.set("BlinkCmpKind", { fg = type.fg })
hl.set("BlinkCmpGhostText", { fg = hl.get("NonText").fg })
hl.set("BlinkCmpKind", { fg = hl.get("Type").fg })
hl.set("BlinkCmpKindText", { fg = hl.get("String").fg })
hl.set("BlinkCmpKindMethod", { fg = func.fg })
hl.set("BlinkCmpKindFunction", { fg = func.fg })
hl.set("BlinkCmpKindConstructor", { fg = func.fg })
hl.set("BlinkCmpKindField", { fg = id.fg })
hl.set("BlinkCmpKindVariable", { fg = id.fg })
hl.set("BlinkCmpKindClass", { fg = type.fg })
hl.set("BlinkCmpKindInterface", { fg = type.fg })
hl.set("BlinkCmpKindModule", { fg = func.fg })
hl.set("BlinkCmpKindProperty", { fg = id.fg })
hl.set("BlinkCmpKindUnit", { fg = struct.fg })
hl.set("BlinkCmpKindValue", { fg = const.fg })
hl.set("BlinkCmpKindEnum", { fg = const.fg })
hl.set("BlinkCmpKindMethod", { fg = hl.get("Function").fg })
hl.set("BlinkCmpKindFunction", { fg = hl.get("Function").fg })
hl.set("BlinkCmpKindConstructor", { fg = hl.get("Function").fg })
hl.set("BlinkCmpKindField", { fg = hl.get("Identifier").fg })
hl.set("BlinkCmpKindVariable", { fg = hl.get("Identifier").fg })
hl.set("BlinkCmpKindClass", { fg = hl.get("Type").fg })
hl.set("BlinkCmpKindInterface", { fg = hl.get("Type").fg })
hl.set("BlinkCmpKindModule", { fg = hl.get("Function").fg })
hl.set("BlinkCmpKindProperty", { fg = hl.get("Identifier").fg })
hl.set("BlinkCmpKindUnit", { fg = hl.get("Structure").fg })
hl.set("BlinkCmpKindValue", { fg = hl.get("Constant").fg })
hl.set("BlinkCmpKindEnum", { fg = hl.get("Constant").fg })
hl.set("BlinkCmpKindKeyword", { fg = hl.get("Keyword").fg })
hl.set("BlinkCmpKindSnippet", { fg = hl.get("Special").fg })
hl.set("BlinkCmpKindColor", { fg = hl.get("Label").fg })
hl.set("BlinkCmpKindFile", { fg = dir.fg })
hl.set("BlinkCmpKindFile", { fg = hl.get("Directory").fg })
hl.set("BlinkCmpKindReference", { fg = hl.get("StorageClass").fg })
hl.set("BlinkCmpKindFolder", { fg = dir.fg })
hl.set("BlinkCmpKindEnumMember", { fg = const.fg })
hl.set("BlinkCmpKindConstant", { fg = const.fg })
hl.set("BlinkCmpKindStruct", { fg = struct.fg })
hl.set("BlinkCmpKindFolder", { fg = hl.get("Directory").fg })
hl.set("BlinkCmpKindEnumMember", { fg = hl.get("Constant").fg })
hl.set("BlinkCmpKindConstant", { fg = hl.get("Constant").fg })
hl.set("BlinkCmpKindStruct", { fg = hl.get("Structure").fg })
hl.set("BlinkCmpKindEvent", { fg = hl.get("Repeat").fg })
hl.set("BlinkCmpKindOperator", { fg = hl.get("Operator").fg })
hl.set("BlinkCmpKindTypeParameter", { fg = type.fg })
hl.set("BlinkCmpSource", { fg = non_text.fg })
hl.set("BlinkCmpDoc", { bg = normal_float.bg })
hl.set("BlinkCmpKindTypeParameter", { fg = hl.get("Type").fg })
hl.set("BlinkCmpSource", { fg = hl.get("NonText").fg })
hl.set("BlinkCmpDoc", { bg = hl.get("NormalFloat").bg })
hl.set("BlinkCmpDocBorder", { link = "FloatBorder" })
hl.set("BlinkCmpDocCursorLine", { bg = shader.replicate_shade(colors.bg, hl.get("CursorLine").bg, normal_float.bg) })
hl.set("BlinkCmpSignatureHelp", { bg = normal_float.bg })
hl.set("BlinkCmpSignatureHelpBorder", { bg = normal_float.bg })
hl.set("BlinkCmpDocCursorLine", {
bg = shader.replicate_shade(
colors.bg,
hl.get("CursorLine").bg,
hl.get("NormalFloat").bg)
})
hl.set("BlinkCmpSignatureHelp", { bg = hl.get("NormalFloat").bg })
hl.set("BlinkCmpSignatureHelpBorder", { bg = hl.get("NormalFloat").bg })
hl.set("BlinkCmpSignatureHelpActiveParameter", { bg = hl.get("LspSignatureActiveParameter").bg })
end

Expand Down
36 changes: 36 additions & 0 deletions lua/mellifluous/highlights/plugins/fzf.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
local M = {}

function M.set(hl, colors)
hl.set("FzfLuaNormal", { bg = colors.dark_bg, fg = colors.fg3 })
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently there is no easy way to change normal bg or preview bg without changing a whole lot of highlight groups manually.

I think it's okay to use some variables for highlights as long as it offers readability and/or maintainability improvements. Here we could have a variable normal for FzfLuaNormal, this variable could then be reused in other highlight groups. Similarly we could have a variable preview_normal.

A fine alternative would be to reuse FzfLuaNormal and FzfLuaPreviewNormal with linking and hl.get function.

hl.set("FzfLuaBorder", { bg = colors.dark_bg, fg = colors.dark_bg })
hl.set("FzfLuaTitle", { fg = hl.get("Normal").fg })
hl.set("FzfLuaPreviewNormal", { bg = hl.get("Normal").bg, fg = hl.get("Normal").fg })
hl.set("FzfLuaPreviewBorder", { bg = hl.get("Normal").bg, fg = hl.get("Normal").bg })
hl.set("FzfLuaPreviewTitle", { link = "FzfLuaTitle" })
hl.set("FzfLuaCursorLine", { bg = colors.bg2, fg = colors.fg2 })
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I would suggest: (normal being FzfLuaNormal)

    local groups = require("mellifluous.highlights.custom_groups").get(colors)

    hl.set("FzfLuaCursorLine", { bg = groups.MenuButtonSelected(normal.bg).bg, fg = normal.fg })

I don't think there's any reason to have lighter fg for this group, keeping the same fg as for other results will offer more consistency.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, apparently, FzfLuaCursorLine is intended for the preview window. I was confused about the naming convention and removed it.

hl.set("FzfLuaScrollBorderFull", { fg = colors.bg4 })
hl.set("FzfLuaScrollBorderEmpty", { fg = colors.bg })
hl.set("FzfLuaScrollFloatFull", { link = "FzfLuaScrollBorderFull" })
hl.set("FzfLuaScrollFloatEmpty", { link = "FzfLuaScrollBorderEmpty" })
hl.set("FzfLuaHeaderBind", { fg = colors.ui_purple })
hl.set("FzfLuaHeaderText", { fg = colors.fg4 })
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This group goes nicely here:

    hl.set("FzfLuaFzfHeader", { fg = colors.fg4 })

hl.set("FzfLuaPathLineNr", { fg = colors.fg4 })
hl.set("FzfLuaPathColNr", { fg = colors.fg4 })
hl.set("FzfLuaBufName", { fg = colors.ui_orange })
hl.set("FzfLuaBufNr", { fg = colors.fg4 })
hl.set("FzfLuaBufFlagCur", { fg = colors.ui_purple })
hl.set("FzfLuaBufFlagAlt", { fg = colors.ui_green })
hl.set("FzfLuaTabTitle", { link = "FzfLuaTitle" })
hl.set("FzfLuaTabMarker", { fg = colors.ui_purple })
hl.set("FzfLuaLiveSym", { fg = colors.fg })
hl.set("FzfLuaFzfMatch", { fg = colors.fg })
hl.set("FzfLuaFzfScrollbar", { fg = colors.fg4 })
hl.set("FzfLuaFzfSeparator", { fg = colors.dark_bg })
hl.set("FzfLuaFzfGutter", { bg = colors.dark_bg })
hl.set("FzfLuaFzfPointer", { fg = colors.fg4 })
hl.set("FzfLuaFzfMarker", { fg = colors.ui_orange })
hl.set("FzfLuaFzfPrompt", { fg = colors.fg4 })
hl.set("FzfLuaFzfQuery", { fg = colors.fg })
end

return M