-- Bearded Arc Theme
-- Based on: https://github.com/BeardedBear/bearded-theme
-- Adapted for WezTerm

local main = {}

local main_palette = {
    base = '#1c2433',
    overlay = '#212a3b',
    muted = '#4a5e84',
    text = '#afbbd2',
    red = '#FF738A',
    yellow = '#EACD61',
    orange = '#FF955C',
    green = '#3CEC85',
    cyan = '#69C3FF',
    purple = '#B78AFF',
    highlight = '#8196b5',
}

local main_active_tab = {
    bg_color = main_palette.overlay,
    fg_color = main_palette.text,
}

local main_inactive_tab = {
    bg_color = main_palette.base,
    fg_color = main_palette.muted,
}

function main.colors()
    return {
        foreground = main_palette.text,
        background = main_palette.base,
        cursor_bg = main_palette.yellow,
        cursor_border = main_palette.yellow,
        cursor_fg = main_palette.text,
        selection_bg = '#405275',
        selection_fg = main_palette.text,

        ansi = {
            main_palette.overlay,
            main_palette.red,
            main_palette.green,
            main_palette.yellow,
            main_palette.cyan,
            main_palette.purple,
            main_palette.orange,
            main_palette.text,
        },

        brights = {
            main_palette.muted,
            main_palette.red,
            main_palette.green,
            main_palette.yellow,
            main_palette.cyan,
            main_palette.purple,
            main_palette.orange,
            main_palette.text,
        },

        tab_bar = {
            background = main_palette.base,
            active_tab = main_active_tab,
            inactive_tab = main_inactive_tab,
            inactive_tab_hover = main_active_tab,
            new_tab = main_inactive_tab,
            new_tab_hover = main_active_tab,
            inactive_tab_edge = main_palette.muted, -- (Fancy tab bar only)
        },
    }
end

function main.window_frame() -- (Fancy tab bar only)
    return {
        active_titlebar_bg = main_palette.base,
        inactive_titlebar_bg = main_palette.base,
    }
end

local moon = {}

local moon_palette = {
    base = '#1a212f',
    overlay = '#253043',
    muted = '#4a5e84',
    text = '#afbbd2',
    red = '#FF738A',
    yellow = '#EACD61',
    orange = '#FF955C',
    green = '#3CEC85',
    cyan = '#69C3FF',
    purple = '#B78AFF',
    highlight = '#8196b5',
}

local moon_active_tab = {
    bg_color = moon_palette.overlay,
    fg_color = moon_palette.text,
}

local moon_inactive_tab = {
    bg_color = moon_palette.base,
    fg_color = moon_palette.muted,
}

function moon.colors()
    return {
        foreground = moon_palette.text,
        background = moon_palette.base,
        cursor_bg = moon_palette.yellow,
        cursor_border = moon_palette.yellow,
        cursor_fg = moon_palette.text,
        selection_bg = moon_palette.overlay,
        selection_fg = moon_palette.text,

        ansi = {
            moon_palette.overlay,
            moon_palette.red,
            moon_palette.green,
            moon_palette.yellow,
            moon_palette.cyan,
            moon_palette.purple,
            moon_palette.orange,
            moon_palette.text,
        },

        brights = {
            moon_palette.muted,
            moon_palette.red,
            moon_palette.green,
            moon_palette.yellow,
            moon_palette.cyan,
            moon_palette.purple,
            moon_palette.orange,
            moon_palette.text,
        },

        tab_bar = {
            background = moon_palette.base,
            active_tab = moon_active_tab,
            inactive_tab = moon_inactive_tab,
            inactive_tab_hover = moon_active_tab,
            new_tab = moon_inactive_tab,
            new_tab_hover = moon_active_tab,
            inactive_tab_edge = moon_palette.muted, -- (Fancy tab bar only)
        },
    }
end

function moon.window_frame() -- (Fancy tab bar only)
    return {
        active_titlebar_bg = moon_palette.base,
        inactive_titlebar_bg = moon_palette.base,
    }
end

local dawn = {}

local dawn_palette = {
    base = '#151b26',
    overlay = '#1a212f',
    muted = '#4a5e84',
    text = '#d0d7e4',
    red = '#E35535',
    yellow = '#FF955C',
    magenta = '#F38CEC',
    green = '#3CEC85',
    cyan = '#69C3FF',
    purple = '#B78AFF',
    highlight = '#405275',
}

local dawn_active_tab = {
    bg_color = dawn_palette.overlay,
    fg_color = dawn_palette.text,
}

local dawn_inactive_tab = {
    bg_color = dawn_palette.base,
    fg_color = dawn_palette.muted,
}

function dawn.colors()
    return {
        foreground = dawn_palette.text,
        background = dawn_palette.base,
        cursor_bg = dawn_palette.muted,
        cursor_border = dawn_palette.muted,
        cursor_fg = dawn_palette.text,
        selection_bg = dawn_palette.overlay,
        selection_fg = dawn_palette.text,

        ansi = {
            dawn_palette.overlay,
            dawn_palette.red,
            dawn_palette.green,
            dawn_palette.yellow,
            dawn_palette.cyan,
            dawn_palette.purple,
            dawn_palette.magenta,
            dawn_palette.text,
        },

        brights = {
            dawn_palette.muted,
            dawn_palette.red,
            dawn_palette.green,
            dawn_palette.yellow,
            dawn_palette.cyan,
            dawn_palette.purple,
            dawn_palette.magenta,
            dawn_palette.text,
        },

        tab_bar = {
            background = dawn_palette.base,
            active_tab = dawn_active_tab,
            inactive_tab = dawn_inactive_tab,
            inactive_tab_hover = dawn_active_tab,
            new_tab = dawn_inactive_tab,
            new_tab_hover = dawn_active_tab,
            inactive_tab_edge = dawn_palette.muted, -- (Fancy tab bar only)
        },
    }
end

function dawn.window_frame() -- (Fancy tab bar only)
    return {
        active_titlebar_bg = dawn_palette.base,
        inactive_titlebar_bg = dawn_palette.base,
    }
end

return {
    main = main,
    moon = moon,
    dawn = dawn,
}
