MCPcopy Index your code
hub / github.com/callstack/react-native-paper / getBackgroundColor

Function getBackgroundColor

src/components/FAB/utils.ts:167–208  ·  view source on GitHub ↗
({
  theme,
  isVariant,
  disabled,
  customBackgroundColor,
}: BaseProps & { customBackgroundColor?: ColorValue })

Source from the content-addressed store, hash-verified

165};
166
167const getBackgroundColor = ({
168 theme,
169 isVariant,
170 disabled,
171 customBackgroundColor,
172}: BaseProps & { customBackgroundColor?: ColorValue }) => {
173 if (customBackgroundColor && !disabled) {
174 return customBackgroundColor;
175 }
176
177 if (theme.isV3) {
178 if (disabled) {
179 return theme.colors.surfaceDisabled;
180 }
181
182 if (isVariant('primary')) {
183 return theme.colors.primaryContainer;
184 }
185
186 if (isVariant('secondary')) {
187 return theme.colors.secondaryContainer;
188 }
189
190 if (isVariant('tertiary')) {
191 return theme.colors.tertiaryContainer;
192 }
193
194 if (isVariant('surface')) {
195 return theme.colors.elevation.level3;
196 }
197 }
198
199 if (disabled) {
200 if (theme.dark) {
201 return color(white).alpha(0.12).rgb().string();
202 }
203 return color(black).alpha(0.12).rgb().string();
204 }
205
206 //@ts-ignore
207 return theme.colors?.accent;
208};
209
210const getForegroundColor = ({
211 theme,

Callers 1

getFABColorsFunction · 0.70

Calls 1

isVariantFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…