repose_material/material3/
defaults.rs1use repose_core::*;
2
3pub struct SurfaceDefaults;
5
6impl SurfaceDefaults {
7 pub fn color() -> Color {
8 theme().surface
9 }
10 pub fn content_color() -> Color {
11 theme().on_surface
12 }
13 pub const SHAPE_RADIUS: f32 = 0.0;
14 pub const TONAL_ELEVATION: f32 = 0.0;
15 pub const SHADOW_ELEVATION: f32 = 0.0;
16}
17
18pub struct ToggleButtonDefaults;
20
21impl ToggleButtonDefaults {
22 pub const HEIGHT: f32 = 40.0;
23 pub const HORIZONTAL_PADDING: f32 = 24.0;
24 pub const SHAPE_RADIUS: f32 = 20.0;
25 pub fn content_color() -> Color {
26 theme().on_surface_variant
27 }
28 pub fn checked_container_color() -> Color {
29 theme().primary
30 }
31 pub fn checked_content_color() -> Color {
32 theme().on_primary
33 }
34 pub fn tonal_content_color() -> Color {
35 theme().on_surface_variant
36 }
37 pub fn tonal_checked_container_color() -> Color {
38 theme().secondary_container
39 }
40 pub fn tonal_checked_content_color() -> Color {
41 theme().on_secondary_container
42 }
43 pub fn outlined_content_color() -> Color {
44 theme().on_surface_variant
45 }
46 pub fn outlined_border_color() -> Color {
47 theme().outline
48 }
49 pub fn outlined_checked_container_color() -> Color {
50 theme().secondary_container
51 }
52 pub fn outlined_checked_content_color() -> Color {
53 theme().on_secondary_container
54 }
55 pub fn elevated_content_color() -> Color {
56 theme().primary
57 }
58 pub fn elevated_checked_container_color() -> Color {
59 theme().surface_container_low
60 }
61 pub fn elevated_checked_content_color() -> Color {
62 theme().primary
63 }
64 pub fn state_colors_default() -> StateColors {
65 let th = theme();
66 StateColors {
67 default: Color::TRANSPARENT,
68 hovered: Color::TRANSPARENT,
69 focused: Color::TRANSPARENT,
70 pressed: Color::TRANSPARENT,
71 dragged: th.on_surface.with_alpha_f32(0.12),
72 disabled: th.on_surface.with_alpha_f32(0.12),
73 }
74 }
75 pub fn state_elevation_default() -> StateElevation {
76 StateElevation {
77 default: 0.0,
78 hovered: 1.0,
79 focused: 0.0,
80 pressed: 0.0,
81 dragged: 0.0,
82 disabled: 0.0,
83 }
84 }
85 pub fn elevated_state_elevation() -> StateElevation {
86 let th = theme();
87 StateElevation {
88 default: th.elevation.level1,
89 hovered: th.elevation.level2,
90 focused: th.elevation.level1,
91 pressed: th.elevation.level1,
92 dragged: th.elevation.level1,
93 disabled: 0.0,
94 }
95 }
96}
97
98pub struct ProgressIndicatorDefaults;
100
101impl ProgressIndicatorDefaults {
102 pub fn linear_color() -> Color {
103 theme().primary
104 }
105 pub fn linear_track_color() -> Color {
106 theme().secondary_container
107 }
108 pub const LINEAR_INDICATOR_HEIGHT: f32 = 4.0;
109 pub const LINEAR_INDICATOR_GAP_SIZE: f32 = 4.0;
110 pub const LINEAR_TRACK_STOP_SIZE: f32 = 4.0;
111
112 pub fn circular_color() -> Color {
113 theme().primary
114 }
115 pub fn circular_track_color() -> Color {
116 theme().secondary_container
117 }
118 pub const CIRCULAR_INDICATOR_SIZE: f32 = 40.0;
119 pub const CIRCULAR_STROKE_WIDTH: f32 = 4.0;
120
121 pub const SLIDER_THUMB_TRACK_GAP: f32 = 6.0;
123}
124
125pub struct ButtonDefaults;
127
128impl ButtonDefaults {
129 pub fn content_color() -> Color {
130 theme().on_primary
131 }
132 pub fn container_color() -> Color {
133 theme().primary
134 }
135 pub fn tonal_container_color() -> Color {
136 theme().secondary_container
137 }
138 pub fn tonal_content_color() -> Color {
139 theme().on_secondary_container
140 }
141 pub fn elevated_container_color() -> Color {
142 theme().surface_container_low
143 }
144 pub fn elevated_content_color() -> Color {
145 theme().primary
146 }
147 pub fn outlined_content_color() -> Color {
148 theme().on_surface_variant
149 }
150 pub fn outlined_border_color() -> Color {
151 theme().outline
152 }
153 pub fn text_content_color() -> Color {
154 theme().primary
155 }
156 pub const HEIGHT: f32 = 40.0;
157 pub const MIN_HEIGHT: f32 = 40.0;
158 pub const MIN_WIDTH: f32 = 58.0;
159 pub const HORIZONTAL_PADDING: f32 = 24.0;
160 pub const TEXT_HORIZONTAL_PADDING: f32 = 12.0;
161 pub const CONTENT_PADDING: PaddingValues = PaddingValues {
162 left: 24.0,
163 right: 24.0,
164 top: 8.0,
165 bottom: 8.0,
166 };
167 pub const TEXT_CONTENT_PADDING: PaddingValues = PaddingValues {
168 left: 12.0,
169 right: 12.0,
170 top: 8.0,
171 bottom: 8.0,
172 };
173 pub const SHAPE_RADIUS: f32 = 20.0;
174 pub fn state_colors_default() -> StateColors {
175 let th = theme();
176 StateColors {
177 default: Color::TRANSPARENT,
178 hovered: Color::TRANSPARENT,
179 focused: Color::TRANSPARENT,
180 pressed: Color::TRANSPARENT,
181 dragged: th.on_surface.with_alpha_f32(0.12),
182 disabled: th.on_surface.with_alpha_f32(0.12),
183 }
184 }
185 pub fn state_elevation_default() -> StateElevation {
186 StateElevation {
187 default: 0.0,
188 hovered: 1.0,
189 focused: 0.0,
190 pressed: 0.0,
191 dragged: 0.0,
192 disabled: 0.0,
193 }
194 }
195 pub fn elevated_state_elevation() -> StateElevation {
196 let th = theme();
197 StateElevation {
198 default: th.elevation.level1,
199 hovered: th.elevation.level2,
200 focused: th.elevation.level1,
201 pressed: th.elevation.level1,
202 dragged: th.elevation.level1,
203 disabled: 0.0,
204 }
205 }
206}
207
208pub struct SnackbarDefaults;
210
211impl SnackbarDefaults {
212 pub const MIN_HEIGHT: f32 = 48.0;
213 pub const MIN_WIDTH: f32 = 280.0;
214 pub const MAX_WIDTH: f32 = 600.0;
215 pub const SHAPE_RADIUS: f32 = 4.0;
216 pub fn container_color() -> Color {
217 theme().inverse_surface
218 }
219 pub fn content_color() -> Color {
220 theme().inverse_on_surface
221 }
222 pub fn action_color() -> Color {
223 theme().inverse_primary
224 }
225 pub fn dismiss_action_content_color() -> Color {
226 theme().inverse_on_surface
227 }
228}
229
230pub struct CardDefaults;
232
233impl CardDefaults {
234 pub fn filled_container_color() -> Color {
235 theme().surface_container_highest
236 }
237 pub fn elevated_container_color() -> Color {
238 theme().surface_container_low
239 }
240 pub fn outlined_container_color() -> Color {
241 theme().surface
242 }
243 pub fn outlined_border_color() -> Color {
244 theme().outline_variant
245 }
246 pub fn filled_content_color() -> Color {
247 theme().on_surface
248 }
249 pub fn elevated_content_color() -> Color {
250 theme().on_surface
251 }
252 pub fn outlined_content_color() -> Color {
253 theme().on_surface
254 }
255 pub fn disabled_container_color() -> Color {
256 theme().on_surface.with_alpha_f32(0.04)
257 }
258 pub fn disabled_content_color() -> Color {
259 theme().on_surface.with_alpha_f32(0.38)
260 }
261 pub const SHAPE_RADIUS: f32 = 12.0;
262 pub const ELEVATION: f32 = 0.0;
263}
264
265pub struct DialogDefaults;
267
268impl DialogDefaults {
269 pub fn container_color() -> Color {
270 theme().surface_container_high
271 }
272 pub const SHAPE_RADIUS: f32 = 28.0;
273 pub const MIN_WIDTH: f32 = 280.0;
274 pub const MAX_WIDTH: f32 = 560.0;
275 pub const HORIZONTAL_PADDING: f32 = 24.0;
276}
277
278pub struct IconButtonDefaults;
280
281impl IconButtonDefaults {
282 pub const CONTAINER_SIZE: f32 = 40.0;
284 pub const FILLED_CONTAINER_SIZE: f32 = 40.0;
285 pub const MIN_INTERACTIVE_SIZE: f32 = 48.0;
287 pub const STATE_LAYER_RADIUS: f32 = 20.0;
289 pub fn content_color() -> Color {
290 theme().on_surface_variant
291 }
292 pub fn disabled_content_color() -> Color {
293 theme().on_surface.with_alpha_f32(0.38)
294 }
295 pub fn filled_content_color() -> Color {
296 theme().on_primary
297 }
298 pub fn filled_container_color() -> Color {
299 theme().primary
300 }
301 pub fn filled_tonal_content_color() -> Color {
302 theme().on_secondary_container
303 }
304 pub fn filled_tonal_container_color() -> Color {
305 theme().secondary_container
306 }
307 pub fn state_colors_default() -> StateColors {
308 let th = theme();
309 StateColors {
310 default: Color::TRANSPARENT,
311 hovered: Color::TRANSPARENT,
312 focused: Color::TRANSPARENT,
313 pressed: Color::TRANSPARENT,
314 dragged: th.on_surface.with_alpha_f32(0.12),
315 disabled: Color::TRANSPARENT,
316 }
317 }
318}
319
320pub struct CheckboxDefaults;
322
323impl CheckboxDefaults {
324 pub const TOUCH_TARGET_SIZE: f32 = 40.0;
325 pub const BOX_SIZE: f32 = 18.0;
326 pub const STROKE_WIDTH: f32 = 2.0;
327 pub const CORNER_RADIUS: f32 = 2.0;
328 pub const CHECK_ICON_SIZE: f32 = 14.0;
329 pub fn checked_color() -> Color {
330 theme().primary
331 }
332 pub fn unchecked_color() -> Color {
333 theme().on_surface_variant
334 }
335 pub fn checkmark_color() -> Color {
336 theme().on_primary
337 }
338 pub fn disabled_checked_box_color() -> Color {
339 theme().on_surface.with_alpha_f32(0.38)
340 }
341 pub fn disabled_checkmark_color() -> Color {
342 theme().surface
343 }
344 pub fn disabled_unchecked_border_color() -> Color {
345 theme().on_surface.with_alpha_f32(0.38)
346 }
347 pub fn state_colors_default() -> StateColors {
348 let th = theme();
349 StateColors {
350 default: Color::TRANSPARENT,
351 hovered: Color::TRANSPARENT,
352 focused: Color::TRANSPARENT,
353 pressed: Color::TRANSPARENT,
354 dragged: th.on_surface.with_alpha_f32(0.12),
355 disabled: Color::TRANSPARENT,
356 }
357 }
358}
359
360pub struct RadioButtonDefaults;
362
363impl RadioButtonDefaults {
364 pub const TOUCH_TARGET_SIZE: f32 = 40.0;
365 pub const OUTER_RADIUS: f32 = 10.0;
366 pub const DOT_RADIUS: f32 = 5.0;
367 pub const STROKE_WIDTH: f32 = 2.0;
368 pub fn selected_color() -> Color {
369 theme().primary
370 }
371 pub fn unselected_color() -> Color {
372 theme().on_surface_variant
373 }
374 pub fn disabled_selected_color() -> Color {
375 theme().on_surface.with_alpha_f32(0.38)
376 }
377 pub fn disabled_unselected_color() -> Color {
378 theme().on_surface.with_alpha_f32(0.38)
379 }
380 pub fn state_colors_default() -> StateColors {
381 let th = theme();
382 StateColors {
383 default: Color::TRANSPARENT,
384 hovered: Color::TRANSPARENT,
385 focused: Color::TRANSPARENT,
386 pressed: Color::TRANSPARENT,
387 dragged: th.on_surface.with_alpha_f32(0.12),
388 disabled: Color::TRANSPARENT,
389 }
390 }
391}
392
393pub struct SwitchDefaults;
395
396impl SwitchDefaults {
397 pub const TRACK_WIDTH: f32 = 52.0;
398 pub const TRACK_HEIGHT: f32 = 32.0;
399 pub const THUMB_CHECKED_SIZE: f32 = 24.0;
400 pub const THUMB_UNCHECKED_SIZE: f32 = 16.0;
401 pub fn checked_track_color() -> Color {
402 theme().primary
403 }
404 pub fn unchecked_track_color() -> Color {
405 theme().surface_container_highest
406 }
407 pub fn checked_thumb_color() -> Color {
408 theme().on_primary
409 }
410 pub fn unchecked_thumb_color() -> Color {
411 theme().outline
412 }
413 pub fn checked_icon_color() -> Color {
414 theme().on_primary
415 }
416 pub fn unchecked_icon_color() -> Color {
417 theme().outline
418 }
419 pub fn unchecked_border_color() -> Color {
420 theme().outline
421 }
422 pub fn disabled_checked_thumb_color() -> Color {
423 theme().surface
424 }
425 pub fn disabled_checked_track_color() -> Color {
426 theme().on_surface.with_alpha_f32(0.12)
427 }
428 pub fn disabled_checked_icon_color() -> Color {
429 theme().on_surface.with_alpha_f32(0.38)
430 }
431 pub fn disabled_unchecked_thumb_color() -> Color {
432 theme().on_surface.with_alpha_f32(0.38)
433 }
434 pub fn disabled_unchecked_track_color() -> Color {
435 theme().surface_container_highest.with_alpha_f32(0.12)
436 }
437 pub fn disabled_unchecked_border_color() -> Color {
438 theme().on_surface.with_alpha_f32(0.12)
439 }
440 pub fn disabled_unchecked_icon_color() -> Color {
441 theme().surface_container_highest.with_alpha_f32(0.38)
442 }
443 pub fn state_colors_default() -> StateColors {
444 let th = theme();
445 StateColors {
446 default: Color::TRANSPARENT,
447 hovered: Color::TRANSPARENT,
448 focused: Color::TRANSPARENT,
449 pressed: Color::TRANSPARENT,
450 dragged: th.on_surface.with_alpha_f32(0.12),
451 disabled: Color::TRANSPARENT,
452 }
453 }
454}
455
456pub struct SliderDefaults;
458
459impl SliderDefaults {
460 pub const TRACK_HEIGHT: f32 = 16.0;
461 pub const THUMB_WIDTH: f32 = 4.0;
462 pub const THUMB_HEIGHT: f32 = 44.0;
463 pub const STATE_LAYER_SIZE: f32 = 40.0;
465 pub const THUMB_SIZE: f32 = 20.0;
467 pub fn active_track_color() -> Color {
468 theme().primary
469 }
470 pub fn inactive_track_color() -> Color {
471 theme().secondary_container
472 }
473 pub fn thumb_color() -> Color {
474 theme().primary
475 }
476 pub fn active_tick_color() -> Color {
477 theme().secondary_container
478 }
479 pub fn inactive_tick_color() -> Color {
480 theme().primary
481 }
482 pub fn disabled_thumb_color() -> Color {
483 theme().on_surface.with_alpha_f32(0.38)
484 }
485 pub fn disabled_active_track_color() -> Color {
486 theme().on_surface.with_alpha_f32(0.38)
487 }
488 pub fn disabled_inactive_track_color() -> Color {
489 theme().on_surface.with_alpha_f32(0.12)
490 }
491 pub fn disabled_active_tick_color() -> Color {
492 theme().on_surface.with_alpha_f32(0.12)
493 }
494 pub fn disabled_inactive_tick_color() -> Color {
495 theme().on_surface.with_alpha_f32(0.38)
496 }
497 pub fn state_colors_default() -> StateColors {
498 let th = theme();
499 let c = th.primary;
500 StateColors {
501 default: Color::TRANSPARENT,
502 hovered: c.with_alpha_f32(0.08),
503 focused: c.with_alpha_f32(0.12),
504 pressed: c.with_alpha_f32(0.10),
505 dragged: c.with_alpha_f32(0.10),
506 disabled: Color::TRANSPARENT,
507 }
508 }
509}
510
511pub struct DividerDefaults;
513
514impl DividerDefaults {
515 pub const THICKNESS: f32 = 1.0;
516 pub fn color() -> Color {
517 theme().outline_variant
518 }
519}
520
521pub struct BadgeDefaults;
523
524impl BadgeDefaults {
525 pub const DOT_SIZE: f32 = 6.0;
526 pub const LABEL_MIN_WIDTH: f32 = 16.0;
527 pub const LABEL_HEIGHT: f32 = 16.0;
528 pub const DOT_OFFSET_X: f32 = 6.0;
529 pub const DOT_OFFSET_Y: f32 = 6.0;
530 pub const CONTENT_OFFSET_X: f32 = 12.0;
531 pub const CONTENT_OFFSET_Y: f32 = 14.0;
532 pub fn container_color() -> Color {
533 theme().error
534 }
535 pub fn content_color() -> Color {
536 theme().on_error
537 }
538}
539
540pub struct ListItemDefaults;
542
543impl ListItemDefaults {
544 pub const ONE_LINE_HEIGHT: f32 = 56.0;
545 pub const TWO_LINE_HEIGHT: f32 = 72.0;
546 pub const THREE_LINE_HEIGHT: f32 = 88.0;
547 pub const HORIZONTAL_PADDING: f32 = 16.0;
548 pub const TRAILING_PADDING: f32 = 24.0;
549 pub fn headline_color() -> Color {
550 theme().on_surface
551 }
552 pub fn supporting_color() -> Color {
553 theme().on_surface_variant
554 }
555 pub fn overline_color() -> Color {
556 theme().on_surface_variant
557 }
558 pub fn leading_icon_color() -> Color {
559 theme().on_surface_variant
560 }
561 pub fn trailing_icon_color() -> Color {
562 theme().on_surface_variant
563 }
564 pub fn disabled_container_color() -> Color {
566 theme().on_surface.with_alpha_f32(0.04)
567 }
568 pub fn disabled_headline_color() -> Color {
569 theme().on_surface.with_alpha_f32(0.38)
570 }
571 pub fn disabled_supporting_color() -> Color {
572 theme().on_surface.with_alpha_f32(0.38)
573 }
574 pub fn disabled_overline_color() -> Color {
575 theme().on_surface.with_alpha_f32(0.38)
576 }
577 pub fn disabled_leading_icon_color() -> Color {
578 theme().on_surface.with_alpha_f32(0.38)
579 }
580 pub fn disabled_trailing_icon_color() -> Color {
581 theme().on_surface.with_alpha_f32(0.38)
582 }
583 pub fn selected_container_color() -> Color {
585 theme().surface_container_high
586 }
587 pub fn selected_headline_color() -> Color {
588 theme().on_surface
589 }
590 pub fn selected_supporting_color() -> Color {
591 theme().on_surface_variant
592 }
593 pub fn selected_overline_color() -> Color {
594 theme().on_surface_variant
595 }
596 pub fn selected_leading_icon_color() -> Color {
597 theme().on_surface_variant
598 }
599 pub fn selected_trailing_icon_color() -> Color {
600 theme().on_surface_variant
601 }
602 pub fn dragged_container_color() -> Color {
604 theme().surface_container_high
605 }
606 pub fn dragged_headline_color() -> Color {
607 theme().on_surface
608 }
609 pub fn dragged_supporting_color() -> Color {
610 theme().on_surface_variant
611 }
612 pub fn dragged_overline_color() -> Color {
613 theme().on_surface_variant
614 }
615 pub fn dragged_leading_icon_color() -> Color {
616 theme().on_surface_variant
617 }
618 pub fn dragged_trailing_icon_color() -> Color {
619 theme().on_surface_variant
620 }
621 pub fn state_colors_default() -> StateColors {
622 let th = theme();
623 StateColors {
624 default: Color::TRANSPARENT,
625 hovered: Color::TRANSPARENT,
626 focused: Color::TRANSPARENT,
627 pressed: Color::TRANSPARENT,
628 dragged: th.on_surface.with_alpha_f32(0.12),
629 disabled: Color::TRANSPARENT,
630 }
631 }
632}
633
634pub struct TopAppBarDefaults;
636
637impl TopAppBarDefaults {
638 pub const HEIGHT: f32 = 64.0;
639 pub fn container_color() -> Color {
640 theme().surface
641 }
642 pub fn scrolled_container_color() -> Color {
643 theme().surface_container
644 }
645 pub fn title_content_color() -> Color {
646 theme().on_surface
647 }
648 pub fn subtitle_content_color() -> Color {
649 theme().on_surface_variant
650 }
651 pub fn navigation_icon_content_color() -> Color {
652 theme().on_surface
653 }
654 pub fn action_icon_content_color() -> Color {
655 theme().on_surface_variant
656 }
657}
658
659pub struct TabDefaults;
661
662impl TabDefaults {
663 pub const HEIGHT: f32 = 48.0;
664 pub const INDICATOR_HEIGHT: f32 = 3.0;
665 pub const INDICATOR_CORNER: f32 = 1.5;
666 pub fn container_color() -> Color {
667 theme().surface
668 }
669 pub fn selected_content_color() -> Color {
670 theme().primary
671 }
672 pub fn unselected_content_color() -> Color {
673 theme().on_surface_variant
674 }
675 pub fn indicator_color() -> Color {
676 theme().primary
677 }
678}
679
680pub struct NavigationBarDefaults;
682
683impl NavigationBarDefaults {
684 pub const HEIGHT: f32 = 80.0;
685 pub const TONAL_ELEVATION: f32 = 0.0;
686 pub const ITEM_ACTIVE_INDICATOR_OPACITY: f32 = 1.0;
687 pub const ITEM_SPACING: f32 = 8.0;
688 pub const ACTIVE_INDICATOR_WIDTH: f32 = 56.0;
689 pub const ACTIVE_INDICATOR_HEIGHT: f32 = 32.0;
690 pub fn container_color() -> Color {
691 theme().surface_container
692 }
693 pub fn content_color() -> Color {
694 theme().on_surface
695 }
696 pub fn selected_icon_color() -> Color {
697 theme().on_secondary_container
698 }
699 pub fn selected_text_color() -> Color {
700 theme().secondary
701 }
702 pub fn unselected_icon_color() -> Color {
703 theme().on_surface_variant
704 }
705 pub fn unselected_text_color() -> Color {
706 theme().on_surface_variant
707 }
708 pub fn indicator_color() -> Color {
709 theme().secondary_container
710 }
711 pub const INDICATOR_RADIUS: f32 = 16.0;
712}
713
714pub struct NavigationRailDefaults;
716
717impl NavigationRailDefaults {
718 pub const WIDTH: f32 = 80.0;
719 pub const ITEM_RADIUS: f32 = 16.0;
720 pub const ITEM_MIN_HEIGHT: f32 = 56.0;
721 pub const ITEM_ACTIVE_INDICATOR_OPACITY: f32 = 1.0;
722 pub const ITEM_SPACING: f32 = 4.0;
723 pub const ACTIVE_INDICATOR_WIDTH: f32 = 56.0;
724 pub const ACTIVE_INDICATOR_HEIGHT: f32 = 32.0;
725 pub fn container_color() -> Color {
726 theme().surface
727 }
728 pub fn selected_icon_color() -> Color {
729 theme().on_secondary_container
730 }
731 pub fn selected_text_color() -> Color {
732 theme().secondary
733 }
734 pub fn unselected_icon_color() -> Color {
735 theme().on_surface_variant
736 }
737 pub fn unselected_text_color() -> Color {
738 theme().on_surface_variant
739 }
740 pub fn indicator_color() -> Color {
741 theme().secondary_container
742 }
743}
744
745pub struct SegmentedButtonDefaults;
747
748impl SegmentedButtonDefaults {
749 pub const HEIGHT: f32 = 40.0;
750 pub const SHAPE_RADIUS: f32 = 20.0;
751 pub const CONTENT_PADDING: PaddingValues = PaddingValues {
752 left: 12.0,
753 right: 12.0,
754 top: 0.0,
755 bottom: 0.0,
756 };
757 pub fn border_color() -> Color {
758 theme().outline
759 }
760 pub fn selected_container_color() -> Color {
761 theme().secondary_container
762 }
763 pub fn selected_content_color() -> Color {
764 theme().on_secondary_container
765 }
766 pub fn unselected_content_color() -> Color {
767 theme().on_surface
768 }
769 pub fn state_colors_default() -> StateColors {
770 let th = theme();
771 StateColors {
772 default: Color::TRANSPARENT,
773 hovered: Color::TRANSPARENT,
774 focused: Color::TRANSPARENT,
775 pressed: Color::TRANSPARENT,
776 dragged: th.on_surface.with_alpha_f32(0.12),
777 disabled: Color::TRANSPARENT,
778 }
779 }
780}
781
782pub struct FABDefaults;
784
785impl FABDefaults {
786 pub const SMALL_SIZE: f32 = 40.0;
787 pub const SMALL_SHAPE_RADIUS: f32 = 12.0;
788 pub const SIZE: f32 = 56.0;
789 pub const LARGE_SIZE: f32 = 96.0;
790 pub const SHAPE_RADIUS: f32 = 28.0;
791 pub const LARGE_SHAPE_RADIUS: f32 = 28.0;
792 pub fn container_color() -> Color {
793 theme().primary_container
794 }
795 pub fn content_color() -> Color {
796 theme().on_primary_container
797 }
798 pub fn state_elevation() -> StateElevation {
799 StateElevation {
800 default: theme().elevation.level3,
801 hovered: theme().elevation.level4,
802 focused: theme().elevation.level3,
803 pressed: theme().elevation.level5,
804 dragged: theme().elevation.level5,
805 disabled: 0.0,
806 }
807 }
808}
809
810pub struct ChipDefaults;
812
813impl ChipDefaults {
814 pub const HEIGHT: f32 = 32.0;
815 pub const HORIZONTAL_PADDING: f32 = 16.0;
816 pub const SHAPE_RADIUS: f32 = 8.0;
817 pub const BORDER_WIDTH: f32 = 1.0;
818
819 pub fn container_color() -> Color {
821 Color::TRANSPARENT
822 }
823 pub fn label_color() -> Color {
824 theme().on_surface_variant
825 }
826 pub fn leading_icon_color() -> Color {
827 theme().primary
828 }
829 pub fn trailing_icon_color() -> Color {
830 theme().primary
831 }
832
833 pub fn disabled_container_color() -> Color {
835 Color::TRANSPARENT
836 }
837 pub fn disabled_label_color() -> Color {
838 theme().on_surface.with_alpha_f32(0.38)
839 }
840 pub fn disabled_leading_icon_color() -> Color {
841 theme().on_surface.with_alpha_f32(0.38)
842 }
843 pub fn disabled_trailing_icon_color() -> Color {
844 theme().on_surface.with_alpha_f32(0.38)
845 }
846
847 pub fn selected_container_color() -> Color {
849 theme().secondary_container
850 }
851 pub fn selected_label_color() -> Color {
852 theme().on_secondary_container
853 }
854 pub fn selected_leading_icon_color() -> Color {
855 theme().primary
856 }
857 pub fn selected_trailing_icon_color() -> Color {
858 theme().on_secondary_container
859 }
860
861 pub fn disabled_selected_container_color() -> Color {
863 theme()
864 .on_surface
865 .with_alpha_f32(0.12)
866 .composite_over(theme().secondary_container)
867 }
868
869 pub fn border_color() -> Color {
871 theme().outline_variant
872 }
873 pub fn selected_border_color() -> Color {
874 Color::TRANSPARENT
875 }
876 pub fn disabled_border_color() -> Color {
877 theme().on_surface.with_alpha_f32(0.12)
878 }
879 pub fn disabled_selected_border_color() -> Color {
880 Color::TRANSPARENT
881 }
882
883 pub fn elevation_default() -> f32 {
885 0.0
886 }
887 pub fn elevation_hovered() -> f32 {
888 0.0
889 }
890 pub fn elevation_focused() -> f32 {
891 0.0
892 }
893 pub fn elevation_pressed() -> f32 {
894 0.0
895 }
896 pub fn elevation_dragged() -> f32 {
897 0.0
898 }
899 pub fn elevation_disabled() -> f32 {
900 0.0
901 }
902
903 pub fn elevated_elevation_default() -> f32 {
905 theme().elevation.level1
906 }
907 pub fn elevated_elevation_hovered() -> f32 {
908 theme().elevation.level2
909 }
910 pub fn elevated_elevation_focused() -> f32 {
911 theme().elevation.level1
912 }
913 pub fn elevated_elevation_pressed() -> f32 {
914 theme().elevation.level1
915 }
916 pub fn elevated_elevation_dragged() -> f32 {
917 theme().elevation.level4
919 }
920 pub fn elevated_elevation_disabled() -> f32 {
921 0.0
922 }
923
924 pub fn elevated_container_color() -> Color {
926 theme().surface_container_low
927 }
928 pub fn elevated_selected_container_color() -> Color {
929 theme().secondary_container
930 }
931 pub fn disabled_elevated_container_color() -> Color {
932 theme()
933 .on_surface
934 .with_alpha_f32(0.12)
935 .composite_over(theme().surface_container_low)
936 }
937}
938
939pub struct ScaffoldDefaults;
941
942impl ScaffoldDefaults {
943 pub fn container_color() -> Color {
944 theme().background
945 }
946 pub fn content_color() -> Color {
947 theme().on_background
948 }
949 pub const TOP_BAR_HEIGHT: f32 = 64.0;
950 pub const BOTTOM_BAR_HEIGHT: f32 = 80.0;
951 pub const FAB_MARGIN: f32 = 16.0;
952}
953
954pub struct NavigationDrawerDefaults;
956
957impl NavigationDrawerDefaults {
958 pub const WIDTH: f32 = 300.0;
959 pub const TONAL_ELEVATION: f32 = 0.0;
960 pub fn container_color() -> Color {
961 theme().surface_container_low
962 }
963 pub fn content_color() -> Color {
964 theme().on_surface_variant
965 }
966 pub fn scrim_color() -> Color {
967 theme().scrim.with_alpha(82)
968 }
969 pub const SHAPE_RADIUS: f32 = 16.0;
970}
971
972pub struct BottomSheetDefaults;
974
975impl BottomSheetDefaults {
976 pub const TONAL_ELEVATION: f32 = 0.0;
977 pub fn container_color() -> Color {
978 theme().surface_container_low
979 }
980 pub fn content_color() -> Color {
981 theme().on_surface
982 }
983 pub fn drag_handle_color() -> Color {
984 theme().on_surface_variant
985 }
986 pub fn scrim_color() -> Color {
987 theme().scrim.with_alpha(85)
988 }
989 pub const DRAG_HANDLE_WIDTH: f32 = 32.0;
990 pub const DRAG_HANDLE_HEIGHT: f32 = 4.0;
991 pub const SHAPE_RADIUS: f32 = 16.0;
992 pub const PEEK_HEIGHT: f32 = 56.0;
993 pub const MAX_WIDTH: f32 = 640.0;
994}
995
996pub struct SearchBarDefaults;
998
999impl SearchBarDefaults {
1000 pub const HEIGHT: f32 = 56.0;
1001 pub const EXPANDED_WIDTH: f32 = 360.0;
1002 pub const COLLAPSED_WIDTH: f32 = 240.0;
1003 pub const DOCKED_HEIGHT: f32 = 400.0;
1004 pub const TONAL_ELEVATION: f32 = 0.0;
1005 pub const SHADOW_ELEVATION: f32 = 0.0;
1006 pub const SHAPE_RADIUS: f32 = 28.0; pub const ACTIVE_SHAPE_RADIUS: f32 = 28.0;
1008 pub const DOCKED_SHAPE_RADIUS: f32 = 28.0;
1009 pub const DROPDOWN_SHAPE_RADIUS: f32 = 12.0;
1010 pub const DROPDOWN_GAP_SIZE: f32 = 2.0;
1011 pub const MIN_WIDTH: f32 = Self::COLLAPSED_WIDTH;
1012 pub const MAX_WIDTH: f32 = 720.0;
1013 pub const VERTICAL_PADDING: f32 = 8.0;
1014
1015 pub const CONTENT_PADDING: PaddingValues = PaddingValues {
1016 left: 16.0,
1017 right: 16.0,
1018 top: 0.0,
1019 bottom: 0.0,
1020 };
1021
1022 pub fn container_color() -> Color {
1023 theme().surface_container
1024 }
1025 pub fn active_container_color() -> Color {
1026 theme().surface_container_high
1027 }
1028 pub fn content_color() -> Color {
1029 theme().on_surface
1030 }
1031 pub fn placeholder_color() -> Color {
1032 theme().on_surface_variant
1033 }
1034 pub fn divider_color() -> Color {
1035 theme().outline_variant
1036 }
1037 pub fn scrim_color() -> Color {
1038 theme().scrim.with_alpha(85)
1039 }
1040 pub fn scrolled_container_color() -> Color {
1041 theme().surface_container_highest
1042 }
1043 pub fn app_bar_container_color() -> Color {
1044 theme().surface
1045 }
1046 pub fn scrolled_app_bar_container_color() -> Color {
1047 theme().surface_container
1048 }
1049 pub fn navigation_icon_content_color() -> Color {
1050 theme().on_surface
1051 }
1052 pub fn action_icon_content_color() -> Color {
1053 theme().on_surface_variant
1054 }
1055 pub fn dropdown_scrim_color() -> Color {
1056 Color::TRANSPARENT
1057 }
1058}
1059
1060pub struct DropdownMenuDefaults;
1062
1063impl DropdownMenuDefaults {
1064 pub const MIN_WIDTH: f32 = 112.0;
1065 pub const ITEM_HEIGHT: f32 = 48.0;
1066 pub const VERTICAL_MARGIN: f32 = 48.0;
1067 pub const HORIZONTAL_MARGIN: f32 = 8.0;
1068 pub const MAX_WIDTH: f32 = 280.0;
1069 pub fn container_color() -> Color {
1070 theme().surface_container
1071 }
1072 pub fn item_text_color() -> Color {
1073 theme().on_surface
1074 }
1075 pub fn disabled_item_text_color() -> Color {
1076 theme().on_surface.with_alpha_f32(0.38)
1077 }
1078 pub fn divider_color() -> Color {
1079 theme().outline_variant
1080 }
1081}
1082
1083pub struct TooltipDefaults;
1085
1086impl TooltipDefaults {
1087 pub const OFFSET_Y: f32 = -28.0;
1088 pub const HORIZONTAL_PADDING: f32 = 8.0;
1089 pub const VERTICAL_PADDING: f32 = 4.0;
1090 pub const MAX_WIDTH: f32 = 200.0;
1091 pub fn container_color() -> Color {
1092 theme().inverse_surface
1093 }
1094 pub fn content_color() -> Color {
1095 theme().inverse_on_surface
1096 }
1097}
1098
1099pub struct PullToRefreshDefaults;
1101
1102impl PullToRefreshDefaults {
1103 pub const THRESHOLD: f32 = 64.0;
1104 pub fn indicator_color() -> Color {
1105 theme().primary
1106 }
1107 pub fn container_color() -> Color {
1108 Color::TRANSPARENT
1109 }
1110}
1111
1112pub struct AlertDialogDefaults;
1114
1115impl AlertDialogDefaults {
1116 pub const MIN_WIDTH: f32 = 280.0;
1117 pub const MAX_WIDTH: f32 = 560.0;
1118 pub const HORIZONTAL_PADDING: f32 = 24.0;
1119 pub fn scrim_color() -> Color {
1120 theme().scrim.with_alpha(82)
1121 }
1122}
1123
1124pub struct OutlinedTextFieldDefaults;
1126
1127impl OutlinedTextFieldDefaults {
1128 pub const MIN_HEIGHT: f32 = 56.0;
1129 pub const MIN_WIDTH: f32 = 280.0;
1130 pub const UNFOCUSED_BORDER_THICKNESS: f32 = 1.0;
1131 pub const FOCUSED_BORDER_THICKNESS: f32 = 2.0;
1132 pub const TEXT_FIELD_PADDING: f32 = 16.0;
1133 pub const VERTICAL_PADDING_WITH_LABEL: f32 = 8.0;
1134
1135 pub fn label_color() -> Color {
1136 theme().on_surface_variant
1137 }
1138 pub fn focused_label_color() -> Color {
1139 theme().primary
1140 }
1141 pub fn error_label_color() -> Color {
1142 theme().error
1143 }
1144 pub fn input_color() -> Color {
1145 theme().on_surface
1146 }
1147 pub fn disabled_input_color() -> Color {
1148 theme().on_surface.with_alpha_f32(0.38)
1149 }
1150 pub fn supporting_color() -> Color {
1151 theme().on_surface_variant
1152 }
1153 pub fn placeholder_color() -> Color {
1154 theme().on_surface_variant
1155 }
1156 pub fn leading_icon_color() -> Color {
1157 theme().on_surface_variant
1158 }
1159 pub fn trailing_icon_color() -> Color {
1160 theme().on_surface_variant
1161 }
1162 pub fn unfocused_border_color() -> Color {
1163 theme().outline
1164 }
1165 pub fn focused_border_color() -> Color {
1166 theme().primary
1167 }
1168 pub fn error_border_color() -> Color {
1169 theme().error
1170 }
1171 pub fn cursor_color() -> Color {
1172 theme().primary
1173 }
1174 pub fn container_color() -> Color {
1175 Color::TRANSPARENT
1176 }
1177}
1178
1179pub struct DatePickerDefaults;
1181
1182impl DatePickerDefaults {
1183 pub const CONTAINER_WIDTH: f32 = 360.0;
1184 pub const CONTAINER_HEIGHT: f32 = 568.0;
1185 pub const HEADER_CONTAINER_HEIGHT: f32 = 120.0;
1186 pub const DATE_CELL_SIZE: f32 = 40.0;
1187 pub const YEAR_CELL_HEIGHT: f32 = 36.0;
1188 pub const YEAR_CELL_WIDTH: f32 = 72.0;
1189 pub const TODAY_BORDER_WIDTH: f32 = 1.0;
1190 pub const HORIZONTAL_PADDING: f32 = 12.0;
1191
1192 pub fn container_color() -> Color {
1193 theme().surface_container_high
1194 }
1195 pub fn header_color() -> Color {
1196 theme().on_surface_variant
1197 }
1198 pub fn weekday_color() -> Color {
1199 theme().on_surface
1200 }
1201 pub fn day_color() -> Color {
1202 theme().on_surface
1203 }
1204 pub fn selected_day_color() -> Color {
1205 theme().on_primary
1206 }
1207 pub fn selected_day_container_color() -> Color {
1208 theme().primary
1209 }
1210 pub fn today_content_color() -> Color {
1211 theme().primary
1212 }
1213 pub fn today_border_color() -> Color {
1214 theme().primary
1215 }
1216 pub fn year_selected_container_color() -> Color {
1217 theme().primary
1218 }
1219 pub fn year_selected_content_color() -> Color {
1220 theme().on_primary
1221 }
1222 pub fn year_unselected_content_color() -> Color {
1223 theme().on_surface_variant
1224 }
1225}
1226
1227pub struct TimePickerDefaults;
1229
1230impl TimePickerDefaults {
1231 pub const CLOCK_DIAL_CONTAINER_SIZE: f32 = 256.0;
1232 pub const CLOCK_DIAL_MIN_CONTAINER_SIZE: f32 = 200.0;
1233 pub const PERIOD_SELECTOR_HORIZONTAL_WIDTH: f32 = 216.0;
1234 pub const PERIOD_SELECTOR_HORIZONTAL_HEIGHT: f32 = 38.0;
1235 pub const PERIOD_SELECTOR_VERTICAL_WIDTH: f32 = 52.0;
1236 pub const PERIOD_SELECTOR_VERTICAL_HEIGHT: f32 = 80.0;
1237 pub const TIME_SELECTOR_CONTAINER_WIDTH: f32 = 96.0;
1238 pub const TIME_SELECTOR_CONTAINER_HEIGHT: f32 = 80.0;
1239 pub const TIME_SELECTOR_24H_WIDTH: f32 = 114.0;
1240 pub const MAX_HEIGHT: f32 = 384.0;
1241
1242 pub fn clock_dial_color() -> Color {
1243 theme().surface_container_highest
1244 }
1245 pub fn clock_dial_selected_content_color() -> Color {
1246 theme().on_primary
1247 }
1248 pub fn clock_dial_unselected_content_color() -> Color {
1249 theme().on_surface
1250 }
1251 pub fn selector_color() -> Color {
1252 theme().primary
1253 }
1254 pub fn container_color() -> Color {
1255 theme().surface_container_high
1256 }
1257 pub fn period_selector_selected_container_color() -> Color {
1258 theme().tertiary_container
1259 }
1260 pub fn period_selector_unselected_container_color() -> Color {
1261 Color::TRANSPARENT
1262 }
1263 pub fn period_selector_selected_content_color() -> Color {
1264 theme().on_tertiary_container
1265 }
1266 pub fn period_selector_unselected_content_color() -> Color {
1267 theme().on_surface_variant
1268 }
1269 pub fn period_selector_border_color() -> Color {
1270 theme().outline
1271 }
1272 pub fn time_selector_selected_container_color() -> Color {
1273 theme().primary_container
1274 }
1275 pub fn time_selector_selected_content_color() -> Color {
1276 theme().on_primary_container
1277 }
1278 pub fn time_selector_unselected_container_color() -> Color {
1279 theme().surface_container_highest
1280 }
1281 pub fn time_selector_unselected_content_color() -> Color {
1282 theme().on_surface
1283 }
1284 pub fn time_selector_separator_color() -> Color {
1285 theme().on_surface
1286 }
1287}
1288
1289pub struct SwipeToDismissDefaults;
1291
1292impl SwipeToDismissDefaults {
1293 pub const POSITIONAL_THRESHOLD: f32 = 56.0;
1294 pub const DISMISS_THRESHOLD: f32 = 150.0;
1295 pub const DISMISSED_OFFSET: f32 = 300.0;
1296 pub const MAX_WIDTH: f32 = 400.0;
1297}
1298
1299pub struct SplitButtonDefaults;
1303
1304impl SplitButtonDefaults {
1305 pub const SPACING: f32 = 2.0;
1307 pub const LEADING_BUTTON_MIN_WIDTH: f32 = 48.0;
1308
1309 pub const XSMALL_CONTAINER_HEIGHT: f32 = 32.0;
1310 pub const SMALL_CONTAINER_HEIGHT: f32 = 40.0; pub const MEDIUM_CONTAINER_HEIGHT: f32 = 56.0;
1312 pub const LARGE_CONTAINER_HEIGHT: f32 = 64.0; pub const XLARGE_CONTAINER_HEIGHT: f32 = 72.0; pub const OUTER_CORNER_SIZE: f32 = f32::INFINITY; pub const SMALL_INNER_CORNER_SIZE: f32 = 4.0;
1319 pub const XSMALL_INNER_CORNER_SIZE: f32 = 4.0;
1321 pub const MEDIUM_INNER_CORNER_SIZE: f32 = 4.0;
1323 pub const LARGE_INNER_CORNER_SIZE: f32 = 4.0;
1325 pub const XLARGE_INNER_CORNER_SIZE: f32 = 4.0;
1327
1328 pub const XSMALL_INNER_CORNER_SIZE_PRESSED: f32 = 6.0;
1330 pub const SMALL_INNER_CORNER_SIZE_PRESSED: f32 = 6.0;
1331 pub const MEDIUM_INNER_CORNER_SIZE_PRESSED: f32 = 6.0;
1332 pub const LARGE_INNER_CORNER_SIZE_PRESSED: f32 = 6.0;
1333 pub const XLARGE_INNER_CORNER_SIZE_PRESSED: f32 = 6.0;
1334
1335 pub const LEADING_ICON_SIZE: f32 = 18.0;
1337 pub const TRAILING_ICON_SIZE: f32 = 22.0;
1339 pub const XSMALL_TRAILING_ICON_SIZE: f32 = 22.0;
1340 pub const MEDIUM_TRAILING_ICON_SIZE: f32 = 26.0;
1341 pub const LARGE_TRAILING_ICON_SIZE: f32 = 26.0;
1342 pub const XLARGE_TRAILING_ICON_SIZE: f32 = 26.0;
1343
1344 pub fn small_leading_content_padding() -> PaddingValues {
1348 PaddingValues {
1349 left: 16.0,
1350 right: 12.0,
1351 top: 0.0,
1352 bottom: 0.0,
1353 }
1354 }
1355
1356 pub fn small_trailing_content_padding() -> PaddingValues {
1360 PaddingValues {
1361 left: 13.0,
1362 right: 13.0,
1363 top: 0.0,
1364 bottom: 0.0,
1365 }
1366 }
1367
1368 pub fn xsmall_leading_content_padding() -> PaddingValues {
1372 PaddingValues {
1373 left: 12.0,
1374 right: 10.0,
1375 top: 0.0,
1376 bottom: 0.0,
1377 }
1378 }
1379
1380 pub fn xsmall_trailing_content_padding() -> PaddingValues {
1384 PaddingValues {
1385 left: 13.0,
1386 right: 13.0,
1387 top: 0.0,
1388 bottom: 0.0,
1389 }
1390 }
1391
1392 pub fn medium_leading_content_padding() -> PaddingValues {
1396 PaddingValues {
1397 left: 24.0,
1398 right: 24.0,
1399 top: 0.0,
1400 bottom: 0.0,
1401 }
1402 }
1403
1404 pub fn medium_trailing_content_padding() -> PaddingValues {
1408 PaddingValues {
1409 left: 15.0,
1410 right: 15.0,
1411 top: 0.0,
1412 bottom: 0.0,
1413 }
1414 }
1415
1416 pub fn large_leading_content_padding() -> PaddingValues {
1418 PaddingValues {
1419 left: 32.0,
1420 right: 32.0,
1421 top: 0.0,
1422 bottom: 0.0,
1423 }
1424 }
1425
1426 pub fn large_trailing_content_padding() -> PaddingValues {
1428 PaddingValues {
1429 left: 24.0,
1430 right: 24.0,
1431 top: 0.0,
1432 bottom: 0.0,
1433 }
1434 }
1435
1436 pub fn xlarge_leading_content_padding() -> PaddingValues {
1438 PaddingValues {
1439 left: 32.0,
1440 right: 32.0,
1441 top: 0.0,
1442 bottom: 0.0,
1443 }
1444 }
1445
1446 pub fn xlarge_trailing_content_padding() -> PaddingValues {
1448 PaddingValues {
1449 left: 24.0,
1450 right: 24.0,
1451 top: 0.0,
1452 bottom: 0.0,
1453 }
1454 }
1455}
1456
1457pub struct ButtonGroupDefaults;
1462
1463impl ButtonGroupDefaults {
1464 pub const EXPANDED_RATIO: f32 = 0.15;
1466
1467 pub const STANDARD_GAP: f32 = 12.0;
1470
1471 pub const CONNECTED_GAP: f32 = 2.0;
1474
1475 pub const CONTAINER_HEIGHT: f32 = 40.0;
1476
1477 pub const CONNECTED_INNER_CORNER: f32 = 8.0; pub const CONNECTED_PRESSED_INNER_CORNER: f32 = 4.0; pub const CONNECTED_CHECKED_CORNER: f32 = f32::INFINITY;
1485 pub const CONNECTED_OUTER_CORNER: f32 = f32::INFINITY;
1487}
1488
1489pub struct CarouselDefaults;
1491
1492impl CarouselDefaults {
1493 pub const MIN_SMALL_ITEM_SIZE: f32 = 40.0;
1494 pub const MAX_SMALL_ITEM_SIZE: f32 = 56.0;
1495 pub const ANCHOR_SIZE: f32 = 10.0;
1496}