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