aurora / aurora.py
tejasashinde's picture
Update aurora.py
b57857e verified
from __future__ import annotations
from collections.abc import Iterable
from gradio.themes.base import Base
from gradio.themes.utils import colors, fonts, sizes
class Aurora(Base):
def __init__(
self,
*,
primary_hue: colors.Color | str = colors.emerald,
secondary_hue: colors.Color | str = colors.sky,
neutral_hue: colors.Color | str = colors.zinc,
spacing_size: sizes.Size | str = sizes.spacing_md,
radius_size: sizes.Size | str = sizes.radius_xxl,
text_size: sizes.Size | str = sizes.text_md,
font: fonts.Font | str | Iterable[fonts.Font | str] = (
fonts.GoogleFont("Noto Sans Sans"),
"ui-sans-serif",
"system-ui",
"sans-serif",
),
font_mono: fonts.Font | str | Iterable[fonts.Font | str] = (
fonts.GoogleFont("Noto Sans Display"),
"ui-monospace",
"Consolas",
"monospace",
),
):
super().__init__(
primary_hue=primary_hue,
secondary_hue=secondary_hue,
neutral_hue=neutral_hue,
spacing_size=spacing_size,
radius_size=radius_size,
text_size=text_size,
font=font,
font_mono=font_mono,
)
self.name = "aurora-gradient"
super().set(
body_background_fill="linear-gradient(135deg, #d1ffd3 0% 0%, #e9fff6 20%, #d3edff 45%, #ebd4f9 70%, #f2d0ff 100%), radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.05), transparent 70%)",
body_background_fill_dark="#121212",
body_text_color_dark="#8ab4ff",
# Minimal styling defaults
button_border_width="0.5px",
checkbox_label_border_width="1px",
button_transform_hover="scale(1.05)",
button_transition="all 0.25s ease-in-out",
# Slider gradient
slider_color="cyan",
# Primary button (Aurora gradient)
button_primary_background_fill="linear-gradient(135deg, #14e81e 0%, #00ea8d 20%, #017ed5 45%, #b53dff 70%, #8d00c4 100%), radial-gradient(circle at 30% 30%, rgba(255,255,255,0.05), transparent 70%);",
button_primary_background_fill_hover="linear-gradient(135deg, #14e81e 0%, #00ea8d 20%, #017ed5 45%, #b53dff 70%, #8d00c4 100%), radial-gradient(circle at 30% 30%, rgba(255,255,255,0.05), transparent 70%);",
button_primary_text_color="white",
# Secondary button
button_secondary_background_fill="rgba(12, 18, 35, 0.75)",
button_secondary_background_fill_hover="linear-gradient(#0000, #0000) padding-box, linear-gradient(135deg, rgb(255 255 255 / 90%) 0%, rgb(195 255 231 / 90%) 20%, rgb(101 192 255 / 90%) 45%, rgb(221 167 255 / 90%) 70%, rgb(218 122 255 / 90%) 100%);",
button_secondary_text_color="#fff",
button_secondary_text_color_hover="black",
# Button hover glows
button_primary_shadow_hover="0 0 3px rgba(90,220,255,0.35), 0 0 10px rgba(45,245,195,0.28), 0 0 20px rgba(150,120,255,0.25)",
button_secondary_shadow_hover="none",
# Dark mode variants
button_primary_background_fill_dark="linear-gradient(135deg, #14e81e 0%, #00ea8d 20%, #017ed5 45%, #b53dff 70%, #8d00c4 100%), radial-gradient(circle at 30% 30%, rgba(255,255,255,0.05), transparent 70%);",
button_primary_background_fill_hover_dark="linear-gradient(135deg, #14e81e 0%, #00ea8d 20%, #017ed5 45%, #b53dff 70%, #8d00c4 100%), radial-gradient(circle at 30% 30%, rgba(255,255,255,0.05), transparent 70%);",
button_primary_text_color_dark="white",
button_primary_text_color_hover_dark="black",
button_secondary_background_fill_dark="rgba(12, 18, 35, 0.75)",
button_secondary_background_fill_hover_dark="linear-gradient(#0000, #0000) padding-box, linear-gradient(135deg, rgb(255 255 255 / 90%) 0%, rgb(195 255 231 / 90%) 20%, rgb(101 192 255 / 90%) 45%, rgb(221 167 255 / 90%) 70%, rgb(218 122 255 / 90%) 100%);",
button_secondary_text_color_dark="#dfe7ff",
button_secondary_text_color_hover_dark="black",
button_primary_shadow_dark="0 0 3px rgba(90,220,255,0.35), 0 0 10px rgba(45,245,195,0.28), 0 0 20px rgba(150,120,255,0.25)",
button_secondary_shadow_dark="none",
block_title_background_fill="linear-gradient(135deg, #14e81e 0%, #00ea8d 20%, #017ed5 45%, #b53dff 70%, #8d00c4 100%), radial-gradient(circle at 30% 30%, rgba(255,255,255,0.05), transparent 70%);",
block_title_background_fill_dark="linear-gradient(135deg, #14e81e 0%, #00ea8d 20%, #017ed5 45%, #b53dff 70%, #8d00c4 100%), radial-gradient(circle at 30% 30%, rgba(255,255,255,0.05), transparent 70%);",
block_label_padding="*spacing_sm *spacing_lg",
block_label_background_fill="black",
block_label_background_fill_dark="linear-gradient(135deg, #14e81e 0%, #00ea8d 20%, #017ed5 45%, #b53dff 70%, #8d00c4 100%), radial-gradient(circle at 30% 30%, rgba(255,255,255,0.05), transparent 70%);",
block_label_radius="*radius_md",
block_label_text_size="*text_md",
block_label_text_weight="600",
block_label_text_color="*primary_500",
block_label_text_color_dark="white",
block_title_radius="*block_label_radius",
block_title_padding="*block_label_padding",
block_title_text_weight="600",
block_title_text_color="white",
block_title_text_color_dark="white",
block_label_margin="*spacing_md",
# Stop/Cancel Button
button_cancel_background_fill=colors.red.c500,
button_cancel_background_fill_dark=colors.red.c700,
button_cancel_background_fill_hover="crimson",
button_cancel_background_fill_hover_dark="crimson",
button_cancel_text_color="white",
button_cancel_text_color_dark="white",
button_cancel_text_color_hover="black",
button_cancel_text_color_hover_dark="black",
button_cancel_shadow_dark="0 0 3px rgba(90,220,255,0.35), 0 0 10px rgba(45,245,195,0.28), 0 0 20px rgba(150,120,255,0.25)",
button_cancel_shadow="none",
# Block shadows (glassy Aurora)
block_shadow="0 0 10px rgba(45, 245, 195, 0.2), 0 0 20px rgba(89, 211, 255, 0.15), 0 0 30px rgba(157, 106, 255, 0.1)",
# Checkbox selection gradient (Aurora)
checkbox_label_background_fill_selected="linear-gradient(135deg, #14e81e 0%, #00ea8d 20%, #017ed5 45%, #b53dff 70%, #8d00c4 100%), radial-gradient(circle at 30% 30%, rgba(255,255,255,0.05), transparent 70%);",
checkbox_label_border_color_selected="#2df5c3",
checkbox_background_color_selected="#2df5c3",
checkbox_label_text_color="#fff",
checkbox_label_text_color_selected="#05090f",
checkbox_label_background_fill_selected_dark="linear-gradient(135deg, #14e81e 0%, #00ea8d 20%, #017ed5 45%, #b53dff 70%, #8d00c4 100%), radial-gradient(circle at 30% 30%, rgba(255,255,255,0.05), transparent 70%);",
checkbox_label_border_color_selected_dark="#2df5c3",
checkbox_background_color_selected_dark="#2df5c3",
checkbox_label_text_color_selected_dark="#05090f",
)
aurora = Aurora()