Spaces:
Sleeping
Sleeping
Update canva_theme.py
Browse files- canva_theme.py +41 -42
canva_theme.py
CHANGED
|
@@ -3,21 +3,20 @@ from __future__ import annotations
|
|
| 3 |
from gradio.themes.base import Base
|
| 4 |
from gradio.themes.utils import fonts
|
| 5 |
|
| 6 |
-
# Import our custom colors with the exact names we defined
|
| 7 |
from colors import (
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
|
|
|
| 17 |
)
|
| 18 |
from sizes import spacing_md, radius_sm, text_md
|
| 19 |
|
| 20 |
-
|
| 21 |
class CanvaTheme(Base):
|
| 22 |
def __init__(
|
| 23 |
self,
|
|
@@ -34,7 +33,7 @@ class CanvaTheme(Base):
|
|
| 34 |
super().__init__(
|
| 35 |
primary_hue=purple,
|
| 36 |
secondary_hue=blue,
|
| 37 |
-
neutral_hue=neutral
|
| 38 |
spacing_size=spacing_md,
|
| 39 |
radius_size=radius_sm,
|
| 40 |
text_size=text_md,
|
|
@@ -43,23 +42,23 @@ class CanvaTheme(Base):
|
|
| 43 |
)
|
| 44 |
|
| 45 |
super().set(
|
| 46 |
-
# Colors
|
| 47 |
body_background_fill=white["white"],
|
| 48 |
-
body_background_fill_dark=
|
| 49 |
background_fill_primary=white["white"],
|
| 50 |
-
background_fill_primary_dark=
|
| 51 |
-
background_fill_secondary=
|
| 52 |
-
background_fill_secondary_dark=
|
| 53 |
|
| 54 |
# Border colors
|
| 55 |
-
border_color_primary=
|
| 56 |
-
border_color_primary_dark=
|
| 57 |
|
| 58 |
# Text colors
|
| 59 |
-
body_text_color=
|
| 60 |
-
body_text_color_dark=
|
| 61 |
-
body_text_color_subdued=
|
| 62 |
-
body_text_color_subdued_dark=
|
| 63 |
|
| 64 |
# Button styling
|
| 65 |
button_primary_background_fill=purple.c500,
|
|
@@ -69,36 +68,36 @@ class CanvaTheme(Base):
|
|
| 69 |
button_primary_text_color=white["white"],
|
| 70 |
button_primary_text_color_dark=white["white"],
|
| 71 |
|
| 72 |
-
button_secondary_background_fill=
|
| 73 |
-
button_secondary_background_fill_dark=
|
| 74 |
-
button_secondary_background_fill_hover=
|
| 75 |
-
button_secondary_background_fill_hover_dark=
|
| 76 |
-
button_secondary_text_color=
|
| 77 |
-
button_secondary_text_color_dark=
|
| 78 |
|
| 79 |
# Input styling
|
| 80 |
-
input_background_fill=
|
| 81 |
-
input_background_fill_dark=
|
| 82 |
-
input_border_color=
|
| 83 |
-
input_border_color_dark=
|
| 84 |
input_border_width="1px",
|
| 85 |
|
| 86 |
# Block styling
|
| 87 |
block_label_background_fill=white["white"],
|
| 88 |
-
block_label_background_fill_dark=
|
| 89 |
-
block_title_text_color=
|
| 90 |
-
block_title_text_color_dark=
|
| 91 |
|
| 92 |
# Shadow effects
|
| 93 |
shadow_drop="0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
|
| 94 |
shadow_drop_lg="0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
|
| 95 |
|
| 96 |
-
# Border radius
|
| 97 |
radius_sm=radius_sm.md,
|
| 98 |
radius_md=radius_sm.lg,
|
| 99 |
radius_lg=radius_sm.xl,
|
| 100 |
|
| 101 |
-
# Link colors
|
| 102 |
link_text_color=purple.c500,
|
| 103 |
link_text_color_dark=purple.c400,
|
| 104 |
link_text_color_hover=purple.c600,
|
|
@@ -106,7 +105,7 @@ class CanvaTheme(Base):
|
|
| 106 |
|
| 107 |
# Error states
|
| 108 |
error_background_fill=red.c50,
|
| 109 |
-
error_background_fill_dark=
|
| 110 |
error_text_color=red.c600,
|
| 111 |
error_text_color_dark=red.c200,
|
| 112 |
error_border_color=red.c500,
|
|
@@ -120,7 +119,7 @@ class CanvaTheme(Base):
|
|
| 120 |
overlay_background_fill=black["blackA50"],
|
| 121 |
|
| 122 |
# Additional button states using alpha colors
|
| 123 |
-
button_primary_border_color=purpleA["
|
| 124 |
-
button_secondary_border_color=
|
| 125 |
-
button_secondary_border_color_dark=
|
| 126 |
)
|
|
|
|
| 3 |
from gradio.themes.base import Base
|
| 4 |
from gradio.themes.utils import fonts
|
| 5 |
|
|
|
|
| 6 |
from colors import (
|
| 7 |
+
purple, # Primary brand color
|
| 8 |
+
blue, # Secondary color
|
| 9 |
+
green, # Success states
|
| 10 |
+
red, # Error states
|
| 11 |
+
yellow, # Warning states
|
| 12 |
+
white, # Light theme backgrounds
|
| 13 |
+
black, # Dark theme backgrounds
|
| 14 |
+
grey, # UI element colors
|
| 15 |
+
purpleA, # Alpha variations of purple
|
| 16 |
+
gradients # Brand gradients
|
| 17 |
)
|
| 18 |
from sizes import spacing_md, radius_sm, text_md
|
| 19 |
|
|
|
|
| 20 |
class CanvaTheme(Base):
|
| 21 |
def __init__(
|
| 22 |
self,
|
|
|
|
| 33 |
super().__init__(
|
| 34 |
primary_hue=purple,
|
| 35 |
secondary_hue=blue,
|
| 36 |
+
neutral_hue=grey, # Using grey instead of neutral
|
| 37 |
spacing_size=spacing_md,
|
| 38 |
radius_size=radius_sm,
|
| 39 |
text_size=text_md,
|
|
|
|
| 42 |
)
|
| 43 |
|
| 44 |
super().set(
|
| 45 |
+
# Colors using grey for UI elements
|
| 46 |
body_background_fill=white["white"],
|
| 47 |
+
body_background_fill_dark=black["black"],
|
| 48 |
background_fill_primary=white["white"],
|
| 49 |
+
background_fill_primary_dark=grey["greyUltraDark"],
|
| 50 |
+
background_fill_secondary=grey["greyLight"],
|
| 51 |
+
background_fill_secondary_dark=grey["greyDark"],
|
| 52 |
|
| 53 |
# Border colors
|
| 54 |
+
border_color_primary=grey["greyLight"],
|
| 55 |
+
border_color_primary_dark=grey["greyDark"],
|
| 56 |
|
| 57 |
# Text colors
|
| 58 |
+
body_text_color=black["black"],
|
| 59 |
+
body_text_color_dark=white["white"],
|
| 60 |
+
body_text_color_subdued=grey["greyDark"],
|
| 61 |
+
body_text_color_subdued_dark=grey["greyLight"],
|
| 62 |
|
| 63 |
# Button styling
|
| 64 |
button_primary_background_fill=purple.c500,
|
|
|
|
| 68 |
button_primary_text_color=white["white"],
|
| 69 |
button_primary_text_color_dark=white["white"],
|
| 70 |
|
| 71 |
+
button_secondary_background_fill=grey["greyLight"],
|
| 72 |
+
button_secondary_background_fill_dark=grey["greyDark"],
|
| 73 |
+
button_secondary_background_fill_hover=grey["greyUltraLight"],
|
| 74 |
+
button_secondary_background_fill_hover_dark=grey["greyUltraDark"],
|
| 75 |
+
button_secondary_text_color=black["black"],
|
| 76 |
+
button_secondary_text_color_dark=white["white"],
|
| 77 |
|
| 78 |
# Input styling
|
| 79 |
+
input_background_fill=grey["greyLight"],
|
| 80 |
+
input_background_fill_dark=grey["greyDark"],
|
| 81 |
+
input_border_color=grey["greyLight"],
|
| 82 |
+
input_border_color_dark=grey["greyDark"],
|
| 83 |
input_border_width="1px",
|
| 84 |
|
| 85 |
# Block styling
|
| 86 |
block_label_background_fill=white["white"],
|
| 87 |
+
block_label_background_fill_dark=grey["greyUltraDark"],
|
| 88 |
+
block_title_text_color=grey["greyDark"],
|
| 89 |
+
block_title_text_color_dark=grey["greyLight"],
|
| 90 |
|
| 91 |
# Shadow effects
|
| 92 |
shadow_drop="0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
|
| 93 |
shadow_drop_lg="0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
|
| 94 |
|
| 95 |
+
# Border radius
|
| 96 |
radius_sm=radius_sm.md,
|
| 97 |
radius_md=radius_sm.lg,
|
| 98 |
radius_lg=radius_sm.xl,
|
| 99 |
|
| 100 |
+
# Link colors
|
| 101 |
link_text_color=purple.c500,
|
| 102 |
link_text_color_dark=purple.c400,
|
| 103 |
link_text_color_hover=purple.c600,
|
|
|
|
| 105 |
|
| 106 |
# Error states
|
| 107 |
error_background_fill=red.c50,
|
| 108 |
+
error_background_fill_dark=grey["greyUltraDark"],
|
| 109 |
error_text_color=red.c600,
|
| 110 |
error_text_color_dark=red.c200,
|
| 111 |
error_border_color=red.c500,
|
|
|
|
| 119 |
overlay_background_fill=black["blackA50"],
|
| 120 |
|
| 121 |
# Additional button states using alpha colors
|
| 122 |
+
button_primary_border_color=purpleA["purpleA00"],
|
| 123 |
+
button_secondary_border_color=grey["greyLight"],
|
| 124 |
+
button_secondary_border_color_dark=grey["greyDark"],
|
| 125 |
)
|