"""Shared color palette for NexusOS theme builds.

Source of truth is NexusOS/gtk-3.0/colors.css. Keep these in sync.
Hex strings have no leading '#'.
"""

# Brand
BRAND_GREEN        = "8cc63f"
BRAND_GREEN_LIGHT  = "b8e373"
BRAND_GREEN_DARK   = "6ba62a"
BRAND_PURPLE       = "88008f"
BRAND_PURPLE_LIGHT = "a232a8"
BRAND_PURPLE_DARK  = "5e0066"

# Foundation
BASE_BG        = "1e1526"
SURFACE_BG     = "1f2225"
SURFACE_BG_ALT = "2a2e32"
OVERLAY_BG     = "2e3236"
BORDER         = "2e3236"
BORDER_STRONG  = "3a3d41"

# Text
TEXT_PRIMARY      = "f2f2f2"
TEXT_SECONDARY    = "a8a8a8"
TEXT_DISABLED     = "6e7173"
TEXT_ON_ACCENT    = "0a0a00"
TEXT_ON_SELECTION = "ffffff"

# Semantic
SUCCESS = "27ae60"
WARNING = "f67400"
ERROR   = "da4453"


def hex_to_rgb(h):
    h = h.lstrip("#")
    return (int(h[0:2], 16), int(h[2:4], 16), int(h[4:6], 16))


def hex_to_hsv(h):
    import colorsys
    r, g, b = hex_to_rgb(h)
    return colorsys.rgb_to_hsv(r / 255, g / 255, b / 255)
