import dearpygui.dearpygui as dpg

FONT_PATH = "fonts\\Montserrat-Medium.ttf"
FONT_SIZE = 24
ACCENT_COLOR = (0, 119, 200, 100)
ROUNDING = 10
SPACE = 10
INDENT = 40
ICON_PATH = "icons\\icon.ico"
BORDER = 3

class GuiStyle:
    def __init__(self):
        self.font_registry = dpg.add_font_registry()
        self.montserrat_font = dpg.add_font(FONT_PATH, FONT_SIZE, parent=self.font_registry)

        self.main_theme = dpg.add_theme()
        theme_all = dpg.add_theme_component(dpg.mvAll, parent=self.main_theme, tag="theme_all")
        
        accents = (
            dpg.mvThemeCol_Border,
            dpg.mvThemeCol_CheckMark,
            dpg.mvThemeCol_SliderGrab,
            dpg.mvThemeCol_ScrollbarGrab,
            dpg.mvThemeCol_TabActive,
            dpg.mvThemeCol_ButtonActive,
            dpg.mvThemeCol_Separator,
            dpg.mvThemeCol_ResizeGripActive
        )

        rounding = (
            dpg.mvStyleVar_ChildRounding,
            dpg.mvStyleVar_WindowRounding,
            dpg.mvStyleVar_FrameRounding,
            dpg.mvStyleVar_TabRounding,
            dpg.mvStyleVar_GrabRounding,
            dpg.mvStyleVar_ScrollbarRounding,
            dpg.mvStyleVar_PopupRounding
        )

        spacing = (
            dpg.mvStyleVar_ItemSpacing,
            dpg.mvStyleVar_ItemInnerSpacing,
            dpg.mvStyleVar_WindowPadding,
            dpg.mvStyleVar_FramePadding,
        )

        for item in accents:
            dpg.add_theme_color(item, ACCENT_COLOR, category=dpg.mvThemeCat_Core, parent=theme_all)

        # dpg.add_theme_color(dpg.mvThemeCol_Header, (255, 0, 0), category=dpg.mvThemeCat_Core, parent=theme_all)
        # dpg.add_theme_color(dpg.mvThemeCol_HeaderHovered, (255, 0, 0), category=dpg.mvThemeCat_Core, parent=theme_all)
        # dpg.add_theme_color(dpg.mvThemeCol_HeaderActive, (255, 0, 0), category=dpg.mvThemeCat_Core, parent=theme_all)


        for item in rounding:
            dpg.add_theme_style(item, ROUNDING, category=dpg.mvThemeCat_Core, parent=theme_all)
        
        for item in spacing:
            dpg.add_theme_style(item, SPACE, SPACE, category=dpg.mvThemeCat_Core, parent=theme_all)

        dpg.add_theme_style(dpg.mvStyleVar_IndentSpacing, 30, category=dpg.mvThemeCat_Core, parent=theme_all)
        dpg.add_theme_style(dpg.mvStyleVar_ChildBorderSize, BORDER, category=dpg.mvThemeCat_Core, parent=theme_all)
        dpg.add_theme_style(dpg.mvStyleVar_WindowBorderSize, 0, category=dpg.mvThemeCat_Core, parent=theme_all)
        dpg.add_theme_style(dpg.mvStyleVar_FrameBorderSize, 0, category=dpg.mvThemeCat_Core, parent=theme_all)
        dpg.add_theme_style(dpg.mvStyleVar_WindowMinSize, 200, 200, category=dpg.mvThemeCat_Core, parent=theme_all)