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