pub struct ThemeSpec {
pub stylesheet: ThemeStylesheet,
pub palette: ThemePalette,
pub typography: ThemeTypography,
pub density: ThemeDensity,
pub appearances: ThemeAppearances,
pub overrides: BTreeMap<String, String>,
}Fields§
§stylesheet: ThemeStylesheet§palette: ThemePalette§typography: ThemeTypography§density: ThemeDensity§appearances: ThemeAppearances§overrides: BTreeMap<String, String>Implementations§
Source§impl ThemeSpec
impl ThemeSpec
pub fn with_stylesheet_path(self, path: impl AsRef<Path>) -> Self
pub fn with_override( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Sourcepub fn with_surface_appearance(
self,
id: impl Into<String>,
appearance: SurfaceAppearance,
) -> Self
pub fn with_surface_appearance( self, id: impl Into<String>, appearance: SurfaceAppearance, ) -> Self
Examples found in repository?
examples/plugin_view.rs (lines 95-98)
72fn plugin_demo_theme() -> ThemeSpec {
73 let mut theme = ThemeSpec::default();
74 theme.typography.font_family = "\"Space Grotesk\", \"Noto Sans\", sans-serif".to_string();
75 theme.typography.mono_font_family = "\"JetBrains Mono\", monospace".to_string();
76 theme.palette.bg_0 = "#0f1318".to_string();
77 theme.palette.bg_1 = "#18202a".to_string();
78 theme.palette.workbench = "#0c1015".to_string();
79 theme.palette.panel_left = "#131920".to_string();
80 theme.palette.panel_right = "#131a22".to_string();
81 theme.palette.panel_bottom = "#0a0d12".to_string();
82 theme.palette.border = "#27303c".to_string();
83 theme.palette.border_strong = "#3d4959".to_string();
84 theme.palette.text_0 = "#e3edf7".to_string();
85 theme.palette.text_1 = "#acb9c8".to_string();
86 theme.palette.text_2 = "#738197".to_string();
87 theme.palette.accent = "#36c2a3".to_string();
88 theme.palette.accent_strong = "#72f0cf".to_string();
89 theme.density.radius_medium = 10;
90 theme.density.radius_large = 14;
91 theme.density.toolbar_height = 42;
92 theme.density.tab_height = 30;
93
94 theme
95 .with_surface_appearance(
96 "topbar",
97 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Flat, TextRole::BodyStrong),
98 )
99 .with_surface_appearance(
100 "toolbar",
101 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Raised, TextRole::Body),
102 )
103 .with_surface_appearance(
104 "demo-workbench",
105 SurfaceAppearance::new(Tone::Neutral, SurfaceLevel::Sunken, TextRole::Body)
106 .borderless(),
107 )
108 .with_surface_appearance(
109 "demo-header",
110 SurfaceAppearance::new(Tone::Secondary, SurfaceLevel::Flat, TextRole::SectionLabel),
111 )
112 .with_button_appearance(
113 "primary",
114 ButtonAppearance::new(Tone::Accent, ButtonStyle::Solid, TextRole::BodyStrong),
115 )
116 .with_button_appearance(
117 "ghost",
118 ButtonAppearance::new(Tone::Secondary, ButtonStyle::Ghost, TextRole::Body),
119 )
120 .with_tab_strip_appearance(
121 "demo-tabs",
122 TabStripAppearance::new(Tone::Secondary, TabStripStyle::Editor, TextRole::TabLabel),
123 )
124}More examples
examples/semantic_appearance.rs (lines 147-150)
118fn semantic_theme() -> ThemeSpec {
119 let mut theme = ThemeSpec::default();
120 theme.typography.font_family = "\"Azeret Mono\", \"Noto Sans\", sans-serif".to_string();
121 theme.typography.mono_font_family = "\"IBM Plex Mono\", monospace".to_string();
122 theme.typography.font_size_base = 14;
123 theme.typography.font_size_ui = 13;
124 theme.typography.font_size_small = 12;
125 theme.typography.font_size_tiny = 11;
126 theme.typography.font_size_title = 28;
127 theme.palette.bg_0 = "#f1efe6".to_string();
128 theme.palette.bg_1 = "#e3dfd3".to_string();
129 theme.palette.workbench = "#f8f6ef".to_string();
130 theme.palette.panel_left = "#d7e1dd".to_string();
131 theme.palette.panel_right = "#e7ddd0".to_string();
132 theme.palette.panel_bottom = "#d9d5df".to_string();
133 theme.palette.border = "#b5b0a3".to_string();
134 theme.palette.border_strong = "#8f8777".to_string();
135 theme.palette.text_0 = "#1f1e1a".to_string();
136 theme.palette.text_1 = "#4b463d".to_string();
137 theme.palette.text_2 = "#6d665a".to_string();
138 theme.palette.accent = "#0f766e".to_string();
139 theme.palette.accent_strong = "#0b5f58".to_string();
140 theme.density.radius_medium = 12;
141 theme.density.radius_large = 16;
142 theme.density.toolbar_height = 46;
143 theme.density.tab_height = 32;
144 theme.density.panel_header_height = 30;
145
146 theme
147 .with_surface_appearance(
148 "primary-panel",
149 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Raised, TextRole::Body),
150 )
151 .with_surface_appearance(
152 "secondary-panel",
153 SurfaceAppearance::new(Tone::Secondary, SurfaceLevel::Raised, TextRole::Body),
154 )
155 .with_surface_appearance(
156 "console-panel",
157 SurfaceAppearance::new(Tone::Tertiary, SurfaceLevel::Sunken, TextRole::Code),
158 )
159 .with_surface_appearance(
160 "canvas-panel",
161 SurfaceAppearance::new(Tone::Neutral, SurfaceLevel::Sunken, TextRole::Body)
162 .borderless(),
163 )
164 .with_surface_appearance(
165 "panel-header",
166 SurfaceAppearance::new(Tone::Neutral, SurfaceLevel::Flat, TextRole::SectionLabel),
167 )
168 .with_button_appearance(
169 "primary",
170 ButtonAppearance::new(Tone::Accent, ButtonStyle::Solid, TextRole::BodyStrong),
171 )
172 .with_button_appearance(
173 "secondary",
174 ButtonAppearance::new(Tone::Primary, ButtonStyle::Soft, TextRole::Body),
175 )
176 .with_button_appearance(
177 "ghost",
178 ButtonAppearance::new(Tone::Neutral, ButtonStyle::Ghost, TextRole::Body),
179 )
180 .with_input_appearance(
181 "search",
182 InputAppearance::new(Tone::Secondary, SurfaceLevel::Sunken, TextRole::Body),
183 )
184 .with_text_appearance(
185 "title",
186 TextAppearance {
187 role: TextRole::Title,
188 tone: Tone::Accent,
189 },
190 )
191 .with_text_appearance(
192 "meta",
193 TextAppearance {
194 role: TextRole::Meta,
195 tone: Tone::Neutral,
196 },
197 )
198 .with_tab_strip_appearance(
199 "side-tabs",
200 TabStripAppearance::new(Tone::Primary, TabStripStyle::Utility, TextRole::TabLabel),
201 )
202 .with_tab_strip_appearance(
203 "editor-tabs",
204 TabStripAppearance::new(Tone::Neutral, TabStripStyle::Editor, TextRole::TabLabel),
205 )
206 .with_tab_strip_appearance(
207 "console-tabs",
208 TabStripAppearance::new(Tone::Tertiary, TabStripStyle::Console, TextRole::TabLabel),
209 )
210}examples/notebook.rs (lines 196-200)
155fn notebook_theme() -> ThemeSpec {
156 let mut theme = ThemeSpec::default();
157 theme.typography.font_family = "\"IBM Plex Sans\", \"Cantarell\", sans-serif".to_string();
158 theme.typography.mono_font_family = "\"IBM Plex Mono\", monospace".to_string();
159 theme.typography.font_size_base = 15;
160 theme.typography.font_size_ui = 14;
161 theme.typography.font_size_small = 13;
162 theme.typography.font_size_tiny = 12;
163 theme.typography.font_size_title = 26;
164 theme.palette.bg_0 = "#f5f0e6".to_string();
165 theme.palette.bg_1 = "#ebe1d2".to_string();
166 theme.palette.workbench = "#fbf7f0".to_string();
167 theme.palette.panel_left = "#f1e7d8".to_string();
168 theme.palette.panel_right = "#f4ebde".to_string();
169 theme.palette.panel_bottom = "#e7d9c6".to_string();
170 theme.palette.border = "#ceb89a".to_string();
171 theme.palette.border_strong = "#b99669".to_string();
172 theme.palette.text_0 = "#2f2418".to_string();
173 theme.palette.text_1 = "#5d4a37".to_string();
174 theme.palette.text_2 = "#8a7258".to_string();
175 theme.palette.accent = "#9b5f2b".to_string();
176 theme.palette.accent_strong = "#bc753b".to_string();
177 theme.density.radius_small = 8;
178 theme.density.radius_medium = 14;
179 theme.density.radius_large = 18;
180 theme.density.space_sm = 6;
181 theme.density.space_md = 10;
182 theme.density.space_lg = 14;
183 theme.density.space_xl = 20;
184 theme.density.control_height_small = 26;
185 theme.density.control_height_medium = 36;
186 theme.density.control_height_large = 40;
187 theme.density.toolbar_height = 58;
188 theme.density.tab_height = 36;
189 theme.density.search_width_min = 360;
190 theme.density.search_width_max = 560;
191 theme.density.panel_header_height = 32;
192 theme.density.min_side_panel_width = 266;
193 theme.density.min_bottom_panel_height = 176;
194
195 theme
196 .with_surface_appearance(
197 "app-shell",
198 SurfaceAppearance::new(Tone::Neutral, SurfaceLevel::Sunken, TextRole::Body)
199 .borderless(),
200 )
201 .with_surface_appearance(
202 "topbar",
203 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Flat, TextRole::BodyStrong),
204 )
205 .with_surface_appearance(
206 "toolbar",
207 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Raised, TextRole::Body),
208 )
209 .with_surface_appearance(
210 "library-panel",
211 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Raised, TextRole::Body),
212 )
213 .with_surface_appearance(
214 "library-header",
215 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Flat, TextRole::SectionLabel),
216 )
217 .with_surface_appearance(
218 "detail-panel",
219 SurfaceAppearance::new(Tone::Secondary, SurfaceLevel::Raised, TextRole::Body),
220 )
221 .with_surface_appearance(
222 "detail-header",
223 SurfaceAppearance::new(Tone::Secondary, SurfaceLevel::Flat, TextRole::SectionLabel),
224 )
225 .with_surface_appearance(
226 "writing-surface",
227 SurfaceAppearance::new(Tone::Neutral, SurfaceLevel::Raised, TextRole::Body)
228 .borderless(),
229 )
230 .with_button_appearance(
231 "primary",
232 ButtonAppearance::new(Tone::Accent, ButtonStyle::Solid, TextRole::BodyStrong),
233 )
234 .with_button_appearance(
235 "secondary",
236 ButtonAppearance::new(Tone::Primary, ButtonStyle::Soft, TextRole::Body),
237 )
238 .with_button_appearance(
239 "ghost",
240 ButtonAppearance::new(Tone::Secondary, ButtonStyle::Ghost, TextRole::Body),
241 )
242 .with_input_appearance(
243 "search",
244 InputAppearance::new(Tone::Secondary, SurfaceLevel::Sunken, TextRole::Body),
245 )
246 .with_text_appearance(
247 "title",
248 TextAppearance {
249 role: TextRole::Title,
250 tone: Tone::Primary,
251 },
252 )
253 .with_text_appearance(
254 "meta",
255 TextAppearance {
256 role: TextRole::Meta,
257 tone: Tone::Secondary,
258 },
259 )
260 .with_tab_strip_appearance(
261 "library-strip",
262 TabStripAppearance::new(Tone::Primary, TabStripStyle::Utility, TextRole::TabLabel),
263 )
264 .with_tab_strip_appearance(
265 "editor",
266 TabStripAppearance::new(Tone::Neutral, TabStripStyle::Editor, TextRole::TabLabel),
267 )
268 .with_tab_strip_appearance(
269 "console",
270 TabStripAppearance::new(Tone::Tertiary, TabStripStyle::Console, TextRole::TabLabel),
271 )
272}Examples found in repository?
examples/plugin_view.rs (lines 112-115)
72fn plugin_demo_theme() -> ThemeSpec {
73 let mut theme = ThemeSpec::default();
74 theme.typography.font_family = "\"Space Grotesk\", \"Noto Sans\", sans-serif".to_string();
75 theme.typography.mono_font_family = "\"JetBrains Mono\", monospace".to_string();
76 theme.palette.bg_0 = "#0f1318".to_string();
77 theme.palette.bg_1 = "#18202a".to_string();
78 theme.palette.workbench = "#0c1015".to_string();
79 theme.palette.panel_left = "#131920".to_string();
80 theme.palette.panel_right = "#131a22".to_string();
81 theme.palette.panel_bottom = "#0a0d12".to_string();
82 theme.palette.border = "#27303c".to_string();
83 theme.palette.border_strong = "#3d4959".to_string();
84 theme.palette.text_0 = "#e3edf7".to_string();
85 theme.palette.text_1 = "#acb9c8".to_string();
86 theme.palette.text_2 = "#738197".to_string();
87 theme.palette.accent = "#36c2a3".to_string();
88 theme.palette.accent_strong = "#72f0cf".to_string();
89 theme.density.radius_medium = 10;
90 theme.density.radius_large = 14;
91 theme.density.toolbar_height = 42;
92 theme.density.tab_height = 30;
93
94 theme
95 .with_surface_appearance(
96 "topbar",
97 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Flat, TextRole::BodyStrong),
98 )
99 .with_surface_appearance(
100 "toolbar",
101 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Raised, TextRole::Body),
102 )
103 .with_surface_appearance(
104 "demo-workbench",
105 SurfaceAppearance::new(Tone::Neutral, SurfaceLevel::Sunken, TextRole::Body)
106 .borderless(),
107 )
108 .with_surface_appearance(
109 "demo-header",
110 SurfaceAppearance::new(Tone::Secondary, SurfaceLevel::Flat, TextRole::SectionLabel),
111 )
112 .with_button_appearance(
113 "primary",
114 ButtonAppearance::new(Tone::Accent, ButtonStyle::Solid, TextRole::BodyStrong),
115 )
116 .with_button_appearance(
117 "ghost",
118 ButtonAppearance::new(Tone::Secondary, ButtonStyle::Ghost, TextRole::Body),
119 )
120 .with_tab_strip_appearance(
121 "demo-tabs",
122 TabStripAppearance::new(Tone::Secondary, TabStripStyle::Editor, TextRole::TabLabel),
123 )
124}More examples
examples/semantic_appearance.rs (lines 168-171)
118fn semantic_theme() -> ThemeSpec {
119 let mut theme = ThemeSpec::default();
120 theme.typography.font_family = "\"Azeret Mono\", \"Noto Sans\", sans-serif".to_string();
121 theme.typography.mono_font_family = "\"IBM Plex Mono\", monospace".to_string();
122 theme.typography.font_size_base = 14;
123 theme.typography.font_size_ui = 13;
124 theme.typography.font_size_small = 12;
125 theme.typography.font_size_tiny = 11;
126 theme.typography.font_size_title = 28;
127 theme.palette.bg_0 = "#f1efe6".to_string();
128 theme.palette.bg_1 = "#e3dfd3".to_string();
129 theme.palette.workbench = "#f8f6ef".to_string();
130 theme.palette.panel_left = "#d7e1dd".to_string();
131 theme.palette.panel_right = "#e7ddd0".to_string();
132 theme.palette.panel_bottom = "#d9d5df".to_string();
133 theme.palette.border = "#b5b0a3".to_string();
134 theme.palette.border_strong = "#8f8777".to_string();
135 theme.palette.text_0 = "#1f1e1a".to_string();
136 theme.palette.text_1 = "#4b463d".to_string();
137 theme.palette.text_2 = "#6d665a".to_string();
138 theme.palette.accent = "#0f766e".to_string();
139 theme.palette.accent_strong = "#0b5f58".to_string();
140 theme.density.radius_medium = 12;
141 theme.density.radius_large = 16;
142 theme.density.toolbar_height = 46;
143 theme.density.tab_height = 32;
144 theme.density.panel_header_height = 30;
145
146 theme
147 .with_surface_appearance(
148 "primary-panel",
149 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Raised, TextRole::Body),
150 )
151 .with_surface_appearance(
152 "secondary-panel",
153 SurfaceAppearance::new(Tone::Secondary, SurfaceLevel::Raised, TextRole::Body),
154 )
155 .with_surface_appearance(
156 "console-panel",
157 SurfaceAppearance::new(Tone::Tertiary, SurfaceLevel::Sunken, TextRole::Code),
158 )
159 .with_surface_appearance(
160 "canvas-panel",
161 SurfaceAppearance::new(Tone::Neutral, SurfaceLevel::Sunken, TextRole::Body)
162 .borderless(),
163 )
164 .with_surface_appearance(
165 "panel-header",
166 SurfaceAppearance::new(Tone::Neutral, SurfaceLevel::Flat, TextRole::SectionLabel),
167 )
168 .with_button_appearance(
169 "primary",
170 ButtonAppearance::new(Tone::Accent, ButtonStyle::Solid, TextRole::BodyStrong),
171 )
172 .with_button_appearance(
173 "secondary",
174 ButtonAppearance::new(Tone::Primary, ButtonStyle::Soft, TextRole::Body),
175 )
176 .with_button_appearance(
177 "ghost",
178 ButtonAppearance::new(Tone::Neutral, ButtonStyle::Ghost, TextRole::Body),
179 )
180 .with_input_appearance(
181 "search",
182 InputAppearance::new(Tone::Secondary, SurfaceLevel::Sunken, TextRole::Body),
183 )
184 .with_text_appearance(
185 "title",
186 TextAppearance {
187 role: TextRole::Title,
188 tone: Tone::Accent,
189 },
190 )
191 .with_text_appearance(
192 "meta",
193 TextAppearance {
194 role: TextRole::Meta,
195 tone: Tone::Neutral,
196 },
197 )
198 .with_tab_strip_appearance(
199 "side-tabs",
200 TabStripAppearance::new(Tone::Primary, TabStripStyle::Utility, TextRole::TabLabel),
201 )
202 .with_tab_strip_appearance(
203 "editor-tabs",
204 TabStripAppearance::new(Tone::Neutral, TabStripStyle::Editor, TextRole::TabLabel),
205 )
206 .with_tab_strip_appearance(
207 "console-tabs",
208 TabStripAppearance::new(Tone::Tertiary, TabStripStyle::Console, TextRole::TabLabel),
209 )
210}examples/notebook.rs (lines 230-233)
155fn notebook_theme() -> ThemeSpec {
156 let mut theme = ThemeSpec::default();
157 theme.typography.font_family = "\"IBM Plex Sans\", \"Cantarell\", sans-serif".to_string();
158 theme.typography.mono_font_family = "\"IBM Plex Mono\", monospace".to_string();
159 theme.typography.font_size_base = 15;
160 theme.typography.font_size_ui = 14;
161 theme.typography.font_size_small = 13;
162 theme.typography.font_size_tiny = 12;
163 theme.typography.font_size_title = 26;
164 theme.palette.bg_0 = "#f5f0e6".to_string();
165 theme.palette.bg_1 = "#ebe1d2".to_string();
166 theme.palette.workbench = "#fbf7f0".to_string();
167 theme.palette.panel_left = "#f1e7d8".to_string();
168 theme.palette.panel_right = "#f4ebde".to_string();
169 theme.palette.panel_bottom = "#e7d9c6".to_string();
170 theme.palette.border = "#ceb89a".to_string();
171 theme.palette.border_strong = "#b99669".to_string();
172 theme.palette.text_0 = "#2f2418".to_string();
173 theme.palette.text_1 = "#5d4a37".to_string();
174 theme.palette.text_2 = "#8a7258".to_string();
175 theme.palette.accent = "#9b5f2b".to_string();
176 theme.palette.accent_strong = "#bc753b".to_string();
177 theme.density.radius_small = 8;
178 theme.density.radius_medium = 14;
179 theme.density.radius_large = 18;
180 theme.density.space_sm = 6;
181 theme.density.space_md = 10;
182 theme.density.space_lg = 14;
183 theme.density.space_xl = 20;
184 theme.density.control_height_small = 26;
185 theme.density.control_height_medium = 36;
186 theme.density.control_height_large = 40;
187 theme.density.toolbar_height = 58;
188 theme.density.tab_height = 36;
189 theme.density.search_width_min = 360;
190 theme.density.search_width_max = 560;
191 theme.density.panel_header_height = 32;
192 theme.density.min_side_panel_width = 266;
193 theme.density.min_bottom_panel_height = 176;
194
195 theme
196 .with_surface_appearance(
197 "app-shell",
198 SurfaceAppearance::new(Tone::Neutral, SurfaceLevel::Sunken, TextRole::Body)
199 .borderless(),
200 )
201 .with_surface_appearance(
202 "topbar",
203 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Flat, TextRole::BodyStrong),
204 )
205 .with_surface_appearance(
206 "toolbar",
207 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Raised, TextRole::Body),
208 )
209 .with_surface_appearance(
210 "library-panel",
211 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Raised, TextRole::Body),
212 )
213 .with_surface_appearance(
214 "library-header",
215 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Flat, TextRole::SectionLabel),
216 )
217 .with_surface_appearance(
218 "detail-panel",
219 SurfaceAppearance::new(Tone::Secondary, SurfaceLevel::Raised, TextRole::Body),
220 )
221 .with_surface_appearance(
222 "detail-header",
223 SurfaceAppearance::new(Tone::Secondary, SurfaceLevel::Flat, TextRole::SectionLabel),
224 )
225 .with_surface_appearance(
226 "writing-surface",
227 SurfaceAppearance::new(Tone::Neutral, SurfaceLevel::Raised, TextRole::Body)
228 .borderless(),
229 )
230 .with_button_appearance(
231 "primary",
232 ButtonAppearance::new(Tone::Accent, ButtonStyle::Solid, TextRole::BodyStrong),
233 )
234 .with_button_appearance(
235 "secondary",
236 ButtonAppearance::new(Tone::Primary, ButtonStyle::Soft, TextRole::Body),
237 )
238 .with_button_appearance(
239 "ghost",
240 ButtonAppearance::new(Tone::Secondary, ButtonStyle::Ghost, TextRole::Body),
241 )
242 .with_input_appearance(
243 "search",
244 InputAppearance::new(Tone::Secondary, SurfaceLevel::Sunken, TextRole::Body),
245 )
246 .with_text_appearance(
247 "title",
248 TextAppearance {
249 role: TextRole::Title,
250 tone: Tone::Primary,
251 },
252 )
253 .with_text_appearance(
254 "meta",
255 TextAppearance {
256 role: TextRole::Meta,
257 tone: Tone::Secondary,
258 },
259 )
260 .with_tab_strip_appearance(
261 "library-strip",
262 TabStripAppearance::new(Tone::Primary, TabStripStyle::Utility, TextRole::TabLabel),
263 )
264 .with_tab_strip_appearance(
265 "editor",
266 TabStripAppearance::new(Tone::Neutral, TabStripStyle::Editor, TextRole::TabLabel),
267 )
268 .with_tab_strip_appearance(
269 "console",
270 TabStripAppearance::new(Tone::Tertiary, TabStripStyle::Console, TextRole::TabLabel),
271 )
272}Sourcepub fn with_text_appearance(
self,
id: impl Into<String>,
appearance: TextAppearance,
) -> Self
pub fn with_text_appearance( self, id: impl Into<String>, appearance: TextAppearance, ) -> Self
Examples found in repository?
examples/semantic_appearance.rs (lines 184-190)
118fn semantic_theme() -> ThemeSpec {
119 let mut theme = ThemeSpec::default();
120 theme.typography.font_family = "\"Azeret Mono\", \"Noto Sans\", sans-serif".to_string();
121 theme.typography.mono_font_family = "\"IBM Plex Mono\", monospace".to_string();
122 theme.typography.font_size_base = 14;
123 theme.typography.font_size_ui = 13;
124 theme.typography.font_size_small = 12;
125 theme.typography.font_size_tiny = 11;
126 theme.typography.font_size_title = 28;
127 theme.palette.bg_0 = "#f1efe6".to_string();
128 theme.palette.bg_1 = "#e3dfd3".to_string();
129 theme.palette.workbench = "#f8f6ef".to_string();
130 theme.palette.panel_left = "#d7e1dd".to_string();
131 theme.palette.panel_right = "#e7ddd0".to_string();
132 theme.palette.panel_bottom = "#d9d5df".to_string();
133 theme.palette.border = "#b5b0a3".to_string();
134 theme.palette.border_strong = "#8f8777".to_string();
135 theme.palette.text_0 = "#1f1e1a".to_string();
136 theme.palette.text_1 = "#4b463d".to_string();
137 theme.palette.text_2 = "#6d665a".to_string();
138 theme.palette.accent = "#0f766e".to_string();
139 theme.palette.accent_strong = "#0b5f58".to_string();
140 theme.density.radius_medium = 12;
141 theme.density.radius_large = 16;
142 theme.density.toolbar_height = 46;
143 theme.density.tab_height = 32;
144 theme.density.panel_header_height = 30;
145
146 theme
147 .with_surface_appearance(
148 "primary-panel",
149 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Raised, TextRole::Body),
150 )
151 .with_surface_appearance(
152 "secondary-panel",
153 SurfaceAppearance::new(Tone::Secondary, SurfaceLevel::Raised, TextRole::Body),
154 )
155 .with_surface_appearance(
156 "console-panel",
157 SurfaceAppearance::new(Tone::Tertiary, SurfaceLevel::Sunken, TextRole::Code),
158 )
159 .with_surface_appearance(
160 "canvas-panel",
161 SurfaceAppearance::new(Tone::Neutral, SurfaceLevel::Sunken, TextRole::Body)
162 .borderless(),
163 )
164 .with_surface_appearance(
165 "panel-header",
166 SurfaceAppearance::new(Tone::Neutral, SurfaceLevel::Flat, TextRole::SectionLabel),
167 )
168 .with_button_appearance(
169 "primary",
170 ButtonAppearance::new(Tone::Accent, ButtonStyle::Solid, TextRole::BodyStrong),
171 )
172 .with_button_appearance(
173 "secondary",
174 ButtonAppearance::new(Tone::Primary, ButtonStyle::Soft, TextRole::Body),
175 )
176 .with_button_appearance(
177 "ghost",
178 ButtonAppearance::new(Tone::Neutral, ButtonStyle::Ghost, TextRole::Body),
179 )
180 .with_input_appearance(
181 "search",
182 InputAppearance::new(Tone::Secondary, SurfaceLevel::Sunken, TextRole::Body),
183 )
184 .with_text_appearance(
185 "title",
186 TextAppearance {
187 role: TextRole::Title,
188 tone: Tone::Accent,
189 },
190 )
191 .with_text_appearance(
192 "meta",
193 TextAppearance {
194 role: TextRole::Meta,
195 tone: Tone::Neutral,
196 },
197 )
198 .with_tab_strip_appearance(
199 "side-tabs",
200 TabStripAppearance::new(Tone::Primary, TabStripStyle::Utility, TextRole::TabLabel),
201 )
202 .with_tab_strip_appearance(
203 "editor-tabs",
204 TabStripAppearance::new(Tone::Neutral, TabStripStyle::Editor, TextRole::TabLabel),
205 )
206 .with_tab_strip_appearance(
207 "console-tabs",
208 TabStripAppearance::new(Tone::Tertiary, TabStripStyle::Console, TextRole::TabLabel),
209 )
210}More examples
examples/notebook.rs (lines 246-252)
155fn notebook_theme() -> ThemeSpec {
156 let mut theme = ThemeSpec::default();
157 theme.typography.font_family = "\"IBM Plex Sans\", \"Cantarell\", sans-serif".to_string();
158 theme.typography.mono_font_family = "\"IBM Plex Mono\", monospace".to_string();
159 theme.typography.font_size_base = 15;
160 theme.typography.font_size_ui = 14;
161 theme.typography.font_size_small = 13;
162 theme.typography.font_size_tiny = 12;
163 theme.typography.font_size_title = 26;
164 theme.palette.bg_0 = "#f5f0e6".to_string();
165 theme.palette.bg_1 = "#ebe1d2".to_string();
166 theme.palette.workbench = "#fbf7f0".to_string();
167 theme.palette.panel_left = "#f1e7d8".to_string();
168 theme.palette.panel_right = "#f4ebde".to_string();
169 theme.palette.panel_bottom = "#e7d9c6".to_string();
170 theme.palette.border = "#ceb89a".to_string();
171 theme.palette.border_strong = "#b99669".to_string();
172 theme.palette.text_0 = "#2f2418".to_string();
173 theme.palette.text_1 = "#5d4a37".to_string();
174 theme.palette.text_2 = "#8a7258".to_string();
175 theme.palette.accent = "#9b5f2b".to_string();
176 theme.palette.accent_strong = "#bc753b".to_string();
177 theme.density.radius_small = 8;
178 theme.density.radius_medium = 14;
179 theme.density.radius_large = 18;
180 theme.density.space_sm = 6;
181 theme.density.space_md = 10;
182 theme.density.space_lg = 14;
183 theme.density.space_xl = 20;
184 theme.density.control_height_small = 26;
185 theme.density.control_height_medium = 36;
186 theme.density.control_height_large = 40;
187 theme.density.toolbar_height = 58;
188 theme.density.tab_height = 36;
189 theme.density.search_width_min = 360;
190 theme.density.search_width_max = 560;
191 theme.density.panel_header_height = 32;
192 theme.density.min_side_panel_width = 266;
193 theme.density.min_bottom_panel_height = 176;
194
195 theme
196 .with_surface_appearance(
197 "app-shell",
198 SurfaceAppearance::new(Tone::Neutral, SurfaceLevel::Sunken, TextRole::Body)
199 .borderless(),
200 )
201 .with_surface_appearance(
202 "topbar",
203 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Flat, TextRole::BodyStrong),
204 )
205 .with_surface_appearance(
206 "toolbar",
207 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Raised, TextRole::Body),
208 )
209 .with_surface_appearance(
210 "library-panel",
211 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Raised, TextRole::Body),
212 )
213 .with_surface_appearance(
214 "library-header",
215 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Flat, TextRole::SectionLabel),
216 )
217 .with_surface_appearance(
218 "detail-panel",
219 SurfaceAppearance::new(Tone::Secondary, SurfaceLevel::Raised, TextRole::Body),
220 )
221 .with_surface_appearance(
222 "detail-header",
223 SurfaceAppearance::new(Tone::Secondary, SurfaceLevel::Flat, TextRole::SectionLabel),
224 )
225 .with_surface_appearance(
226 "writing-surface",
227 SurfaceAppearance::new(Tone::Neutral, SurfaceLevel::Raised, TextRole::Body)
228 .borderless(),
229 )
230 .with_button_appearance(
231 "primary",
232 ButtonAppearance::new(Tone::Accent, ButtonStyle::Solid, TextRole::BodyStrong),
233 )
234 .with_button_appearance(
235 "secondary",
236 ButtonAppearance::new(Tone::Primary, ButtonStyle::Soft, TextRole::Body),
237 )
238 .with_button_appearance(
239 "ghost",
240 ButtonAppearance::new(Tone::Secondary, ButtonStyle::Ghost, TextRole::Body),
241 )
242 .with_input_appearance(
243 "search",
244 InputAppearance::new(Tone::Secondary, SurfaceLevel::Sunken, TextRole::Body),
245 )
246 .with_text_appearance(
247 "title",
248 TextAppearance {
249 role: TextRole::Title,
250 tone: Tone::Primary,
251 },
252 )
253 .with_text_appearance(
254 "meta",
255 TextAppearance {
256 role: TextRole::Meta,
257 tone: Tone::Secondary,
258 },
259 )
260 .with_tab_strip_appearance(
261 "library-strip",
262 TabStripAppearance::new(Tone::Primary, TabStripStyle::Utility, TextRole::TabLabel),
263 )
264 .with_tab_strip_appearance(
265 "editor",
266 TabStripAppearance::new(Tone::Neutral, TabStripStyle::Editor, TextRole::TabLabel),
267 )
268 .with_tab_strip_appearance(
269 "console",
270 TabStripAppearance::new(Tone::Tertiary, TabStripStyle::Console, TextRole::TabLabel),
271 )
272}Sourcepub fn with_input_appearance(
self,
id: impl Into<String>,
appearance: InputAppearance,
) -> Self
pub fn with_input_appearance( self, id: impl Into<String>, appearance: InputAppearance, ) -> Self
Examples found in repository?
examples/semantic_appearance.rs (lines 180-183)
118fn semantic_theme() -> ThemeSpec {
119 let mut theme = ThemeSpec::default();
120 theme.typography.font_family = "\"Azeret Mono\", \"Noto Sans\", sans-serif".to_string();
121 theme.typography.mono_font_family = "\"IBM Plex Mono\", monospace".to_string();
122 theme.typography.font_size_base = 14;
123 theme.typography.font_size_ui = 13;
124 theme.typography.font_size_small = 12;
125 theme.typography.font_size_tiny = 11;
126 theme.typography.font_size_title = 28;
127 theme.palette.bg_0 = "#f1efe6".to_string();
128 theme.palette.bg_1 = "#e3dfd3".to_string();
129 theme.palette.workbench = "#f8f6ef".to_string();
130 theme.palette.panel_left = "#d7e1dd".to_string();
131 theme.palette.panel_right = "#e7ddd0".to_string();
132 theme.palette.panel_bottom = "#d9d5df".to_string();
133 theme.palette.border = "#b5b0a3".to_string();
134 theme.palette.border_strong = "#8f8777".to_string();
135 theme.palette.text_0 = "#1f1e1a".to_string();
136 theme.palette.text_1 = "#4b463d".to_string();
137 theme.palette.text_2 = "#6d665a".to_string();
138 theme.palette.accent = "#0f766e".to_string();
139 theme.palette.accent_strong = "#0b5f58".to_string();
140 theme.density.radius_medium = 12;
141 theme.density.radius_large = 16;
142 theme.density.toolbar_height = 46;
143 theme.density.tab_height = 32;
144 theme.density.panel_header_height = 30;
145
146 theme
147 .with_surface_appearance(
148 "primary-panel",
149 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Raised, TextRole::Body),
150 )
151 .with_surface_appearance(
152 "secondary-panel",
153 SurfaceAppearance::new(Tone::Secondary, SurfaceLevel::Raised, TextRole::Body),
154 )
155 .with_surface_appearance(
156 "console-panel",
157 SurfaceAppearance::new(Tone::Tertiary, SurfaceLevel::Sunken, TextRole::Code),
158 )
159 .with_surface_appearance(
160 "canvas-panel",
161 SurfaceAppearance::new(Tone::Neutral, SurfaceLevel::Sunken, TextRole::Body)
162 .borderless(),
163 )
164 .with_surface_appearance(
165 "panel-header",
166 SurfaceAppearance::new(Tone::Neutral, SurfaceLevel::Flat, TextRole::SectionLabel),
167 )
168 .with_button_appearance(
169 "primary",
170 ButtonAppearance::new(Tone::Accent, ButtonStyle::Solid, TextRole::BodyStrong),
171 )
172 .with_button_appearance(
173 "secondary",
174 ButtonAppearance::new(Tone::Primary, ButtonStyle::Soft, TextRole::Body),
175 )
176 .with_button_appearance(
177 "ghost",
178 ButtonAppearance::new(Tone::Neutral, ButtonStyle::Ghost, TextRole::Body),
179 )
180 .with_input_appearance(
181 "search",
182 InputAppearance::new(Tone::Secondary, SurfaceLevel::Sunken, TextRole::Body),
183 )
184 .with_text_appearance(
185 "title",
186 TextAppearance {
187 role: TextRole::Title,
188 tone: Tone::Accent,
189 },
190 )
191 .with_text_appearance(
192 "meta",
193 TextAppearance {
194 role: TextRole::Meta,
195 tone: Tone::Neutral,
196 },
197 )
198 .with_tab_strip_appearance(
199 "side-tabs",
200 TabStripAppearance::new(Tone::Primary, TabStripStyle::Utility, TextRole::TabLabel),
201 )
202 .with_tab_strip_appearance(
203 "editor-tabs",
204 TabStripAppearance::new(Tone::Neutral, TabStripStyle::Editor, TextRole::TabLabel),
205 )
206 .with_tab_strip_appearance(
207 "console-tabs",
208 TabStripAppearance::new(Tone::Tertiary, TabStripStyle::Console, TextRole::TabLabel),
209 )
210}More examples
examples/notebook.rs (lines 242-245)
155fn notebook_theme() -> ThemeSpec {
156 let mut theme = ThemeSpec::default();
157 theme.typography.font_family = "\"IBM Plex Sans\", \"Cantarell\", sans-serif".to_string();
158 theme.typography.mono_font_family = "\"IBM Plex Mono\", monospace".to_string();
159 theme.typography.font_size_base = 15;
160 theme.typography.font_size_ui = 14;
161 theme.typography.font_size_small = 13;
162 theme.typography.font_size_tiny = 12;
163 theme.typography.font_size_title = 26;
164 theme.palette.bg_0 = "#f5f0e6".to_string();
165 theme.palette.bg_1 = "#ebe1d2".to_string();
166 theme.palette.workbench = "#fbf7f0".to_string();
167 theme.palette.panel_left = "#f1e7d8".to_string();
168 theme.palette.panel_right = "#f4ebde".to_string();
169 theme.palette.panel_bottom = "#e7d9c6".to_string();
170 theme.palette.border = "#ceb89a".to_string();
171 theme.palette.border_strong = "#b99669".to_string();
172 theme.palette.text_0 = "#2f2418".to_string();
173 theme.palette.text_1 = "#5d4a37".to_string();
174 theme.palette.text_2 = "#8a7258".to_string();
175 theme.palette.accent = "#9b5f2b".to_string();
176 theme.palette.accent_strong = "#bc753b".to_string();
177 theme.density.radius_small = 8;
178 theme.density.radius_medium = 14;
179 theme.density.radius_large = 18;
180 theme.density.space_sm = 6;
181 theme.density.space_md = 10;
182 theme.density.space_lg = 14;
183 theme.density.space_xl = 20;
184 theme.density.control_height_small = 26;
185 theme.density.control_height_medium = 36;
186 theme.density.control_height_large = 40;
187 theme.density.toolbar_height = 58;
188 theme.density.tab_height = 36;
189 theme.density.search_width_min = 360;
190 theme.density.search_width_max = 560;
191 theme.density.panel_header_height = 32;
192 theme.density.min_side_panel_width = 266;
193 theme.density.min_bottom_panel_height = 176;
194
195 theme
196 .with_surface_appearance(
197 "app-shell",
198 SurfaceAppearance::new(Tone::Neutral, SurfaceLevel::Sunken, TextRole::Body)
199 .borderless(),
200 )
201 .with_surface_appearance(
202 "topbar",
203 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Flat, TextRole::BodyStrong),
204 )
205 .with_surface_appearance(
206 "toolbar",
207 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Raised, TextRole::Body),
208 )
209 .with_surface_appearance(
210 "library-panel",
211 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Raised, TextRole::Body),
212 )
213 .with_surface_appearance(
214 "library-header",
215 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Flat, TextRole::SectionLabel),
216 )
217 .with_surface_appearance(
218 "detail-panel",
219 SurfaceAppearance::new(Tone::Secondary, SurfaceLevel::Raised, TextRole::Body),
220 )
221 .with_surface_appearance(
222 "detail-header",
223 SurfaceAppearance::new(Tone::Secondary, SurfaceLevel::Flat, TextRole::SectionLabel),
224 )
225 .with_surface_appearance(
226 "writing-surface",
227 SurfaceAppearance::new(Tone::Neutral, SurfaceLevel::Raised, TextRole::Body)
228 .borderless(),
229 )
230 .with_button_appearance(
231 "primary",
232 ButtonAppearance::new(Tone::Accent, ButtonStyle::Solid, TextRole::BodyStrong),
233 )
234 .with_button_appearance(
235 "secondary",
236 ButtonAppearance::new(Tone::Primary, ButtonStyle::Soft, TextRole::Body),
237 )
238 .with_button_appearance(
239 "ghost",
240 ButtonAppearance::new(Tone::Secondary, ButtonStyle::Ghost, TextRole::Body),
241 )
242 .with_input_appearance(
243 "search",
244 InputAppearance::new(Tone::Secondary, SurfaceLevel::Sunken, TextRole::Body),
245 )
246 .with_text_appearance(
247 "title",
248 TextAppearance {
249 role: TextRole::Title,
250 tone: Tone::Primary,
251 },
252 )
253 .with_text_appearance(
254 "meta",
255 TextAppearance {
256 role: TextRole::Meta,
257 tone: Tone::Secondary,
258 },
259 )
260 .with_tab_strip_appearance(
261 "library-strip",
262 TabStripAppearance::new(Tone::Primary, TabStripStyle::Utility, TextRole::TabLabel),
263 )
264 .with_tab_strip_appearance(
265 "editor",
266 TabStripAppearance::new(Tone::Neutral, TabStripStyle::Editor, TextRole::TabLabel),
267 )
268 .with_tab_strip_appearance(
269 "console",
270 TabStripAppearance::new(Tone::Tertiary, TabStripStyle::Console, TextRole::TabLabel),
271 )
272}Sourcepub fn with_tab_strip_appearance(
self,
id: impl Into<String>,
appearance: TabStripAppearance,
) -> Self
pub fn with_tab_strip_appearance( self, id: impl Into<String>, appearance: TabStripAppearance, ) -> Self
Examples found in repository?
examples/plugin_view.rs (lines 120-123)
72fn plugin_demo_theme() -> ThemeSpec {
73 let mut theme = ThemeSpec::default();
74 theme.typography.font_family = "\"Space Grotesk\", \"Noto Sans\", sans-serif".to_string();
75 theme.typography.mono_font_family = "\"JetBrains Mono\", monospace".to_string();
76 theme.palette.bg_0 = "#0f1318".to_string();
77 theme.palette.bg_1 = "#18202a".to_string();
78 theme.palette.workbench = "#0c1015".to_string();
79 theme.palette.panel_left = "#131920".to_string();
80 theme.palette.panel_right = "#131a22".to_string();
81 theme.palette.panel_bottom = "#0a0d12".to_string();
82 theme.palette.border = "#27303c".to_string();
83 theme.palette.border_strong = "#3d4959".to_string();
84 theme.palette.text_0 = "#e3edf7".to_string();
85 theme.palette.text_1 = "#acb9c8".to_string();
86 theme.palette.text_2 = "#738197".to_string();
87 theme.palette.accent = "#36c2a3".to_string();
88 theme.palette.accent_strong = "#72f0cf".to_string();
89 theme.density.radius_medium = 10;
90 theme.density.radius_large = 14;
91 theme.density.toolbar_height = 42;
92 theme.density.tab_height = 30;
93
94 theme
95 .with_surface_appearance(
96 "topbar",
97 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Flat, TextRole::BodyStrong),
98 )
99 .with_surface_appearance(
100 "toolbar",
101 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Raised, TextRole::Body),
102 )
103 .with_surface_appearance(
104 "demo-workbench",
105 SurfaceAppearance::new(Tone::Neutral, SurfaceLevel::Sunken, TextRole::Body)
106 .borderless(),
107 )
108 .with_surface_appearance(
109 "demo-header",
110 SurfaceAppearance::new(Tone::Secondary, SurfaceLevel::Flat, TextRole::SectionLabel),
111 )
112 .with_button_appearance(
113 "primary",
114 ButtonAppearance::new(Tone::Accent, ButtonStyle::Solid, TextRole::BodyStrong),
115 )
116 .with_button_appearance(
117 "ghost",
118 ButtonAppearance::new(Tone::Secondary, ButtonStyle::Ghost, TextRole::Body),
119 )
120 .with_tab_strip_appearance(
121 "demo-tabs",
122 TabStripAppearance::new(Tone::Secondary, TabStripStyle::Editor, TextRole::TabLabel),
123 )
124}More examples
examples/semantic_appearance.rs (lines 198-201)
118fn semantic_theme() -> ThemeSpec {
119 let mut theme = ThemeSpec::default();
120 theme.typography.font_family = "\"Azeret Mono\", \"Noto Sans\", sans-serif".to_string();
121 theme.typography.mono_font_family = "\"IBM Plex Mono\", monospace".to_string();
122 theme.typography.font_size_base = 14;
123 theme.typography.font_size_ui = 13;
124 theme.typography.font_size_small = 12;
125 theme.typography.font_size_tiny = 11;
126 theme.typography.font_size_title = 28;
127 theme.palette.bg_0 = "#f1efe6".to_string();
128 theme.palette.bg_1 = "#e3dfd3".to_string();
129 theme.palette.workbench = "#f8f6ef".to_string();
130 theme.palette.panel_left = "#d7e1dd".to_string();
131 theme.palette.panel_right = "#e7ddd0".to_string();
132 theme.palette.panel_bottom = "#d9d5df".to_string();
133 theme.palette.border = "#b5b0a3".to_string();
134 theme.palette.border_strong = "#8f8777".to_string();
135 theme.palette.text_0 = "#1f1e1a".to_string();
136 theme.palette.text_1 = "#4b463d".to_string();
137 theme.palette.text_2 = "#6d665a".to_string();
138 theme.palette.accent = "#0f766e".to_string();
139 theme.palette.accent_strong = "#0b5f58".to_string();
140 theme.density.radius_medium = 12;
141 theme.density.radius_large = 16;
142 theme.density.toolbar_height = 46;
143 theme.density.tab_height = 32;
144 theme.density.panel_header_height = 30;
145
146 theme
147 .with_surface_appearance(
148 "primary-panel",
149 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Raised, TextRole::Body),
150 )
151 .with_surface_appearance(
152 "secondary-panel",
153 SurfaceAppearance::new(Tone::Secondary, SurfaceLevel::Raised, TextRole::Body),
154 )
155 .with_surface_appearance(
156 "console-panel",
157 SurfaceAppearance::new(Tone::Tertiary, SurfaceLevel::Sunken, TextRole::Code),
158 )
159 .with_surface_appearance(
160 "canvas-panel",
161 SurfaceAppearance::new(Tone::Neutral, SurfaceLevel::Sunken, TextRole::Body)
162 .borderless(),
163 )
164 .with_surface_appearance(
165 "panel-header",
166 SurfaceAppearance::new(Tone::Neutral, SurfaceLevel::Flat, TextRole::SectionLabel),
167 )
168 .with_button_appearance(
169 "primary",
170 ButtonAppearance::new(Tone::Accent, ButtonStyle::Solid, TextRole::BodyStrong),
171 )
172 .with_button_appearance(
173 "secondary",
174 ButtonAppearance::new(Tone::Primary, ButtonStyle::Soft, TextRole::Body),
175 )
176 .with_button_appearance(
177 "ghost",
178 ButtonAppearance::new(Tone::Neutral, ButtonStyle::Ghost, TextRole::Body),
179 )
180 .with_input_appearance(
181 "search",
182 InputAppearance::new(Tone::Secondary, SurfaceLevel::Sunken, TextRole::Body),
183 )
184 .with_text_appearance(
185 "title",
186 TextAppearance {
187 role: TextRole::Title,
188 tone: Tone::Accent,
189 },
190 )
191 .with_text_appearance(
192 "meta",
193 TextAppearance {
194 role: TextRole::Meta,
195 tone: Tone::Neutral,
196 },
197 )
198 .with_tab_strip_appearance(
199 "side-tabs",
200 TabStripAppearance::new(Tone::Primary, TabStripStyle::Utility, TextRole::TabLabel),
201 )
202 .with_tab_strip_appearance(
203 "editor-tabs",
204 TabStripAppearance::new(Tone::Neutral, TabStripStyle::Editor, TextRole::TabLabel),
205 )
206 .with_tab_strip_appearance(
207 "console-tabs",
208 TabStripAppearance::new(Tone::Tertiary, TabStripStyle::Console, TextRole::TabLabel),
209 )
210}examples/notebook.rs (lines 260-263)
155fn notebook_theme() -> ThemeSpec {
156 let mut theme = ThemeSpec::default();
157 theme.typography.font_family = "\"IBM Plex Sans\", \"Cantarell\", sans-serif".to_string();
158 theme.typography.mono_font_family = "\"IBM Plex Mono\", monospace".to_string();
159 theme.typography.font_size_base = 15;
160 theme.typography.font_size_ui = 14;
161 theme.typography.font_size_small = 13;
162 theme.typography.font_size_tiny = 12;
163 theme.typography.font_size_title = 26;
164 theme.palette.bg_0 = "#f5f0e6".to_string();
165 theme.palette.bg_1 = "#ebe1d2".to_string();
166 theme.palette.workbench = "#fbf7f0".to_string();
167 theme.palette.panel_left = "#f1e7d8".to_string();
168 theme.palette.panel_right = "#f4ebde".to_string();
169 theme.palette.panel_bottom = "#e7d9c6".to_string();
170 theme.palette.border = "#ceb89a".to_string();
171 theme.palette.border_strong = "#b99669".to_string();
172 theme.palette.text_0 = "#2f2418".to_string();
173 theme.palette.text_1 = "#5d4a37".to_string();
174 theme.palette.text_2 = "#8a7258".to_string();
175 theme.palette.accent = "#9b5f2b".to_string();
176 theme.palette.accent_strong = "#bc753b".to_string();
177 theme.density.radius_small = 8;
178 theme.density.radius_medium = 14;
179 theme.density.radius_large = 18;
180 theme.density.space_sm = 6;
181 theme.density.space_md = 10;
182 theme.density.space_lg = 14;
183 theme.density.space_xl = 20;
184 theme.density.control_height_small = 26;
185 theme.density.control_height_medium = 36;
186 theme.density.control_height_large = 40;
187 theme.density.toolbar_height = 58;
188 theme.density.tab_height = 36;
189 theme.density.search_width_min = 360;
190 theme.density.search_width_max = 560;
191 theme.density.panel_header_height = 32;
192 theme.density.min_side_panel_width = 266;
193 theme.density.min_bottom_panel_height = 176;
194
195 theme
196 .with_surface_appearance(
197 "app-shell",
198 SurfaceAppearance::new(Tone::Neutral, SurfaceLevel::Sunken, TextRole::Body)
199 .borderless(),
200 )
201 .with_surface_appearance(
202 "topbar",
203 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Flat, TextRole::BodyStrong),
204 )
205 .with_surface_appearance(
206 "toolbar",
207 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Raised, TextRole::Body),
208 )
209 .with_surface_appearance(
210 "library-panel",
211 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Raised, TextRole::Body),
212 )
213 .with_surface_appearance(
214 "library-header",
215 SurfaceAppearance::new(Tone::Primary, SurfaceLevel::Flat, TextRole::SectionLabel),
216 )
217 .with_surface_appearance(
218 "detail-panel",
219 SurfaceAppearance::new(Tone::Secondary, SurfaceLevel::Raised, TextRole::Body),
220 )
221 .with_surface_appearance(
222 "detail-header",
223 SurfaceAppearance::new(Tone::Secondary, SurfaceLevel::Flat, TextRole::SectionLabel),
224 )
225 .with_surface_appearance(
226 "writing-surface",
227 SurfaceAppearance::new(Tone::Neutral, SurfaceLevel::Raised, TextRole::Body)
228 .borderless(),
229 )
230 .with_button_appearance(
231 "primary",
232 ButtonAppearance::new(Tone::Accent, ButtonStyle::Solid, TextRole::BodyStrong),
233 )
234 .with_button_appearance(
235 "secondary",
236 ButtonAppearance::new(Tone::Primary, ButtonStyle::Soft, TextRole::Body),
237 )
238 .with_button_appearance(
239 "ghost",
240 ButtonAppearance::new(Tone::Secondary, ButtonStyle::Ghost, TextRole::Body),
241 )
242 .with_input_appearance(
243 "search",
244 InputAppearance::new(Tone::Secondary, SurfaceLevel::Sunken, TextRole::Body),
245 )
246 .with_text_appearance(
247 "title",
248 TextAppearance {
249 role: TextRole::Title,
250 tone: Tone::Primary,
251 },
252 )
253 .with_text_appearance(
254 "meta",
255 TextAppearance {
256 role: TextRole::Meta,
257 tone: Tone::Secondary,
258 },
259 )
260 .with_tab_strip_appearance(
261 "library-strip",
262 TabStripAppearance::new(Tone::Primary, TabStripStyle::Utility, TextRole::TabLabel),
263 )
264 .with_tab_strip_appearance(
265 "editor",
266 TabStripAppearance::new(Tone::Neutral, TabStripStyle::Editor, TextRole::TabLabel),
267 )
268 .with_tab_strip_appearance(
269 "console",
270 TabStripAppearance::new(Tone::Tertiary, TabStripStyle::Console, TextRole::TabLabel),
271 )
272}Trait Implementations§
Auto Trait Implementations§
impl Freeze for ThemeSpec
impl RefUnwindSafe for ThemeSpec
impl Send for ThemeSpec
impl Sync for ThemeSpec
impl Unpin for ThemeSpec
impl UnsafeUnpin for ThemeSpec
impl UnwindSafe for ThemeSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more