MCPcopy Create free account
hub / github.com/callstack/react-native-paper / getFABColors

Function getFABColors

src/components/FAB/utils.ts:261–299  ·  view source on GitHub ↗
({
  theme,
  variant,
  disabled,
  customColor,
  customBackgroundColor,
  customRippleColor,
}: {
  theme: InternalTheme;
  variant: string;
  disabled?: boolean;
  customColor?: string;
  customBackgroundColor?: ColorValue;
  customRippleColor?: ColorValue;
})

Source from the content-addressed store, hash-verified

259};
260
261export const getFABColors = ({
262 theme,
263 variant,
264 disabled,
265 customColor,
266 customBackgroundColor,
267 customRippleColor,
268}: {
269 theme: InternalTheme;
270 variant: string;
271 disabled?: boolean;
272 customColor?: string;
273 customBackgroundColor?: ColorValue;
274 customRippleColor?: ColorValue;
275}) => {
276 const isVariant = (variantToCompare: Variant) => {
277 return variant === variantToCompare;
278 };
279
280 const baseFABColorProps = { theme, isVariant, disabled };
281
282 const backgroundColor = getBackgroundColor({
283 ...baseFABColorProps,
284 customBackgroundColor,
285 });
286
287 const foregroundColor = getForegroundColor({
288 ...baseFABColorProps,
289 customColor,
290 backgroundColor,
291 });
292
293 return {
294 backgroundColor,
295 foregroundColor,
296 rippleColor:
297 customRippleColor || color(foregroundColor).alpha(0.12).rgb().string(),
298 };
299};
300
301const getLabelColor = ({ theme }: { theme: InternalTheme }) => {
302 if (theme.isV3) {

Callers 3

FAB.test.tsxFile · 0.90
AnimatedFABFunction · 0.90
FAB.tsxFile · 0.90

Calls 2

getForegroundColorFunction · 0.85
getBackgroundColorFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…