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

Function getRippleColor

src/components/Chip/helpers.tsx:236–273  ·  view source on GitHub ↗
({
  theme,
  isOutlined,
  disabled,
  selectedColor,
  selectedBackgroundColor,
  customRippleColor,
}: BaseProps & {
  selectedBackgroundColor: string;
  selectedColor?: string;
  customRippleColor?: ColorValue;
})

Source from the content-addressed store, hash-verified

234};
235
236const getRippleColor = ({
237 theme,
238 isOutlined,
239 disabled,
240 selectedColor,
241 selectedBackgroundColor,
242 customRippleColor,
243}: BaseProps & {
244 selectedBackgroundColor: string;
245 selectedColor?: string;
246 customRippleColor?: ColorValue;
247}) => {
248 if (customRippleColor) {
249 return customRippleColor;
250 }
251
252 const isSelectedColor = selectedColor !== undefined;
253 const textColor = getTextColor({
254 theme,
255 disabled,
256 selectedColor,
257 isOutlined,
258 });
259
260 if (theme.isV3) {
261 if (isSelectedColor) {
262 return color(selectedColor).alpha(0.12).rgb().string();
263 }
264
265 return color(textColor).alpha(0.12).rgb().string();
266 }
267
268 if (isSelectedColor) {
269 return color(selectedColor).fade(0.5).rgb().string();
270 }
271
272 return selectedBackgroundColor;
273};
274
275export const getChipColors = ({
276 isOutlined,

Callers 1

getChipColorsFunction · 0.70

Calls 1

getTextColorFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…