local c = require("ash.utils.color")
local p = require("ash.palette")

local function groups(o)
    return {
        ColorColumn = { bg = p.surface0 },
        Conceal = { fg = p.overlay1 },
        Cursor = { fg = p.base, bg = p.text },
        lCursor = { fg = p.base, bg = p.text },
        CursorIM = { fg = p.base, bg = p.text },
        CursorColumn = { bg = p.mantle },
        Directory = { fg = p.charcoal },
        EndOfBuffer = { fg = p.base },
        ErrorMsg = { fg = p.crimson, style = { "bold", "italic" } },
        VertSplit = { fg = o.transparent and p.surface1 or p.crust },
        Folded = { fg = p.charcoal, bg = o.transparent and p.none or p.surface1 },
        FoldColumn = { fg = p.overlay0 },
        SignColumn = { fg = p.surface1 },
        SignColumnSB = { bg = p.crust, fg = p.surface1 },
        Substitute = { bg = p.surface1, fg = p.ember },
        LineNr = { fg = p.surface1 },
        CursorLineNr = { fg = p.fog },
        MatchParen = { fg = p.frost, bg = p.surface1, style = { "bold" } },
        ModeMsg = { fg = p.text, style = { "bold" } },
        MsgSeparator = {},
        MoreMsg = { fg = p.charcoal },
        NonText = { fg = p.overlay0 },
        Normal = { fg = p.text, bg = o.transparent and p.none or p.base },
        NormalNC = { fg = p.text, bg = o.transparent and p.none or p.base },
        NormalSB = { fg = p.text, bg = p.crust },
        NormalFloat = { fg = p.text, bg = o.transparent and p.none or p.mantle },
        FloatBorder = { fg = p.charcoal },
        FloatTitle = { fg = p.subtext0 },
        Pmenu = {
            bg = (o.transparent and vim.o.pumblend == 0) and p.none or c.darken(p.surface0, 0.8, p.crust),
            fg = p.overlay2,
        },
        PmenuSel = { bg = p.surface1, style = { "bold" } },
        PmenuSbar = { bg = p.surface1 },
        PmenuThumb = { bg = p.overlay0 },
        Question = { fg = p.charcoal },
        QuickFixLine = { bg = p.surface1, style = { "bold" } },
        Search = { bg = c.darken(p.slate, 0.30, p.base), fg = p.text },
        IncSearch = { bg = c.darken(p.slate, 0.90, p.base), fg = p.mantle },
        CurSearch = { bg = p.crimson, fg = p.mantle },
        SpecialKey = { link = "NonText" },
        SpellBad = { sp = p.crimson, style = { "undercurl" } },
        SpellCap = { sp = p.crimson, style = { "undercurl" } },
        SpellLocal = { sp = p.charcoal, style = { "undercurl" } },
        SpellRare = { sp = p.sage, style = { "undercurl" } },
        StatusLine = { fg = p.text, bg = o.transparent and p.none or p.mantle },
        StatusLineNC = { fg = p.surface1, bg = o.transparent and p.none or p.mantle },
        TabLine = { bg = p.crust, fg = p.overlay0 },
        TabLineFill = { bg = o.transparent and p.none or p.mantle },
        TabLineSel = { link = "Normal" },
        TermCursor = { fg = p.base, bg = p.seafoam },
        TermCursorNC = { fg = p.base, bg = p.overlay2 },
        Title = { fg = p.charcoal, style = { "bold" } },
        Visual = { bg = p.surface1, style = { "bold" } },
        VisualNOS = { bg = p.surface1, style = { "bold" } },
        WarningMsg = { fg = p.rust },
        Whitespace = { fg = p.surface1 },
        WildMenu = { bg = p.overlay0 },
        WinBar = { fg = p.seafoam },
        WinBarNC = { link = "WinBar" },
        WinSeparator = { fg = o.transparent and p.surface1 or p.crust },
    }
end

return groups
