package com.huangzj.protoplugin.memo;

import java.awt.Color;

/** 非 IDE 默认主题下的色板（IDE 默认走 {@link com.intellij.util.ui.UIUtil}）。 */
final class MemoThemeSpec {

    final Color panelBg;
    final Color editorBg;
    final Color text;
    final Color accent;
    final Color listBg;
    final Color listSelectedBg;
    final Color listSelectedFg;
    final Color buttonBg;
    final Color buttonFg;
    final Color fieldBorder;

    private MemoThemeSpec(
            Color panelBg,
            Color editorBg,
            Color text,
            Color accent,
            Color listBg,
            Color listSelectedBg,
            Color listSelectedFg,
            Color buttonBg,
            Color buttonFg,
            Color fieldBorder) {
        this.panelBg = panelBg;
        this.editorBg = editorBg;
        this.text = text;
        this.accent = accent;
        this.listBg = listBg;
        this.listSelectedBg = listSelectedBg;
        this.listSelectedFg = listSelectedFg;
        this.buttonBg = buttonBg;
        this.buttonFg = buttonFg;
        this.fieldBorder = fieldBorder;
    }

    static MemoThemeSpec forTheme(MemoUiTheme theme) {
        switch (theme) {
            case IDE_DEFAULT:
                throw new IllegalArgumentException("IDE 默认请走 UIUtil");
            case DARK_FOCUS:
                return new MemoThemeSpec(
                        c(0x1E293B),
                        c(0x0F172A),
                        c(0xE2E8F0),
                        c(0x22D3EE),
                        c(0x334155),
                        c(0x0E7490),
                        c(0xECFEFF),
                        c(0x22D3EE),
                        c(0x0F172A),
                        c(0x475569));
            case PAPER:
                return new MemoThemeSpec(
                        c(0xF5F0E6),
                        c(0xFFFBF5),
                        c(0x3D3428),
                        c(0x8B6914),
                        c(0xEDE4D3),
                        c(0xD4C4A8),
                        c(0x2C2416),
                        c(0x8B6914),
                        c(0xFFFBF5),
                        c(0xC4B59A));
            case OCEAN:
                return new MemoThemeSpec(
                        c(0xE0F2FE),
                        c(0xFFFFFF),
                        c(0x0C4A6E),
                        c(0x0284C7),
                        c(0xF0F9FF),
                        c(0xBAE6FD),
                        c(0x0C4A6E),
                        c(0x0284C7),
                        c(0xFFFFFF),
                        c(0x7DD3FC));
            case CUTE_CANDY:
                return new MemoThemeSpec(
                        c(0xFFF5F9),
                        c(0xFFFFFF),
                        c(0x6B2D5C),
                        c(0xFF6B9D),
                        c(0xFFE4F0),
                        c(0xFFC8E6),
                        c(0x4A1942),
                        c(0xFF8FAB),
                        c(0xFFFFFF),
                        c(0xFFB3D1));
            default:
                throw new IllegalStateException();
        }
    }

    private static Color c(int rgb) {
        return new Color(rgb);
    }
}
