import { getColorsList } from "./color";
import light from "./light";
import { getShades } from "./shadeCalculator";
const ThemesMap = {};
export function registerTheme(id, theme) {
    return (ThemesMap[id] = {
        id,
        // @ts-ignore
        theme,
    });
}
export const getTheme = (id) => {
    return ThemesMap[id] || light;
};
export function applyTheme(id, options, fonts) {
    const theme = getTheme(id);
    const lightShadesMap = {
        0: "lighter",
        1: "lightest",
    };
    const darkShadesMap = {
        0: "darker",
        1: "darkest",
    };
    const darkColors = getColorsList(2, 90, "black", 0, 0, options.primaryColor).map((color) => color);
    const lightColors = getColorsList(2, 70, "white", 0, 0, options.primaryColor).map((color) => color);
    const colors = {
        primary: options.primaryColor,
    };
    darkColors.forEach((color, i) => {
        colors[`primary_${darkShadesMap[i]}`] = color;
    });
    lightColors.forEach((color, i) => {
        colors[`primary_${lightShadesMap[i]}`] = color;
    });
    colors["bg_dark"] = "#343434";
    colors["bg_light"] = "#FFFFFF";
    const customTheme = Object.assign(Object.assign({}, theme.theme), { styles: {
            global: {
                body: {
                    backgroundColor: "brand.900",
                    fontSize: "sm",
                },
            },
        }, colors: Object.assign(Object.assign({}, theme.theme.colors), { brand: getShades(options.primaryColor), qore: colors }), fonts: {
            heading: fonts.heading,
            body: fonts.body,
        }, components: Object.assign(Object.assign({}, theme.theme.components), { List: {
                baseStyle: {
                    container: {
                        boxShadow: undefined,
                    },
                },
            }, Text: {
                baseStyle: Object.assign(Object.assign({}, theme.theme.components.Text.baseStyle), { fontSize: "sm" }),
            }, FormLabel: {
                baseStyle: {
                    fontSize: "sm",
                },
            } }) });
    return customTheme;
}
export function getThemes() {
    return Object.values(ThemesMap);
}
export default ThemesMap;
//# sourceMappingURL=index.js.map