| 31 | /* ----------------------------- chip helpers ----------------------------- */ |
| 32 | |
| 33 | function useChipColors() { |
| 34 | const theme = useTheme(); |
| 35 | return useMemo(() => { |
| 36 | const dark = theme.palette.mode === "dark"; |
| 37 | // light mode: darken the text so it stays legible on the pale tinted |
| 38 | // chip background (the full-saturation hue was too light to read) |
| 39 | const make = (main) => ({ |
| 40 | bg: alpha(main, dark ? 0.22 : 0.16), |
| 41 | fg: dark ? main : darken(main, 0.32), |
| 42 | }); |
| 43 | return { |
| 44 | status: { |
| 45 | Admit: make(theme.palette.admit.main), |
| 46 | Reject: make(theme.palette.reject.main), |
| 47 | Defer: make(theme.palette.defer.main), |
| 48 | Waitlist: make(theme.palette.text.secondary), |
| 49 | }, |
| 50 | semester: { |
| 51 | Fall: make(theme.palette.fall.main), |
| 52 | Spring: make(theme.palette.spring.main), |
| 53 | Summer: make(theme.palette.spring.main), |
| 54 | Winter: make(theme.palette.spring.main), |
| 55 | }, |
| 56 | link: make(theme.palette.primary.main), |
| 57 | }; |
| 58 | }, [theme]); |
| 59 | } |
| 60 | |
| 61 | function Chip({label, colors, onClick, title}) { |
| 62 | const style = {backgroundColor: colors.bg, color: colors.fg}; |