@@ -51,6 +51,41 @@ M.defaults = {
5151 multiline = {
5252 height = 5 ,
5353 },
54+ --- Visual styling
55+ style = {
56+ --- Chevron glyphs shown on the right side of `select` inputs to indicate
57+ --- the dropdown state. Override either to taste (e.g. `"v"`/`"^"` for
58+ --- ASCII, or extra spacing for wider icons).
59+ chevron = {
60+ --- Glyph shown when the dropdown is closed.
61+ closed = " ⌄" ,
62+ --- Glyph shown when the dropdown is open.
63+ open = " ⌃" ,
64+ },
65+ --- Highlight groups applied on every `form:show()`. Each entry is passed
66+ --- directly to `vim.api.nvim_set_hl(0, name, spec)`, so any option that
67+ --- `nvim_set_hl` accepts (`fg`, `bg`, `link`, `bold`, `italic`,
68+ --- `default`, ...) is valid. User overrides fully replace the default
69+ --- spec for the matching group (they are NOT deep-merged field by field).
70+ highlights = {
71+ -- Parent form window
72+ InputFormNormal = { link = " NormalFloat" , default = true },
73+ InputFormBorder = { link = " FloatBorder" , default = true },
74+ InputFormTitle = { link = " FloatTitle" , default = true },
75+ InputFormHelp = { fg = " Cyan" , default = true },
76+ -- Individual input fields
77+ InputFormField = { link = " NormalFloat" , default = true },
78+ InputFormFieldBorder = { link = " FloatBorder" , default = true },
79+ InputFormFieldTitle = { link = " FloatTitle" , default = true },
80+ -- Error state for individual input fields
81+ InputFormFieldError = { fg = " Red" , default = true },
82+ InputFormFieldErrorBorder = { fg = " Red" , default = true },
83+ InputFormFieldErrorTitle = { fg = " Red" , default = true },
84+ -- Select dropdown list
85+ InputFormDropdown = { link = " NormalFloat" , default = true },
86+ InputFormDropdownActive = { link = " PmenuSel" , default = true },
87+ },
88+ },
5489}
5590
5691M .options = vim .deepcopy (M .defaults )
@@ -60,7 +95,16 @@ M.options = vim.deepcopy(M.defaults)
6095--- @param user_opts table | nil
6196--- @return table
6297function M .setup (user_opts )
63- M .options = utils .merge (vim .deepcopy (M .defaults ), user_opts or {})
98+ local merged = utils .merge (vim .deepcopy (M .defaults ), user_opts or {})
99+ -- Highlight specs must be replaced per-group, not deep-merged, so a user
100+ -- override like `{ fg = "#ff5555" }` doesn't inherit the default's
101+ -- `default = true` flag (which would let a colorscheme clobber it).
102+ if user_opts and user_opts .style and user_opts .style .highlights then
103+ for name , spec in pairs (user_opts .style .highlights ) do
104+ merged .style .highlights [name ] = spec
105+ end
106+ end
107+ M .options = merged
64108 return M .options
65109end
66110
0 commit comments