({
isMode,
theme,
disabled,
customButtonColor,
}: BaseProps & {
customButtonColor?: string;
})
| 42 | }; |
| 43 | |
| 44 | const getButtonBackgroundColor = ({ |
| 45 | isMode, |
| 46 | theme, |
| 47 | disabled, |
| 48 | customButtonColor, |
| 49 | }: BaseProps & { |
| 50 | customButtonColor?: string; |
| 51 | }) => { |
| 52 | if (customButtonColor && !disabled) { |
| 53 | return customButtonColor; |
| 54 | } |
| 55 | |
| 56 | if (theme.isV3) { |
| 57 | if (disabled) { |
| 58 | if (isMode('outlined') || isMode('text')) { |
| 59 | return 'transparent'; |
| 60 | } |
| 61 | |
| 62 | return theme.colors.surfaceDisabled; |
| 63 | } |
| 64 | |
| 65 | if (isMode('elevated')) { |
| 66 | return theme.colors.elevation.level1; |
| 67 | } |
| 68 | |
| 69 | if (isMode('contained')) { |
| 70 | return theme.colors.primary; |
| 71 | } |
| 72 | |
| 73 | if (isMode('contained-tonal')) { |
| 74 | return theme.colors.secondaryContainer; |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | if (isMode('contained')) { |
| 79 | if (disabled) { |
| 80 | return color(theme.dark ? white : black) |
| 81 | .alpha(0.12) |
| 82 | .rgb() |
| 83 | .string(); |
| 84 | } |
| 85 | |
| 86 | return theme.colors.primary; |
| 87 | } |
| 88 | |
| 89 | return 'transparent'; |
| 90 | }; |
| 91 | |
| 92 | const getButtonTextColor = ({ |
| 93 | isMode, |
no test coverage detected
searching dependent graphs…