-- <! tmpl:setPostProcessor(opt.luaCompile) !>
local catppuccin = {
    bg = "#<% opt.catppuccin.mantle %>",
    fg = "#<% opt.catppuccin.text %>",
    bright_bg = "#<% opt.catppuccin.base %>",
    very_bright_bg = "#<% opt.catppuccin.surface0 %>",
    cyan = "#<% opt.catppuccin.blue %>",
    green = "#<% opt.catppuccin.green %>",
    orange = "#<% opt.catppuccin.peach %>",
    pink = "#<% opt.catppuccin.pink %>",
    purple = "#<% opt.catppuccin.mauve %>",
    red = "#<% opt.catppuccin.red %>",
    yellow = "#<% opt.catppuccin.yellow %>",
}

local theme = {}

-- Default settings
theme.font = "12px <% opt.font %>"
theme.fg = catppuccin.fg
theme.bg = catppuccin.bg

-- Genaral colors
theme.success_fg = catppuccin.green
theme.loaded_fg = catppuccin.cyan

-- Error colors
theme.error_fg = catppuccin.red
theme.error_bg = catppuccin.bright_bg

-- Warning colors
theme.warning_fg = catppuccin.orange
theme.warning_bg = catppuccin.bright_bg

-- Notification colors
theme.notif_fg = catppuccin.very_bright_bg
theme.notif_bg = catppuccin.bg

-- Menu colors
theme.menu_fg = catppuccin.fg
theme.menu_bg = catppuccin.bg
theme.menu_selected_fg = catppuccin.fg
theme.menu_selected_bg = catppuccin.bright_bg
theme.menu_title_bg = catppuccin.bg
theme.menu_primary_title_fg = catppuccin.red
theme.menu_secondary_title_fg = catppuccin.bright_bg

theme.menu_disabled_fg = catppuccin.very_bright_bg
theme.menu_disabled_bg = catppuccin.purple
theme.menu_enabled_fg = theme.menu_fg
theme.menu_enabled_bg = theme.menu_bg
theme.menu_active_fg = catppuccin.very_bright_bg
theme.menu_active_bg = theme.menu_bg

-- Proxy manager
theme.proxy_active_menu_fg = catppuccin.fg
theme.proxy_active_menu_bg = catppuccin.bg
theme.proxy_inactive_menu_fg = catppuccin.bright_bg
theme.proxy_inactive_menu_bg = catppuccin.very_bright_bg

-- Statusbar specific
theme.sbar_fg = catppuccin.fg
theme.sbar_bg = catppuccin.bg

-- Downloadbar specific
theme.dbar_fg = catppuccin.fg
theme.dbar_bg = catppuccin.bg
theme.dbar_error_fg = catppuccin.red

-- Input bar specific
theme.ibar_fg = catppuccin.fg
theme.ibar_bg = catppuccin.bg

-- Tab label
theme.tab_fg = catppuccin.fg
theme.tab_bg = catppuccin.bg
theme.tab_hover_bg = catppuccin.orange
theme.tab_ntheme = "#ddd"
theme.selected_fg = catppuccin.fg
theme.selected_bg = catppuccin.bright_bg
theme.selected_ntheme = "#ddd"
theme.loading_fg = catppuccin.cyan
theme.loading_bg = catppuccin.bg

theme.selected_private_tab_bg = catppuccin.pink
theme.private_tab_bg = catppuccin.purple

-- Trusted/untrusted ssl colors
theme.trust_fg = catppuccin.green
theme.notrust_fg = catppuccin.red

-- Follow mode hints
theme.hint_font = "12px <% opt.font %>, monospace, courier, sans-serif"
theme.hint_fg = catppuccin.fg
theme.hint_bg = catppuccin.very_bright_bg
theme.hint_border = "2px dashed " .. catppuccin.green
theme.hint_opacity = "0.3"
theme.hint_overlay_bg = "rgba(255,255,153,0.3)"
theme.hint_overlay_border = "1px dotted #000"
theme.hint_overlay_selected_bg = "rgba(0,255,0,0.3)"
theme.hint_overlay_selected_border = theme.hint_overlay_border

-- General colour pairings
theme.ok = { fg = catppuccin.fg, bg = catppuccin.bg }
theme.warn = { fg = catppuccin.orange, bg = catppuccin.bg }
theme.error = { fg = catppuccin.red, bg = catppuccin.bright_bg }

-- Gopher page style (override defaults)
theme.gopher_light = { bg = "#E8E8E8", fg = "#17181C", link = "#03678D" }
theme.gopher_dark = { bg = "#17181C", fg = "#E8E8E8", link = "#f90" }

return theme
