import omni.ui as ui


class Styles:

    ITEM_DARK = None
    ITEM_GRAY = None
    ITEM_HOVER = None
    ITEM_SEL = None
    ITEM_BG_SEL = None

    ICON_DARK = None

    STAGE_WIDGET = None

    @staticmethod
    def on_startup():
        from .stage_icons import StageIcons as Icons
        # List Items
        Styles.ITEM_DARK = 0x7723211F
        Styles.ITEM_GRAY = 0xFF8A8777
        Styles.ITEM_HOVER = 0xFFBBBAAA
        Styles.ITEM_SEL = 0xFFDDDCCC
        Styles.ITEM_BG_SEL = 0x66888777

        Styles.LIVE_GREEN = 0xFF00B86B
        Styles.LIVE_SEL = 0xFF00F86E
        Styles.RELOAD_ORANGE = 0xFF0088CC
        Styles.RELOAD_SEL = 0xFF00AAFF

        Styles.STAGE_WIDGET = {
            "Button.Image::filter": {"image_url": Icons().get("filter"), "color": 0xFF8A8777},
            "Button.Image::options": {"image_url": Icons().get("options"), "color": 0xFF8A8777},
            "Button.Image::visibility": {"image_url": Icons().get("eye_on"), "color": 0xFF8A8777},
            "Button.Image::visibility:checked": {"image_url": Icons().get("eye_off"), "color": 0x88DDDCCC},
            "Button.Image::visibility:disabled": {"color": 0x608A8777},
            "Button.Image::visibility:selected": {"color": 0xFFCCCCCC},
            "Button::filter": {"background_color": 0x0, "margin": 0},
            "Button::options": {"background_color": 0x0, "margin": 0},
            "Button::visibility": {"background_color": 0x0, "margin": 0, "margin_width": 1},
            "Button::visibility:checked": {"background_color": 0x0},
            "Button::visibility:hovered": {"background_color": 0x0},
            "Button::visibility:pressed": {"background_color": 0x0},
            "Label::search": {"color": 0xFF808080, "margin_width": 4},
            "Menu.CheckBox": {"background_color": 0x0, "margin": 0},
            "Menu.CheckBox::drag": {
                "image_url": Icons().get("drag"),
                "color": 0xFF505050,
                "alignment": ui.Alignment.CENTER,
            },
            "Menu.CheckBox.Image": {"image_url": Icons().get("check_off"), "color": 0xFF8A8777},
            "Menu.CheckBox.Image:checked": {"image_url": Icons().get("check_on"), "color": 0x34C7FFFF},
            "TreeView": {
                "background_color": 0xFF23211F,
                "background_selected_color": 0x664F4D43,
                "secondary_color": 0xFF403B3B,
                "border_width": 1.5,
            },
            "TreeView.ScrollingFrame": {"background_color": 0xFF23211F},
            "TreeView.Image::object_icon_grey": {"color": 0x80FFFFFF},
            "TreeView.Image:disabled": {"color": 0x60FFFFFF},
            "TreeView.Item": {"color": Styles.ITEM_GRAY},
            "TreeView.Item:disabled": {"color": 0x608A8777},
            "TreeView.Item::object_name_grey": {"color": 0xFF4D4B42},
            "TreeView.Item::object_name_missing": {"color": 0xFF6F72FF},
            "TreeView.Item::object_name_missing:hovered": {"color": 0xFF6F72FF},
            "TreeView.Item::object_name_missing:selected": {"color": 0xFF6F72FF},
            "TreeView.Item:hovered": {"color": Styles.ITEM_HOVER},
            "TreeView.Item:selected": {"color": Styles.ITEM_SEL},
            "TreeView.Item.Outdated": {"color": Styles.RELOAD_ORANGE},
            "TreeView.Item.Outdated:hovered": {"color": Styles.RELOAD_SEL},
            "TreeView.Item.Outdated:selected": {"color": Styles.RELOAD_SEL},
            "TreeView.Item.Live": {"color": Styles.LIVE_GREEN},
            "TreeView.Item.Live:hovered": {"color": Styles.LIVE_SEL},
            "TreeView.Item.Live:selected": {"color": Styles.LIVE_SEL},
            "TreeView:selected": {"background_color": Styles.ITEM_BG_SEL},
            "TreeView:drop": {
                "background_color": ui.color.shade(ui.color("#34C7FF3B")),
                "background_selected_color": ui.color.shade(ui.color("#34C7FF3B")),
                "border_color": ui.color.shade(ui.color("#2B87AA")),
            },
            # Top of the column section (that has sorting options)
            "TreeView.Header": {"background_color": 0xFF343432, "color": 0xFFCCCCCC, "font_size": 12},
            "TreeView.Header::visibility_header": {"image_url": Icons().get("eye_header"), "color": 0xFF888888},
            "TreeView.Header::drop_down_background": {"background_color": 0xE0808080},
            "TreeView.Header::drop_down_button": {"background_color": ui.color.white},
            "TreeView.Header::drop_down_hovered_area": {"background_color": ui.color.transparent},
            "TreeView.Header::hovering": {"background_color": 0x0, "border_radius": 1.5},
            "TreeView.Header::hovering:hovered": {
                "background_color": ui.color.shade(ui.color("#34C7FF3B")),
                "border_width": 1.5,
                "border_color": ui.color.shade(ui.color("#2B87AA"))
            }
        }
