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

Function getTextColor

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

Source from the content-addressed store, hash-verified

57};
58
59const getTextColor = ({
60 theme,
61 isOutlined,
62 disabled,
63 selectedColor,
64}: BaseProps & {
65 selectedColor?: string;
66}) => {
67 const isSelectedColor = selectedColor !== undefined;
68 if (theme.isV3) {
69 if (disabled) {
70 return theme.colors.onSurfaceDisabled;
71 }
72
73 if (isSelectedColor) {
74 return selectedColor;
75 }
76
77 if (isOutlined) {
78 return theme.colors.onSurfaceVariant;
79 }
80
81 return theme.colors.onSecondaryContainer;
82 }
83
84 if (disabled) {
85 return theme.colors.disabled;
86 }
87
88 if (isSelectedColor) {
89 return color(selectedColor).alpha(0.87).rgb().string();
90 }
91
92 return color(theme.colors.text).alpha(0.87).rgb().string();
93};
94
95const getDefaultBackgroundColor = ({
96 theme,

Callers 2

getRippleColorFunction · 0.70
getChipColorsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…