require("catppuccin").setup({
  -- transparent_background = vim
  flavour = "latte",
  highlight_overrides = {
    all = function(colors)
      return {
        FloatBorder                     = { link = "SagaBorder", fg="#4f4f4f" },
        LineNr                          = { fg = colors.subtext0 },
        Folded                          = { fg = colors.green },
        MatchWord                       = { bold = true },
        Visual                          = { sp = colors.text, underline = true },
        IndentBlankLineContextChar      = { fg = colors.sapphire },
        WinSeparator                    = { fg = colors.text },
        TelescopeSelection              = { fg = colors.subtext1, bg = colors.surface0 },
        TelescopeBorder                 = { fg = colors.surface1, bg = colors.surface1 },
        TelescopeNormal                 = { bg = "#fafafa" },
        TelescopePromptNormal           = { bg = colors.surface1 },
        TelescopePromptBorder           = { bg = colors.surface1, fg = colors.surface1 },
        CursorLine                      = { bg = colors.surface2 },
        NvimTreeWinSeparator            = { fg = colors.text },
        NvimTreeGitNew                  = { fg = colors.green },
        NvimTreeGitDirty                = { fg = colors.yellow },
        NvimTreeGitDeleted              = { fg = colors.red },
        -- ColorColumn                     = { bg = colors. },
        SpecialKey                      = { fg = colors.yellow },
        SagaBorder                      = { fg = colors.blue },
        HoverNormal                     = { fg = colors.text },

        -- Gitsigns
        GitSignsAddInline               = { link = "DiffAdd" },
        GitSignsDeleteInline            = { link = "DiffDelete" },
        GitSignsChangedInline           = { link = "DiffChange" } ,
        Diffview                        = { link = "DiffChange" } ,

        StNormalMode                    = { fg = colors.surface0, bg = colors.blue, bold = true },
        StVisualMode                    = { fg = colors.surface0, bg = colors.sky, bold = true },
        StInsertMode                    = { fg = colors.surface0, bg = colors.lavender, bold = true },
        StTerminalMode                  = { fg = colors.surface0, bg = colors.green, bold = true },
        StNTerminalMode                 = { fg = colors.surface0, bg = colors.yellow, bold = true },
        StReplaceMode                   = { fg = colors.surface0, bg = colors.peach, bold = true },
        StConfirmMode                   = { fg = colors.surface0, bg = colors.sapphire, bold = true },
        StCommandMode                   = { fg = colors.surface0, bg = colors.green, bold = true },
        StSelectMode                    = { fg = colors.surface0, bg = colors.blue, bold = true },

        StInviSep                       = { bg = colors.surface1, fg = colors.surface1 },
        StNormalModeSep                 = { bg = colors.surface1, fg = colors.blue },
        StVisualModeSep                 = { bg = colors.surface1, fg = colors.sky },
        StInsertModeSep                 = { bg = colors.surface1, fg = colors.lavender },
        StTerminalModeSep               = { bg = colors.surface1, fg = colors.green },
        StNTerminalModeSep              = { bg = colors.surface1, fg = colors.yellow },
        StReplaceModeSep                = { bg = colors.surface1, fg = colors.peach },
        StConfirmModeSep                = { bg = colors.surface1, fg = colors.sapphire },
        StCommandModeSep                = { bg = colors.surface1, fg = colors.green },
        StSelectModeSep                 = { bg = colors.surface1, fg = colors.blue },

        --CurFile
        StCwd                           = { bg = colors.yellow, fg = colors.text },
        StFile                          = { bg = colors.peach, fg = colors.text, bold = true },
        StCwdSep                        = { fg = colors.yellow, bg = colors.surface1 },
        StFileSep                       = { fg = colors.peach, bg = colors.surface1 },
        StDirFileSep                    = { fg = colors.yellow, bg = colors.peach },
        -- Git stuffs
        StGitBranch                     = { bg = colors.overlay0, fg = colors.mauve },
        StGitAdded                      = { bg = colors.overlay0, fg = colors.green },
        StGitChanged                    = { bg = colors.overlay0, fg = colors.yellow },
        StGitRemoved                    = { bg = colors.overlay0, fg = colors.red },
        StGitSep                        = { bg = colors.surface1, fg = colors.overlay0 },

        -- LSP
        StLSPClient                     = { bg = colors.surface1, fg = colors.blue, bold = true },
        StLSPDiagSep                    = { bg = colors.surface1, fg = colors.overlay0 },
        StLSPErrors                     = { bg = colors.overlay0, fg = colors.red },
        StLSPWarnings                   = { bg = colors.overlay0, fg = colors.yellow },
        StLSPHints                      = { bg = colors.overlay0, fg = colors.mauve },
        StLspInfo                       = { bg = colors.overlay0, fg = colors.sky },
        --
        -- Lsp Diagnostics
        DiagnosticHint                  = { fg = colors.mauve },
        DiagnosticError                 = { fg = colors.red },
        DiagnosticWarn                  = { fg = colors.yellow },
        DiagnosticInformation           = { fg = colors.green },

        -- File Info
        StPosition                      = { bg = colors.sapphire, fg = colors.surface1 },
        StPositionSep                   = { bg = colors.surface1, fg = colors.sapphire },

        TabLineFill                     = { fg = colors.text, bg = colors.crust, sp = colors.text },
        TabLineBufHidden                = { fg = colors.mantle, bg = colors.subtext1, sp = colors.text },
        TabLineBufActive                = { fg = colors.text, bg = colors.sapphire, bold = true, sp = colors.text },
        TabLineCurrentBuf               = { fg = colors.mantle, bg = colors.red, bold = true, sp = colors.text },
        TabLineBufHiddenModified        = { fg = colors.green, bg = colors.subtext1, sp = colors.text },
        TabLineBufActiveModified        = { fg = colors.green, bg = colors.sapphire, bold = true, sp = colors.text },
        TabLineCurrentBufModified       = { fg = colors.green, bg = colors.red, bold = true, sp = colors.text },
        TabLineModified                 = { fg = colors.green },
        TabLineCurrentTab               = { fg = colors.mantle, bg = colors.red, bold = true, sp = colors.text },
        TabLineOtherTab                 = { fg = colors.mantle, bg = colors.subtext1, sp = colors.text },
        TabLineBufActiveSep             = { fg = colors.sapphire, bg = colors.crust, sp = colors.text },
        TabLineCurrentBufSep            = { fg = colors.red, bg = colors.crust, sp = colors.text },
        TabLineBufHiddenSep             = { fg = colors.subtext1, bg = colors.crust, sp = colors.text },

        DiagnosticUnnecessary           = { link = "" },

        Pmenu                           = { fg = colors.text },
        PmenuSel                        = { bg = colors.overlay0 },

        --["@conceal.checked"]            = { fg = colors.teal },
        --["@none"]                       = { link = "Normal" },
        --["@field"]                      = { fg = colors.blue },
        --["@comment.todo"]               = { fg = colors.lavender },
        --["@property"]                   = { fg = colors.blue },
        --["@variable.member"]            = { fg = colors.blue },
        --["@variable.parameter"]         = { fg = colors.sky },
        --["@parameter"]                  = { fg = colors.sky },
        --["@comment.note"]               = { link = "@comment.hint" },

        --["@lsp.type.annotation"]        = { fg = colors.darkyellow },
        --["@lsp.type.modifier.java"]     = { link = "@type.qualifier" },
        --["@lsp.mod.builtin"]            = { fg = colors.maroon },
        --["@lsp.mod.readonly.python"]    = { link = "Constant" },
        --["@lsp.mod.documentation"]      = { bold = true, fg = colors.mauve },
        --["@lsp.type.keyword"]           = { fg = colors.mauve },
      }
    end,
    latte = function(colors)
      return {
        -- ["@lsp.type.keyword"] = { fg = colors.darkyellow },

        Comment         = { fg = colors.blue },
        Conditional     = { fg = colors.darkyellow },
        Error           = { fg = colors.base, bg = colors.red },
        Exception       = { fg = colors.peach },
        Function        = { fg = colors.cyan },
        Identifier      = { fg = colors.green },
        Include         = { fg = colors.pink },
        Keyword         = { fg = colors.darkyellow },
        Operator        = { fg = colors.darkyellow },
        Parameter       = { fg = colors.sky },
        Special         = { fg = colors.flamingo },
        Statement       = { fg = colors.darkyellow },
        String          = { fg = colors.red },
        Structure       = { fg = colors.green },
        WhitespaceError = { fg = colors.base, bg = colors.red },
        Type            = { fg = colors.cyan },
        StorageClass    = { fg = colors.green },
        --Macro           = { fg = colors.magenta },
        --Define          = { fg = colors.magenta },
      }
    end,
  },
  color_overrides = {
    latte = {
        base        = "#ffffff",
        flamingo    = "#bb5d60",
        pink        = "#d54597",
        mauve       = "#a65fd5",
        red         = "#D90E18",
        maroon      = "#db3e68",
        peach       = "#e46f2a",
        yellow      = "#bc8705",
        darkyellow  = "#B2640B",
        green       = "#1a8e32",
        teal        = "#00a390",
        sky         = "#089ec0",
        sapphire    = "#0ea0a0",
        blue        = "#017bca",
        lavender    = "#8584f7",
        text        = "#222222",
        subtext1    = "#444444",
        subtext0    = "#666666",
        overlay2    = "#777777",
        overlay1    = "#888888",
        overlay0    = "#999999",
        surface2    = "#aaaaaa",
        surface1    = "#cccccc",
        surface0    = "#e5e5e5",
        mantle      = "#eeeeee",
        crust       = "#dddddd",
        cyan        = "#008080",
        magenta     = "#FF00FF",
    },
  },
  background = {
    light = "latte",
    dark = "mocha",
  },
  term_colors = true,
  -- dim_inactive = {
  --   enabled = true,
  --   shade = "light",
  --   percentage = 0.20,
  -- },
  styles = {
    comments = {},
  },
  integrations = {
    alpha = false,
    cmp = true,
    dap = true,
    dap_ui = true,
    dashboard = false,
    flash = false,
    gitsigns = true,
    leap = true,
    mini = {
      enabled = false,
    },
    mason = true,
    markdown = true,
    neogit = true,
    nvimtree = true,
    ufo = false,
    rainbow_delimiters = false,
    semantic_tokens = true,
    telescope = { enabled = true, style = "nvchad" },
    treesitter = false,
    barbecue = false,
    illuminate = false,
    indent_blankline = {
      enabled = true,
      colored_indent_levels = false,
    },
    native_lsp = {
      enabled = true,
      virtual_text = {
        errors = { "italic" },
        hints = { "italic" },
        warnings = { "italic" },
        information = { "italic" },
      },
      underlines = {
        errors = { "underline" },
        hints = { "underline" },
        warnings = { "underline" },
        information = { "underline" },
      },
      inlay_hints = {
        background = true,
      },
    },
    lsp_saga = true,
    lsp_trouble = true,
    navic = {
      enabled = false,
      custom_bg = "NONE",
    },
    dropbar = {
      enabled = false,
      color_mode = false,
    },
  },
})

vim.cmd.colorscheme("catppuccin")
