local M = {}

local colors = require("beige-theme.palette")

M.setup = function()
	return {
		Normal = { fg = colors.fg, bg = colors.bg },
		NormalNC = { fg = colors.fg, bg = colors.bg },
		NormalFloat = { fg = colors.fg, bg = colors.menubg },
		Comment = { fg = colors.comment, italic = true },
		Constant = { fg = colors.literal },
		String = { fg = colors.string },
		Character = { fg = colors.string },
		Number = { fg = colors.literal },
		Boolean = { fg = colors.literal },
		Float = { fg = colors.literal },
		FloatBorder = { fg = colors.nontext },
		Operator = { fg = colors.fg },
		Delimiter = { fg = colors.magenta },
		Keyword = { fg = colors.keyword },
		Keywords = { fg = colors.keyword },
		Identifier = { fg = colors.red },
		Function = { fg = colors.blue },
		Statement = { fg = colors.keyword },
		Conditional = { fg = colors.keyword },
		Repeat = { fg = colors.keyword },
		Label = { fg = colors.red },
		Exception = { fg = colors.orange },
		PreProc = { fg = colors.magenta },
		Include = { fg = colors.magenta },
		Define = { fg = colors.magenta },
		Title = { fg = colors.blue, bold = true },
		Macro = { fg = colors.blue },
		PreCondit = { fg = colors.magenta },
		Type = { fg = colors.orange },
		StorageClass = { fg = colors.orange },
		Structure = { fg = colors.magenta },
		TypeDef = { fg = colors.magenta },
		Special = { fg = colors.red },
		SpecialComment = { fg = colors.fg, bg = colors.comment, italic = true },
		Error = { fg = colors.red },
		Removed = { fg = colors.red },
		Todo = { fg = colors.yellow, bold = true, italic = true },
		Underlined = { fg = colors.fg, underline = true },

		Cursor = { fg = colors.black },
		CursorLineNr = { fg = colors.black, bold = true },

		SignColumn = { bg = colors.bg },

		Conceal = { fg = colors.comment },
		CursorColumn = { bg = colors.black },
		CursorLine = { bg = colors.bg },
		ColorColumn = { bg = colors.bg },

		StatusLine = { fg = colors.fg, bg = colors.menubg },
		StatusLineNC = { fg = colors.comment, bg = colors.menubg },
		StatusLineTerm = { fg = colors.fg, bg = colors.menubg },
		StatusLineTermNC = { fg = colors.comment, bg = colors.menubg },
		TabLine = { fg = colors.comment, bg = colors.bg },
		TabLineSel = { fg = colors.fg, bg = colors.nontext },
		TabLineFill = { bg = colors.nontext },

		--  Diff
		DiffAdd = { fg = colors.green },
		DiffChange = { fg = colors.orange },
		DiffDelete = { fg = colors.red },
		DiffText = { fg = colors.orange },
		diffAdded = { fg = colors.green },
		diffRemoved = { fg = colors.red },
		diffFileId = { fg = colors.yellow, bold = true, reverse = true },
		diffFile = { fg = colors.nontext },
		diffNewFile = { fg = colors.green },
		diffOldFile = { fg = colors.red },

		Directory = { fg = colors.gray1 },
		MsgArea = { fg = colors.gray3, bg = colors.menubg },
		ErrorMsg = { fg = colors.red, bg = colors.menubg },
		MoreMsg = { fg = colors.gray3, bg = colors.menubg },
		ModeMsg = { fg = colors.gray3, bg = colors.menubg },
		WarningMsg = { fg = colors.yellow },
		VertSplit = { fg = colors.menubg, bold = true },
		WinSeparator = { fg = colors.menubg, bold = true },
		Folded = { fg = colors.comment },
		FoldColumn = { fg = colors.gray7 },
		Search = { fg = colors.black, bg = colors.gray6 },
		IncSearch = { fg = colors.black, bg = colors.gray6 },
		CurSearch = { fg = "#000000", bg = colors.gray2 },
		LineNr = { fg = colors.nontext },
		MatchParen = { bg = colors.gray6 },
		NonText = { fg = colors.bg, bg = colors.bg },
		EndOfBuffer = { fg = NONE, bg = NONE },
		SpecialKey = { fg = colors.nontext },
		Visual = { fg = colors.fg, bg = colors.gray7 },
		VisualNOS = { fg = colors.fg, bg = colors.gray7 },
		WildMenu = { fg = colors.fg, bg = colors.menubg },

		Pmenu = { fg = colors.fg, bg = colors.menubg },
		PmenuSel = { fg = colors.fg, bg = colors.gray7 },
		PmenuSbar = { bg = colors.menubg },
		PmenuThumb = { bg = colors.gray7 },

		Question = { fg = colors.bright_magenta },
		QuickFixLine = { fg = colors.fg, bg = colors.bright_magenta },

		SpellBad = { fg = colors.bright_red, underline = true },
		SpellCap = { fg = colors.yellow, underline = true },
		SpellLocal = { fg = colors.yellow, underline = true },
		SpellRare = { fg = colors.yellow, underline = true },

		Terminal = { fg = colors.fg, bg = colors.bg },

		-- TreeSitter
		["@error"] = { fg = colors.error },

		["@punctuation.delimiter"] = { fg = colors.gray1 },
		["@punctuation.bracket"] = { fg = colors.gray1 },
		["@punctuation.special"] = { fg = colors.gray1 },
		["@operator"] = { fg = colors.gray1 },

		["@constant"] = { fg = colors.literal },
		["@constant.builtin"] = { fg = colors.literal },
		["@symbol"] = { fg = colors.literal },
		["@constant.macro"] = { fg = colors.literal },
		["@number"] = { fg = colors.literal },
		["@boolean"] = { fg = colors.literal },
		["@float"] = { fg = colors.literal },
		["@field"] = { fg = colors.variable_important },
		["@parameter.reference"] = { fg = colors.variable_important },

		["@character"] = { fg = colors.string },
		["@string"] = { fg = colors.string },
		["@string.regex"] = { fg = colors.bright_green },
		["@string.escape"] = { fg = colors.bright_green },

		["@annotation"] = { fg = colors.orange },
		["@attribute"] = { fg = colors.orange },
		["@namespace"] = { fg = colors.class },

		["@function.builtin"] = { fg = colors.func },
		["@function"] = { fg = colors.func },
		["@function.macro"] = { fg = colors.func },
		["@parameter"] = { fg = colors.variable_important },
		["@method"] = { fg = colors.func },
		["@property"] = { fg = colors.func },
		["@constructor"] = { fg = colors.func },

		["@conditional"] = { fg = colors.keyword },
		["@repeat"] = { fg = colors.keyword },
		["@label"] = { fg = colors.keyword },
		["@keyword"] = { fg = colors.keyword },
		["@keyword.function"] = { fg = colors.keyword },
		["@keyword.function.ruby"] = { fg = colors.keyword },
		["@keyword.operator"] = { fg = colors.keyword },
		["@exception"] = { fg = colors.keyword },
		["@structure"] = { fg = colors.keyword },
		["@include"] = { fg = colors.keyword },

		["@type"] = { fg = colors.type },
		["@type.builtin"] = { fg = colors.type },
		["@type.qualifier"] = { fg = colors.magenta },

		["@variable"] = { fg = colors.variable },
		["@variable.builtin"] = { fg = colors.variable },

		["@text"] = { fg = colors.comment },
		["@text.strong"] = { fg = colors.fg, bold = true }, -- bold
		["@text.emphasis"] = { fg = colors.fg, italic = true }, -- italic
		["@text.underline"] = { fg = colors.fg, underline = true }, -- underlined
		["@text.title"] = { fg = colors.blue, bold = true }, -- title
		["@text.literal"] = { fg = colors.fg, bg = colors.comment }, -- inline code
		["@text.uri"] = { fg = colors.cyan, underline = true }, -- urls
		["@text.reference"] = { fg = colors.comment, bold = true },

		["@tag"] = { fg = colors.keyword },
		["@tag.attribute"] = { fg = colors.blue },
		["@tag.delimiter"] = { fg = colors.fg },

		-- Semantic
		["@class"] = { fg = colors.class },
		["@struct"] = { fg = colors.keyword },
		["@enum"] = { fg = colors.keyword },
		["@enumMember"] = { fg = colors.fg },
		["@event"] = { fg = colors.func },
		["@interface"] = { fg = colors.func },
		["@modifier"] = { fg = colors.magenta },
		["@regexp"] = { fg = colors.bright_green },
		["@typeParameter"] = { fg = colors.variable_important },
		["@decorator"] = { fg = colors.yellow },

		-- LSP Semantic (0.9+)
		["@lsp.type.class"] = { fg = colors.class },
		["@lsp.type.struct"] = { fg = colors.keyword },
		["@lsp.type.enum"] = { fg = colors.keyword },
		["@lsp.type.enumMember"] = { fg = colors.fg },
		["@lsp.type.interface"] = { fg = colors.func },
		["@lsp.type.type"] = { fg = colors.type },
		["@lsp.type.parameter"] = { fg = colors.variable_important },
		["@lsp.type.decorator"] = { fg = colors.yellow },
		["@lsp.type.function"] = { fg = colors.func },
		["@lsp.type.macro"] = { fg = colors.func },
		["@lsp.type.method"] = { fg = colors.func },
		["@lsp.type.namespace"] = { fg = colors.class },
		["@lsp.type.property"] = { fg = colors.variable_important },
		["@lsp.type.variable"] = { fg = colors.variable },

		-- NeoTree
		NeoTreeNormal = { fg = colors.fg, bg = colors.menubg },
		NeoTreeNormalNC = { fg = colors.fg, bg = colors.menubg },
		NeoTreeFloatTitle = { fg = colors.fg, bold = true },
		NeoTreeTitleBar = { fg = colors.fg, bold = true },
		NeoTreeMessage = { fg = colors.gray4 },
		NeoTreeFadeText1 = { fg = colors.gray1 },
		NeoTreeFadeText2 = { fg = colors.fg },
		NeoTreeDotfile = { fg = colors.comment },
		NeoTreeCursorLine = { bg = colors.gray7 },
		NeoTreeDimText = { fg = colors.comment },
		NeoTreeDirectoryName = { fg = colors.blue },
		NeoTreeDirectoryIcon = { fg = colors.blue },
		NeoTreeFileIcon = { fg = colors.fg },
		NeoTreeFileName = { fg = colors.fg },
		NeoTreeFileNameOpened = { bold = true },
		NeoTreeSymbolicLinkTarget = { fg = colors.cyan },
		NeoTreeRootName = { fg = colors.fg, bold = true, italic = true },
		NeoTreeModified = { fg = colors.bright_yellow },
		NeoTreeGitModified = { fg = colors.bright_yellow },
		NeoTreeGitAdded = { fg = colors.bright_green },
		GitGutterAdd = { fg = colors.bright_green },
		NeoTreeGitDeleted = { fg = colors.bright_red },
		GitGutterDelete = { fg = colors.bright_red },
		GitGutterChange = { fg = colors.bright_yellow },
		NeoTreeGitConflict = { fg = colors.magenta },
		NeoTreeGitUntracked = { fg = colors.comment },
		NeoTreeTabActive = { bold = true },
		NeoTreeFileStats = { fg = colors.comment },
		NeoTreeFileStatsHeader = { fg = colors.gray1 },
		NeoTreeFloatNormal = { fg = colors.fg, bg = colors.bg },
		NeoTreePreview = { fg = colors.fg, bg = colors.bg },
		NeoTreeWinSeparator = { fg = colors.menubg, bg = colors.menubg },
		NeoTreeFloatBorder = { fg = colors.menubg, bg = NONE },

		-- Telescope
		TelescopeNormal = { fg = colors.gray3, bg = colors.bg },
		TelescopePreviewNormal = { fg = colors.fg, bg = colors.bg },
		TelescopePromptCounter = { fg = colors.gray3, bg = colors.bg },

		-- Mason
		MasonHighlightBlock = { fg = colors.fg, bg = colors.gray2 },
		MasonHighlightBlockBold = { fg = colors.fg, bg = colors.gray2, bold = true },
		MasonMutedBlock = { fg = colors.gray1, bg = colors.gray4 },
		MasonMutedBlockBold = { fg = colors.gray1, bg = colors.gray4, bold = true },
		MasonHighlightBlockSecondary = { fg = colors.gray2, bg = colors.gray5 },
		MasonHighlightBlockBoldSecondary = { fg = colors.gray2, bg = colors.gray5, bold = true },
		MasonHeader = { fg = colors.fg, bg = colors.gray2, bold = true },
		MasonHeaderSecondary = { fg = colors.fg, bg = colors.gray2 },
		MasonHighlight = { fg = colors.green },
		MasonLink = { fg = colors.cyan, underline = true },
		MasonHighlightSecondary = { fg = colors.bright_green },

		-- Lazy
		LazyH1 = { fg = colors.fg, bg = colors.gray2, bold = true },
		LazyButtonActive = { fg = colors.fg, bg = colors.gray2, bold = true },
		LazyButton = { fg = colors.gray1, bg = colors.gray4 },

		-- LSP
		DiagnosticError = { fg = colors.error },
		DiagnosticWarn = { fg = colors.warning },
		DiagnosticInfo = { fg = colors.info },
		DiagnosticHint = { fg = colors.hint },
		DiagnosticUnderlineError = { undercurl = true, sp = colors.error },
		DiagnosticUnderlineWarn = { undercurl = true, sp = colors.warning },
		DiagnosticUnderlineInfo = { undercurl = true, sp = colors.info },
		DiagnosticUnderlineHint = { undercurl = true, sp = colors.hint },
		DiagnosticSignError = { fg = colors.error },
		DiagnosticSignWarn = { fg = colors.warning },
		DiagnosticSignInfo = { fg = colors.info },
		DiagnosticSignHint = { fg = colors.hint },
		DiagnosticFloatingError = { fg = colors.error },
		DiagnosticFloatingWarn = { fg = colors.warning },
		DiagnosticFloatingInfo = { fg = colors.info },
		DiagnosticFloatingHint = { fg = colors.hint },
		DiagnosticVirtualTextError = { fg = colors.error },
		DiagnosticVirtualTextWarn = { fg = colors.warning },
		DiagnosticVirtualTextInfo = { fg = colors.info },
		DiagnosticVirtualTextHint = { fg = colors.hint },

		LspDiagnosticsDefaultError = { fg = colors.error },
		LspDiagnosticsDefaultWarning = { fg = colors.warning },
		LspDiagnosticsDefaultInformation = { fg = colors.info },
		LspDiagnosticsDefaultHint = { fg = colors.hint },
		LspDiagnosticsUnderlineError = { fg = colors.error, undercurl = true },
		LspDiagnosticsUnderlineWarning = { fg = colors.warning, undercurl = true },
		LspDiagnosticsUnderlineInformation = { fg = colors.info, undercurl = true },

		-- Which Key
		WhichKeyNormal = { fg = colors.fg, bg = colors.bg },
		WhichKeyBorder = { fg = colors.gray3, bg = colors.bg },
		WhichKeyIcon = { fg = colors.fg },
		WhichKeyIconAzure = { fg = colors.bright_cyan },
		WhichKeyIconBlue = { fg = colors.blue },
		WhichKeyIconCyan = { fg = colors.cyan },
		WhichKeyIconGreen = { fg = colors.green },
		WhichKeyIconGrey = { fg = colors.gray2 },
		WhichKeyIconOrange = { fg = colors.orange },
		WhichKeyIconPurple = { fg = colors.magenta },
		WhichKeyIconRed = { fg = colors.red },
		WhichKeyIconYellow = { fg = colors.bright_yellow },
		WhichKeySeparator = { fg = colors.comment },
		WhichKeyTitle = { fg = colors.blue },
		WhichKeyValue = { fg = colors.comment },

		-- BufferLine
		BufferLineFill = { bg = colors.menubg },
		BufferLineOffsetSeparator = { fg = colors.menubg, bg = colors.menubg },
		BufferLineSeparator = { fg = colors.menubg, bg = "#e0d9d0" },
		BufferLineSeparatorVisible = { fg = colors.menubg, bg = "#eae3da" },
		BufferLineSeparatorSelected = { fg = colors.menubg, bg = colors.bg },

        -- Notify
        NotifyBackground = { bg = colors.bg, fg = colors.fg },
        NotifyERRORBorder = { bg = colors.bg, fg = colors.error },
        NotifyWARNBorder = { bg = colors.bg, fg = colors.warning },
        NotifyINFOBorder = { bg = colors.bg, fg = colors.info },
        NotifyDEBUGBorder = { bg = colors.bg, fg = colors.gray2 },
        NotifyTRACEBorder = { bg = colors.bg, fg = colors.gray3 },
        NotifyERRORIcon = { bg = colors.bg, fg = colors.error },
        NotifyWARNIcon = { bg = colors.bg, fg = colors.warning },
        NotifyINFOIcon = { bg = colors.bg, fg = colors.info },
        NotifyDEBUGIcon = { bg = colors.bg, fg = colors.gray2 },
        NotifyTRACEIcon = { bg = colors.bg, fg = colors.gray3 },
        NotifyERRORTitle = { bg = colors.bg, fg = colors.fg, bold = true },
        NotifyWARNTitle = { bg = colors.bg, fg = colors.fg, bold = true },
        NotifyINFOTitle = { bg = colors.bg, fg = colors.fg, bold = true },
        NotifyDEBUGTitle = { bg = colors.bg, fg = colors.fg, bold = true },
        NotifyTRACETitle = { bg = colors.bg, fg = colors.fg, bold = true },
        NotifyERRORBody = { bg = colors.bg, fg = colors.fg },
        NotifyWARNBody = { bg = colors.bg, fg = colors.fg },
        NotifyINFOBody = { bg = colors.bg, fg = colors.fg },
        NotifyDEBUGBody = { bg = colors.bg, fg = colors.fg },
        NotifyTRACEBody = { bg = colors.bg, fg = colors.fg },
        NotifyLogTime = { bg = colors.bg, fg = colors.comment },
        NotifyLogTitle = { bg = colors.bg, fg = colors.comment },

		-- Markdown
		--             markdownBlockquote = { fg = colors.yellow, italic = true },
		--             markdownBold = { fg = colors.orange, bold = true },
		--             markdownCode = { fg = colors.orange },
		--             markdownCodeBlock = { fg = colors.orange },
		--             markdownCodeDelimiter = { fg = colors.red },
		--             markdownH1 = { fg = colors.blue, bold = true },
		--             markdownH2 = { fg = colors.blue, bold = true },
		--             markdownH3 = { fg = colors.blue, bold = true },
		--             markdownH4 = { fg = colors.blue, bold = true },
		--             markdownH5 = { fg = colors.blue, bold = true },
		--             markdownH6 = { fg = colors.blue, bold = true },
		--             markdownHeadingDelimiter = { fg = colors.red },
		--             markdownHeadingRule = { fg = colors.comment },
		--             markdownId = { fg = colors.magenta },
		--             markdownIdDeclaration = { fg = colors.cyan },
		--             markdownIdDelimiter = { fg = colors.magenta },
		--             markdownItalic = { fg = colors.yellow, italic = true },
		--             markdownLinkDelimiter = { fg = colors.magenta },
		--             markdownLinkText = { fg = colors.blue },
		--             markdownListMarker = { fg = colors.cyan },
		--             markdownOrderedListMarker = { fg = colors.red },
		--             markdownRule = { fg = colors.comment },
		--
		--             debugPc = { bg = colors.menu },
		--             debugBreakpoint = { fg = colors.red, reverse = true },

		-- Git Signs
		--             GitSignsAdd = { fg = colors.number },
		--             GitSignsChange = { fg = colors.orange },
		--             GitSignsDelete = { fg = colors.bright_red },
		--             GitSignsAddLn = { fg = colors.black, bg = colors.number },
		--             GitSignsChangeLn = { fg = colors.black, bg = colors.orange },
		--             GitSignsDeleteLn = { fg = colors.black, bg = colors.bright_red },
		--             GitSignsCurrentLineBlame = { fg = colors.white },

		-- Cmp
		--             CmpItemAbbr = { fg = colors.white, bg = colors.bg },
		--             CmpItemKind = { fg = colors.white, bg = colors.bg },
		--             CmpItemKindMethod = { link = "@method" },
		--             CmpItemKindText = { link = "@text" },
		--             CmpItemKindFunction = { link = "@function" },
		--             CmpItemKindConstructor = { link = "@type" },
		--             CmpItemKindVariable = { link = "@variable" },
		--             CmpItemKindClass = { link = "@type" },
		--             CmpItemKindInterface = { link = "@type" },
		--             CmpItemKindModule = { link = "@namespace" },
		--             CmpItemKindProperty = { link = "@property" },
		--             CmpItemKindOperator = { link = "@operator" },
		--             CmpItemKindReference = { link = "@parameter.reference" },
		--             CmpItemKindUnit = { link = "@field" },
		--             CmpItemKindValue = { link = "@field" },
		--             CmpItemKindField = { link = "@field" },
		--             CmpItemKindEnum = { link = "@field" },
		--             CmpItemKindKeyword = { link = "@keyword" },
		--             CmpItemKindSnippet = { link = "@text" },
		--             CmpItemKindEvent = { link = "@constant" },
		--             CmpItemKindEnumMember = { link = "@field" },
		--             CmpItemKindConstant = { link = "@constant" },
		--             CmpItemKindStruct = { link = "@structure" },
		--             CmpItemKindTypeParameter = { link = "@parameter" },
	}
end

return M
