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

Function getIconColor

src/components/IconButton/utils.ts:80–128  ·  view source on GitHub ↗
({
  theme,
  isMode,
  disabled,
  selected,
  customIconColor,
}: BaseProps & { customIconColor?: string })

Source from the content-addressed store, hash-verified

78};
79
80const getIconColor = ({
81 theme,
82 isMode,
83 disabled,
84 selected,
85 customIconColor,
86}: BaseProps & { customIconColor?: string }) => {
87 if (theme.isV3) {
88 if (disabled) {
89 return theme.colors.onSurfaceDisabled;
90 }
91
92 if (typeof customIconColor !== 'undefined') {
93 return customIconColor;
94 }
95
96 if (isMode('contained')) {
97 if (selected) {
98 return theme.colors.onPrimary;
99 }
100 return theme.colors.primary;
101 }
102
103 if (isMode('contained-tonal')) {
104 if (selected) {
105 return theme.colors.onSecondaryContainer;
106 }
107 return theme.colors.onSurfaceVariant;
108 }
109
110 if (isMode('outlined')) {
111 if (selected) {
112 return theme.colors.inverseOnSurface;
113 }
114 return theme.colors.onSurfaceVariant;
115 }
116
117 if (selected) {
118 return theme.colors.primary;
119 }
120 return theme.colors.onSurfaceVariant;
121 }
122
123 if (typeof customIconColor !== 'undefined') {
124 return customIconColor;
125 }
126
127 return theme.colors.text;
128};
129
130const getRippleColor = ({
131 theme,

Callers 1

getIconButtonColorFunction · 0.70

Calls 1

isModeFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…