Strongly Typed & C-Compiled
Fully compiled to C via MyPyC with strict static typing for maximum execution speed.
A modern, high-performance Python library to simplify common tasks.
pip install xulbuximport xulbux as xx
from xulbux import S, hexa
# Prompt the user with styled input:
input_hexa_str = xx.console.input(
(S.BOLD("Enter a hex color"), S.DIM(" > ")),
placeholder="#FF3D5D",
)
# Initialize the input string as a `hexa()` object:
hexa_color = hexa(input_hexa_str)
# Nicely display the color in different formats:
xx.console.box(
(S.BOLD | S.BG.hex(hexa_color).with_text_fg())(" Preview "),
"{hr}",
(S.BOLD("HEXA: "), S.ITALIC(str(hexa_color))),
(S.BOLD("RGBA: "), S.ITALIC(str(hexa_color.as_rgba()))),
(S.BOLD("HSLA: "), S.ITALIC(str(hexa_color.as_hsla()))),
border_style=S.DIM,
end="\n\n",
)Enter a hex color > a8f
╭─────────────────────────────╮
│ Preview │
├─────────────────────────────┤
│ HEXA: #AA88FF │
│ RGBA: rgba(170, 136, 255) │
│ HSLA: hsla(257°, 100%, 77%) │
╰─────────────────────────────╯