MCPcopy
hub / github.com/callstack/react-native-paper / getAppbarBackgroundColor

Function getAppbarBackgroundColor

src/components/Appbar/utils.ts:25–50  ·  view source on GitHub ↗
(
  theme: InternalTheme,
  elevation: number,
  customBackground?: ColorValue,
  elevated?: boolean
)

Source from the content-addressed store, hash-verified

23];
24
25export const getAppbarBackgroundColor = (
26 theme: InternalTheme,
27 elevation: number,
28 customBackground?: ColorValue,
29 elevated?: boolean
30) => {
31 const { isV3, dark: isDarkTheme, mode, colors } = theme;
32 const isAdaptiveMode = mode === 'adaptive';
33 if (customBackground) {
34 return customBackground;
35 }
36
37 if (!isV3) {
38 if (isDarkTheme && isAdaptiveMode) {
39 return overlay(elevation, colors?.surface);
40 }
41
42 return colors.primary;
43 }
44
45 if (elevated) {
46 return theme.colors.elevation.level2;
47 }
48
49 return colors.surface;
50};
51
52export const getAppbarColor = ({
53 color,

Callers 3

AppbarFunction · 0.90
AppbarHeaderFunction · 0.90
Appbar.test.tsxFile · 0.90

Calls 1

overlayFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…