grahamwhiteuk commited on
Commit
96f9708
·
1 Parent(s): 6efc321

feat: update to latest version of the carbon theme

Browse files

Signed-off-by: Graham White <[email protected]>

Files changed (1) hide show
  1. src/themes/carbon.py +81 -54
src/themes/carbon.py CHANGED
@@ -48,32 +48,81 @@ theme = gr.themes.Base(
48
  c900="#21272A",
49
  c950="#121619",
50
  ),
51
- text_size=sizes.text_lg,
52
- spacing_size=sizes.spacing_md,
53
- radius_size=sizes.radius_md,
54
- font=["IBM Plex Sans", "ui-sans-serif", "system-ui", "sans-serif"],
55
- font_mono=["IBM Plex Mono", "ui-monospace", "Consolas", "monospace"],
 
 
 
 
56
  ).set(
57
- body_text_color="*neutral_800", # Carbon primary text color #161616
58
- body_text_color_dark="*neutral_50",
59
- body_text_size="*text_sm",
60
- body_text_color_subdued="*neutral_300",
61
- body_text_color_subdued_dark="*neutral_500",
62
- body_text_weight="300",
63
- # Attributes to create cool gray 10 background color and white block background color
64
- embed_radius="*radius_md",
65
  background_fill_primary="*neutral_100", # Coolgray10 background
 
 
 
 
 
 
 
66
  block_background_fill="white",
67
- block_border_color="*neutral_200", # The border color around an block
68
- block_label_background_fill="white", # The background color for the block label
69
- block_label_border_color="*neutral_100", # The border color for the block label
 
 
 
 
 
 
 
 
70
  block_label_margin="*spacing_md",
71
- background_fill_secondary="*background_fill_primary",
72
- background_fill_secondary_dark="*neutral_950",
73
- border_color_accent="*neutral_100",
74
- border_color_accent_dark="*neutral_800",
75
- border_color_primary="*neutral_300",
76
- border_color_primary_dark="*neutral_700",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  # Chatbubble related colors
78
  # light
79
  # color_accent = "*secondary_400",
@@ -83,37 +132,15 @@ theme = gr.themes.Base(
83
  # chatbubble human border color in darkmode, use Blue 20 as an accent color
84
  border_color_accent_subdued_dark="*secondary_500",
85
  color_accent_soft_dark="*secondary_500", # chatbubble human color in dark mode
86
- shadow_drop="*block_label_shadow",
87
- shadow_drop_lg="0px 1px 2px 0px rgba(0, 0, 0, 0.07)",
88
- shadow_inset="0px 2px 4px 0px rgba(0, 0, 0, 0.07) inset, 0px 0px 3px 0px rgba(0, 0, 0, 0.00) inset",
89
- shadow_spread="1px",
90
  chatbot_text_size="*text_md", # make it larger
91
- checkbox_background_color_hover="*neutral_50",
92
- checkbox_background_color_hover_dark="*neutral_50",
93
- checkbox_background_color_selected="*neutral_800",
94
- checkbox_background_color_selected_dark="*neutral_800",
95
- checkbox_border_color_selected="*neutral_950",
96
- checkbox_border_color_selected_dark="*neutral_950",
97
- checkbox_label_border_width="1px",
98
- checkbox_label_border_width_dark="1px",
99
- checkbox_label_padding="*spacing_xs",
100
- checkbox_label_text_size="*text_xs",
101
- input_background_fill="white",
102
- input_background_fill_dark="*neutral_800",
103
- input_border_color_focus="*primary_500",
104
- input_border_width="1px",
105
- input_border_width_dark="1px",
106
- input_padding="*spacing_lg",
107
- input_text_size="*text_sm", # text size for the input filed
108
- button_large_padding="*spacing_sm",
109
- button_small_padding="*spacing_xxs",
110
- button_primary_border_color_dark="*primary_600",
111
- button_primary_border_color_hover_dark="*primary_700",
112
- button_primary_shadow="*shadow_drop",
113
- button_primary_shadow_hover="*shadow_drop_lg",
114
- button_secondary_background_fill="white",
115
- button_secondary_background_fill_hover="*neutral_600",
116
- button_secondary_border_color="*neutral_800",
117
- button_secondary_border_color_hover_dark="*neutral_700",
118
- button_secondary_shadow_hover="*shadow_drop_lg",
119
  )
 
48
  c900="#21272A",
49
  c950="#121619",
50
  ),
51
+ spacing_size=sizes.spacing_md, # change spacing to default size
52
+ radius_size=sizes.radius_md, # change spacing to default size and Keep Radius to make demo feel more playful
53
+ text_size=sizes.text_lg, # change fontsize to default size
54
+ # spacing_size: sizes.Size | str = sizes.spacing_md, #change spacing to default size
55
+ # radius_size: sizes.Size | str = sizes.radius_md, #change spacing to default size and Keep Radius to make
56
+ # demo feel more playful
57
+ # text_size: sizes.Size | str = sizes.text_lg, #change fontsize to default size
58
+ font=["IBM Plex Sans", "ui-sans-serif", "system-ui", "sans-serif"], # update font
59
+ font_mono=["IBM Plex Mono", "ui-monospace", "Consolas", "monospace"], # update font
60
  ).set(
61
+ # Colors
 
 
 
 
 
 
 
62
  background_fill_primary="*neutral_100", # Coolgray10 background
63
+ background_fill_primary_dark="*neutral_950", # Coolgray95 background for dark mode
64
+ slider_color="*primary_600", # Blue60
65
+ slider_color_dark="*primary_500", # Blue50
66
+ # Shadows
67
+ shadow_drop="0 1px 4px 0 rgb(0 0 0 / 0.1)",
68
+ shadow_drop_lg="0 2px 5px 0 rgb(0 0 0 / 0.1)",
69
+ # Block Labels
70
  block_background_fill="white",
71
+ block_label_background_fill="white", # same color as blockback gound fill
72
+ block_label_radius="*radius_md",
73
+ block_label_text_size="*text_md",
74
+ block_label_text_weight="600",
75
+ block_label_text_color="black",
76
+ block_label_text_color_dark="white",
77
+ block_title_radius="*block_label_radius",
78
+ block_title_background_fill="*block_label_background_fill",
79
+ block_title_text_weight="600",
80
+ block_title_text_color="black",
81
+ block_title_text_color_dark="white",
82
  block_label_margin="*spacing_md",
83
+ # Inputs
84
+ input_background_fill="white",
85
+ input_border_color="*neutral_100",
86
+ input_shadow="*shadow_drop",
87
+ input_shadow_focus="*shadow_drop_lg",
88
+ checkbox_shadow="none",
89
+ # Buttons
90
+ shadow_spread="6px",
91
+ button_primary_shadow="*shadow_drop_lg",
92
+ button_primary_shadow_hover="*shadow_drop_lg",
93
+ button_primary_shadow_active="*shadow_inset",
94
+ button_secondary_shadow="*shadow_drop_lg",
95
+ button_secondary_shadow_hover="*shadow_drop_lg",
96
+ button_secondary_shadow_active="*shadow_inset",
97
+ checkbox_label_shadow="*shadow_drop_lg",
98
+ button_primary_background_fill="*primary_600",
99
+ button_primary_background_fill_hover="*primary_500",
100
+ button_primary_background_fill_hover_dark="*primary_500",
101
+ button_primary_text_color="white",
102
+ button_secondary_background_fill="white",
103
+ button_secondary_background_fill_hover="*neutral_100",
104
+ button_secondary_background_fill_dark="*neutral_800", # Secondary cool gray 80
105
+ button_secondary_background_fill_hover_dark="*primary_500",
106
+ button_secondary_text_color="*neutral_800",
107
+ button_cancel_background_fill="*button_secondary_background_fill",
108
+ button_cancel_background_fill_hover="*button_secondary_background_fill_hover",
109
+ button_cancel_background_fill_hover_dark="*button_secondary_background_fill_hover",
110
+ button_cancel_text_color="*button_secondary_text_color",
111
+ checkbox_label_background_fill_selected="*primary_200",
112
+ checkbox_label_background_fill_selected_dark="*primary_500",
113
+ checkbox_border_width="1px",
114
+ checkbox_border_color="*neutral_200",
115
+ checkbox_background_color_dark="*neutral_700", # Jan 18 test to fix checkbox, radio button background color
116
+ checkbox_background_color_selected="*primary_600",
117
+ checkbox_background_color_selected_dark="*primary_500",
118
+ checkbox_border_color_focus="*primary_600",
119
+ checkbox_border_color_focus_dark="*primary_500",
120
+ checkbox_border_color_selected="*primary_600",
121
+ checkbox_border_color_selected_dark="*primary_500",
122
+ checkbox_label_text_color_selected="black",
123
+ # Borders
124
+ block_border_width="1px", # test example border
125
+ panel_border_width="1px",
126
  # Chatbubble related colors
127
  # light
128
  # color_accent = "*secondary_400",
 
132
  # chatbubble human border color in darkmode, use Blue 20 as an accent color
133
  border_color_accent_subdued_dark="*secondary_500",
134
  color_accent_soft_dark="*secondary_500", # chatbubble human color in dark mode
135
+ # Chatbot related font
 
 
 
136
  chatbot_text_size="*text_md", # make it larger
137
+ # additional dark mode related tweaks:
138
+ # block_background_fill_dark="*neutral_950", # Jan 18 test coolgray95 background for dark mode
139
+ block_label_background_fill_dark="*neutral_800", # same color as blockback gound fill
140
+ block_title_background_fill_dark="*block_label_background_fill",
141
+ # input_background_fill_dark="*neutral_800", #This attribute help match fill color cool gray 80 to match background
142
+ # however cause the problem for the general theme.
143
+ # input_shadow_dark="*shadow_drop", #Test if it could make the border without the color
144
+ # input_border_color_dark="*neutral_200",#add attribute for border Jan 18
145
+ checkbox_border_color_dark="*neutral_600", # Jan 18 test to fix border
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  )