Closed fitrh closed 1 year ago
will #145 solve your case? seems like they are kinda about the same issue
I don't think so, #145 overrides the palette whereas I just want to get the palette once configured by get_base_colors
@fitrh I still don't get the full use case. Can you explain a little bit more, please?
local colors = require('gruvbox.palette')
require("gruvbox").setup({
contrast = "hard",
overrides = {
-- make sign column same as background
SignColumn = { bg = colors.dark0_hard },
GruvboxRedSign = { bg = colors.dark0_hard },
GruvboxYellowSign = { bg = colors.dark0_hard },
GruvboxGreenSign = { bg = colors.dark0_hard },
GruvboxAquaSign = { bg = colors.dark0_hard },
If I would have get_base_colors
I would not need to play around with hard
vs soft
variants because that would be already handled and it would be very similar to what lua/gruvbox/groups.lua:setup()
does.
@fitrh I still don't get the full use case. Can you explain a little bit more, please?
I tend to customize a colorscheme like this, let say I want to override the bg of StatusLine
group, using gruvbox.palette
module, I can get dark1
, when I switch to light mode, the bg still dark1
unless I change it to a light palette, but using the colors generated by get_base_colors
from gruvbox.groups
module, I can use bg1
which is dark1
in dark mode and light1
in light mode.
As you can see, this module provides users a more seamless palette instead of directly using gruvbox.palette
module
What I'm asking is not about overriding the palette, but to get it
Currently I am doing it like this:
local M = {}
local colors = nil
function M.colors()
if colors == nil then
colors = require("gruvbox.groups").setup()
end
return {
scroll_handle = colors.GruvboxBg3.fg,
marks_sign = colors.GruvboxRed.fg,
leap_match_fg = colors.GruvboxRed.fg,
leap_label_secondary = colors.GruvboxGreen.fg,
murmur_guifg = colors.GruvboxFg1.fg,
murmur_guibg = colors.GruvboxBg2.fg,
incline_guifg = colors.GruvboxFg0.fg,
incline_guibg = colors.GruvboxBg4.fg,
beacon_guibg = colors.GruvboxYellow.fg,
winbar_guifg = colors.GruvboxYellow.fg,
portal_border_forward = colors.GruvboxBg2.fg,
portal_border_none = colors.GruvboxBg0.fg,
portal_label = colors.GruvboxRed.fg,
}
end
return M
I have to call the setup
to get the computed colors, it would be great to achieve this in less effort.
@fitrh @towry i get the idea now, will try to come up with something here
Ok, i've pushed a initial version now. You can now get the colors and get_base_colors in the groups.palette
module. Example:
--- getting raw palette
vim.pretty_print(require('gruvbox.palette').colors)
-- getting base colors using custom bg and contrast (if bg is nil, it will grab directly from your current bg)
vim.pretty_print(require('gruvbox.palette').get_base_colors(bg, contrast))
let me know if that works so I can close this one
Hi, when trying to get the color palette I am getting an error: module gruvbox.palette not found
.
However, I implemented this config function for lazy:
config = function()
local soft_bg = "#282828"
local hard_bg = "#1d2021"
local contrast = "hard"
local gutter_bg
if contrast == "hard" then
gutter_bg = hard_bg
else
gutter_bg = soft_bg
end
require("gruvbox").setup({
terminal_colors = true, -- add neovim terminal colors
undercurl = true,
underline = true,
bold = true,
italic = {
strings = true,
emphasis = true,
comments = true,
operators = false,
folds = true,
},
strikethrough = true,
invert_selection = false,
invert_signs = false,
invert_tabline = false,
invert_intend_guides = false,
inverse = true, -- invert background for search, diffs, statuslines and errors
contrast = contrast, -- can be "hard", "soft" or empty string
palette_overrides = {},
dim_inactive = false,
transparent_mode = false,
overrides = {
SignColumn = { bg = gutter_bg },
}
})
vim.cmd("colorscheme gruvbox")
vim.api.nvim_set_hl(0, "DiagnosticSignError", { bg = gutter_bg, fg = "#fb4934" })
vim.api.nvim_set_hl(0, "DiagnosticSignWarn", { bg = gutter_bg, fg = "#fabd2f" })
vim.api.nvim_set_hl(0, "DiagnosticSignInfo", { bg = gutter_bg, fg = "#83a598" })
vim.api.nvim_set_hl(0, "DiagnosticSignHint", { bg = gutter_bg, fg = "#8ec07c" })
end,
Is your feature request related to a problem? Please describe. I feel more comfortable overriding some highlight groups if I can get a palette that is exactly the same as colorscheme used, for this theme, I got the palette by using
require("gruvbox.palette")
but realize this module not so adaptable to the dark-light mode switching and found that ingruvbox.groups
there isget_base_colors
which generates a palette based on mode and contrastDescribe the solution you'd like Expose
get_base_colors
fromgruvbox.groups