paloma99 commited on
Commit
f7e4892
1 Parent(s): b559d09

Upload theme.py

Browse files
Files changed (1) hide show
  1. theme.py +88 -0
theme.py ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from typing import Iterable
4
+
5
+ from gradio.themes.base import Base
6
+ from gradio.themes.utils import colors, fonts, sizes
7
+
8
+ class Theme(Base):
9
+ def __init__(
10
+ self,
11
+ *,
12
+ primary_hue: colors.Color | str = colors.lime,
13
+ secondary_hue: colors.Color | str = colors.emerald,
14
+ neutral_hue: colors.Color | str = colors.stone,
15
+ spacing_size: sizes.Size | str = sizes.spacing_lg,
16
+ radius_size: sizes.Size | str = sizes.radius_none,
17
+ text_size: sizes.Size | str = sizes.text_md,
18
+ font: fonts.Font | str | Iterable[fonts.Font | str] = (
19
+ fonts.GoogleFont("Quicksand"),
20
+ "ui-sans-serif",
21
+ "system-ui",
22
+ "sans-serif",
23
+ ),
24
+ font_mono: fonts.Font | str | Iterable[fonts.Font | str] = (
25
+ fonts.GoogleFont("IBM Plex Mono"),
26
+ "ui-monospace",
27
+ "Consolas",
28
+ "monospace",
29
+ ),
30
+ ):
31
+ super().__init__(
32
+ primary_hue=primary_hue,
33
+ secondary_hue=secondary_hue,
34
+ neutral_hue=neutral_hue,
35
+ spacing_size=spacing_size,
36
+ radius_size=radius_size,
37
+ text_size=text_size,
38
+ font=font,
39
+ font_mono=font_mono,
40
+ )
41
+ self.name = "theme"
42
+ super().set(
43
+ # Colors
44
+ slider_color="#66814a",
45
+ body_text_color="#4e6339",
46
+ block_label_text_color="#66814a",
47
+ block_title_text_color="#66814a",
48
+ body_text_color_subdued="#f5f5f5",
49
+ body_background_fill="#85a860",
50
+ background_fill_primary="#c8dcb4",
51
+ background_fill_secondary="*white",
52
+ background_fill_primary_dark="#0e170b",
53
+ block_background_fill="#d3e3c3",
54
+ # Button Colors
55
+ button_primary_background_fill="#66814a",
56
+ button_primary_background_fill_hover='*primary_500',
57
+ button_primary_background_fill_dark="*primary_600",
58
+ button_primary_background_fill_hover_dark="*primary_600",
59
+ button_primary_text_color="rgb(243, 239, 224)",
60
+ button_primary_text_color_dark="*white",
61
+ button_secondary_background_fill="*button_primary_background_fill",
62
+ button_secondary_background_fill_hover="*button_primary_background_fill_hover",
63
+ button_secondary_text_color="*button_primary_text_color",
64
+ button_cancel_background_fill="*button_primary_background_fill",
65
+ button_cancel_background_fill_hover="*button_primary_background_fill_hover",
66
+ button_cancel_text_color="*button_primary_text_color",
67
+ checkbox_label_background_fill="*button_primary_background_fill",
68
+ checkbox_label_background_fill_hover="*button_primary_background_fill_hover",
69
+ checkbox_label_text_color="*button_primary_text_color",
70
+ checkbox_background_color_selected="*primary_500",
71
+ checkbox_background_color_dark="#66814a",
72
+ checkbox_background_color_selected_dark="*primary_500",
73
+ checkbox_border_color_selected_dark="#66814a",
74
+ # Padding
75
+ checkbox_label_padding="*spacing_md",
76
+ button_large_padding="*spacing_lg",
77
+ button_small_padding="*spacing_sm",
78
+ # Borders
79
+ block_border_width="1px",
80
+ block_border_width_dark="1px",
81
+ shadow_drop_lg="0 1px 4px 0 rgb(0 0 0 / 0.1)",
82
+ block_shadow="*shadow_drop_lg",
83
+ block_shadow_dark="none",
84
+ # Block Labels
85
+ block_title_text_weight="600",
86
+ block_label_text_weight="600",
87
+ block_label_text_size="*text_md",
88
+ )