({
theme,
isVariant,
disabled,
backgroundColor,
customColor,
}: BaseProps & { backgroundColor: string; customColor?: string })
| 208 | }; |
| 209 | |
| 210 | const getForegroundColor = ({ |
| 211 | theme, |
| 212 | isVariant, |
| 213 | disabled, |
| 214 | backgroundColor, |
| 215 | customColor, |
| 216 | }: BaseProps & { backgroundColor: string; customColor?: string }) => { |
| 217 | if (typeof customColor !== 'undefined' && !disabled) { |
| 218 | return customColor; |
| 219 | } |
| 220 | |
| 221 | if (theme.isV3) { |
| 222 | if (disabled) { |
| 223 | return theme.colors.onSurfaceDisabled; |
| 224 | } |
| 225 | |
| 226 | if (isVariant('primary')) { |
| 227 | return theme.colors.onPrimaryContainer; |
| 228 | } |
| 229 | |
| 230 | if (isVariant('secondary')) { |
| 231 | return theme.colors.onSecondaryContainer; |
| 232 | } |
| 233 | |
| 234 | if (isVariant('tertiary')) { |
| 235 | return theme.colors.onTertiaryContainer; |
| 236 | } |
| 237 | |
| 238 | if (isVariant('surface')) { |
| 239 | return theme.colors.primary; |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | if (disabled) { |
| 244 | if (theme.dark) { |
| 245 | return color(white).alpha(0.32).rgb().string(); |
| 246 | } |
| 247 | return color(black).alpha(0.32).rgb().string(); |
| 248 | } |
| 249 | |
| 250 | if (backgroundColor) { |
| 251 | return getContrastingColor( |
| 252 | backgroundColor || white, |
| 253 | white, |
| 254 | 'rgba(0, 0, 0, .54)' |
| 255 | ); |
| 256 | } |
| 257 | |
| 258 | return getContrastingColor(white, white, 'rgba(0, 0, 0, .54)'); |
| 259 | }; |
| 260 | |
| 261 | export const getFABColors = ({ |
| 262 | theme, |
no test coverage detected
searching dependent graphs…