from pathlib import Path

import omni.ui as ui
from omni.ui import color as cl
from omni.ui import constant as fl

CURRENT_PATH = Path(__file__).parent
ICON_PATH = CURRENT_PATH.parent.parent.parent.parent.joinpath("icons")

fl.welcome_extensions_scroll_size = 10


EXTENSIONS_PAGE_STYLE = {
    "Extensions.Label": {"color": cl.welcome_label},
    "Extensions.Button": {
        "padding": 0,
        "background_color": cl.welcome_content_background,
        "stack_direction": ui.Direction.LEFT_TO_RIGHT,
    },
    "Extensions.Button.Label": {"color": cl.welcome_label},
    "Extensions.Button.Image::refresh": {"image_url": f"{ICON_PATH}/refresh.svg", "color": cl.welcome_label},
    "Extensions.Button.Image::update": {"image_url": f"{ICON_PATH}/update_all.svg", "color": cl.welcome_label},
    "Extensions.Frame": {
        "background_color": cl.transparent,
        "secondary_color": 0xFF666666,
        "border_radius": 0,
        "scrollbar_size": 10,
    },
    "Card.Background": {"border_radius": 10, "border_width": 1, "border_color": 0xFF707070, "background_color": 0xFF2E2C29},
    "Card.Name": {"color": 0xFF38B583, "font_size": 16},
    "Card.Icon": {"padding": 0, "margin": 0},
    "Card.Version": {"color": cl.welcome_label, "font_size": 10},
    "Card.Description": {"color": cl.welcome_label, "font_size": 16},
    "Card.Button": {"border_radius": 4, "background_color": 0xFF38B583, "margin": 10},
    "Card.Button.Label": {"color": 0xFFD9F1E8},
}
