Spaces:
Sleeping
Sleeping
Update canva_theme.py
Browse files- canva_theme.py +45 -42
canva_theme.py
CHANGED
|
@@ -5,15 +5,14 @@ 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, #
|
| 13 |
-
black, #
|
| 14 |
-
|
| 15 |
-
purpleA, # Alpha variations of purple
|
| 16 |
-
gradients # Brand gradients
|
| 17 |
)
|
| 18 |
from sizes import spacing_md, radius_sm, text_md
|
| 19 |
|
|
@@ -33,7 +32,7 @@ class CanvaTheme(Base):
|
|
| 33 |
super().__init__(
|
| 34 |
primary_hue=purple,
|
| 35 |
secondary_hue=blue,
|
| 36 |
-
neutral_hue=grey,
|
| 37 |
spacing_size=spacing_md,
|
| 38 |
radius_size=radius_sm,
|
| 39 |
text_size=text_md,
|
|
@@ -42,51 +41,51 @@ class CanvaTheme(Base):
|
|
| 42 |
)
|
| 43 |
|
| 44 |
super().set(
|
| 45 |
-
# Colors
|
| 46 |
-
body_background_fill=white
|
| 47 |
-
body_background_fill_dark=black
|
| 48 |
-
background_fill_primary=white
|
| 49 |
-
background_fill_primary_dark=
|
| 50 |
-
background_fill_secondary=grey
|
| 51 |
-
background_fill_secondary_dark=grey
|
| 52 |
|
| 53 |
# Border colors
|
| 54 |
-
border_color_primary=grey
|
| 55 |
-
border_color_primary_dark=grey
|
| 56 |
|
| 57 |
# Text colors
|
| 58 |
-
body_text_color=black
|
| 59 |
-
body_text_color_dark=white
|
| 60 |
-
body_text_color_subdued=grey
|
| 61 |
-
body_text_color_subdued_dark=grey
|
| 62 |
|
| 63 |
# Button styling
|
| 64 |
button_primary_background_fill=purple.c500,
|
| 65 |
button_primary_background_fill_dark=purple.c600,
|
| 66 |
button_primary_background_fill_hover=purple.c600,
|
| 67 |
button_primary_background_fill_hover_dark=purple.c700,
|
| 68 |
-
button_primary_text_color=white
|
| 69 |
-
button_primary_text_color_dark=white
|
| 70 |
|
| 71 |
-
button_secondary_background_fill=grey
|
| 72 |
-
button_secondary_background_fill_dark=grey
|
| 73 |
-
button_secondary_background_fill_hover=grey
|
| 74 |
-
button_secondary_background_fill_hover_dark=grey
|
| 75 |
-
button_secondary_text_color=black
|
| 76 |
-
button_secondary_text_color_dark=white
|
| 77 |
|
| 78 |
# Input styling
|
| 79 |
-
input_background_fill=grey
|
| 80 |
-
input_background_fill_dark=grey
|
| 81 |
-
input_border_color=grey
|
| 82 |
-
input_border_color_dark=grey
|
| 83 |
input_border_width="1px",
|
| 84 |
|
| 85 |
# Block styling
|
| 86 |
-
block_label_background_fill=white
|
| 87 |
-
block_label_background_fill_dark=grey
|
| 88 |
-
block_title_text_color=grey
|
| 89 |
-
block_title_text_color_dark=grey
|
| 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)",
|
|
@@ -105,7 +104,7 @@ class CanvaTheme(Base):
|
|
| 105 |
|
| 106 |
# Error states
|
| 107 |
error_background_fill=red.c50,
|
| 108 |
-
error_background_fill_dark=
|
| 109 |
error_text_color=red.c600,
|
| 110 |
error_text_color_dark=red.c200,
|
| 111 |
error_border_color=red.c500,
|
|
@@ -116,10 +115,14 @@ class CanvaTheme(Base):
|
|
| 116 |
button_secondary_text_color_selected=green.c700,
|
| 117 |
|
| 118 |
# Alpha transparencies
|
| 119 |
-
overlay_background_fill=black
|
| 120 |
|
| 121 |
-
# Additional button states
|
| 122 |
-
button_primary_border_color=
|
| 123 |
-
button_secondary_border_color=grey
|
| 124 |
-
button_secondary_border_color_dark=grey
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
)
|
|
|
|
| 5 |
|
| 6 |
from colors import (
|
| 7 |
purple, # Primary brand color
|
| 8 |
+
blue, # Secondary brand color
|
| 9 |
+
grey, # Neutral shades
|
| 10 |
green, # Success states
|
| 11 |
red, # Error states
|
| 12 |
yellow, # Warning states
|
| 13 |
+
white, # White with alpha variations
|
| 14 |
+
black, # Black with alpha variations
|
| 15 |
+
purple_alpha # Purple with alpha variations
|
|
|
|
|
|
|
| 16 |
)
|
| 17 |
from sizes import spacing_md, radius_sm, text_md
|
| 18 |
|
|
|
|
| 32 |
super().__init__(
|
| 33 |
primary_hue=purple,
|
| 34 |
secondary_hue=blue,
|
| 35 |
+
neutral_hue=grey,
|
| 36 |
spacing_size=spacing_md,
|
| 37 |
radius_size=radius_sm,
|
| 38 |
text_size=text_md,
|
|
|
|
| 41 |
)
|
| 42 |
|
| 43 |
super().set(
|
| 44 |
+
# Colors
|
| 45 |
+
body_background_fill=white.c50,
|
| 46 |
+
body_background_fill_dark=black.c50,
|
| 47 |
+
background_fill_primary=white.c50,
|
| 48 |
+
background_fill_primary_dark=black.c100,
|
| 49 |
+
background_fill_secondary=grey.c50,
|
| 50 |
+
background_fill_secondary_dark=grey.c800,
|
| 51 |
|
| 52 |
# Border colors
|
| 53 |
+
border_color_primary=grey.c200,
|
| 54 |
+
border_color_primary_dark=grey.c700,
|
| 55 |
|
| 56 |
# Text colors
|
| 57 |
+
body_text_color=black.c50,
|
| 58 |
+
body_text_color_dark=white.c50,
|
| 59 |
+
body_text_color_subdued=grey.c500,
|
| 60 |
+
body_text_color_subdued_dark=grey.c400,
|
| 61 |
|
| 62 |
# Button styling
|
| 63 |
button_primary_background_fill=purple.c500,
|
| 64 |
button_primary_background_fill_dark=purple.c600,
|
| 65 |
button_primary_background_fill_hover=purple.c600,
|
| 66 |
button_primary_background_fill_hover_dark=purple.c700,
|
| 67 |
+
button_primary_text_color=white.c50,
|
| 68 |
+
button_primary_text_color_dark=white.c50,
|
| 69 |
|
| 70 |
+
button_secondary_background_fill=grey.c50,
|
| 71 |
+
button_secondary_background_fill_dark=grey.c800,
|
| 72 |
+
button_secondary_background_fill_hover=grey.c100,
|
| 73 |
+
button_secondary_background_fill_hover_dark=grey.c700,
|
| 74 |
+
button_secondary_text_color=black.c50,
|
| 75 |
+
button_secondary_text_color_dark=white.c50,
|
| 76 |
|
| 77 |
# Input styling
|
| 78 |
+
input_background_fill=grey.c50,
|
| 79 |
+
input_background_fill_dark=grey.c800,
|
| 80 |
+
input_border_color=grey.c200,
|
| 81 |
+
input_border_color_dark=grey.c700,
|
| 82 |
input_border_width="1px",
|
| 83 |
|
| 84 |
# Block styling
|
| 85 |
+
block_label_background_fill=white.c50,
|
| 86 |
+
block_label_background_fill_dark=grey.c800,
|
| 87 |
+
block_title_text_color=grey.c500,
|
| 88 |
+
block_title_text_color_dark=grey.c400,
|
| 89 |
|
| 90 |
# Shadow effects
|
| 91 |
shadow_drop="0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
|
|
|
|
| 104 |
|
| 105 |
# Error states
|
| 106 |
error_background_fill=red.c50,
|
| 107 |
+
error_background_fill_dark=black.c100,
|
| 108 |
error_text_color=red.c600,
|
| 109 |
error_text_color_dark=red.c200,
|
| 110 |
error_border_color=red.c500,
|
|
|
|
| 115 |
button_secondary_text_color_selected=green.c700,
|
| 116 |
|
| 117 |
# Alpha transparencies
|
| 118 |
+
overlay_background_fill=black.c400, # Using 50% alpha black
|
| 119 |
|
| 120 |
+
# Additional button states
|
| 121 |
+
button_primary_border_color=purple_alpha.c950, # Transparent
|
| 122 |
+
button_secondary_border_color=grey.c200,
|
| 123 |
+
button_secondary_border_color_dark=grey.c700,
|
| 124 |
+
|
| 125 |
+
# Additional states using alpha colors
|
| 126 |
+
shadow_spread_dark=black.c950,
|
| 127 |
+
block_background_fill_dark=black.c100,
|
| 128 |
)
|