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

Function getButtonColors

src/components/Button/utils.tsx:188–233  ·  view source on GitHub ↗
({
  theme,
  mode,
  customButtonColor,
  customTextColor,
  disabled,
  dark,
}: {
  theme: InternalTheme;
  mode: ButtonMode;
  customButtonColor?: string;
  customTextColor?: string;
  disabled?: boolean;
  dark?: boolean;
})

Source from the content-addressed store, hash-verified

186};
187
188export const getButtonColors = ({
189 theme,
190 mode,
191 customButtonColor,
192 customTextColor,
193 disabled,
194 dark,
195}: {
196 theme: InternalTheme;
197 mode: ButtonMode;
198 customButtonColor?: string;
199 customTextColor?: string;
200 disabled?: boolean;
201 dark?: boolean;
202}) => {
203 const isMode = (modeToCompare: ButtonMode) => {
204 return mode === modeToCompare;
205 };
206
207 const backgroundColor = getButtonBackgroundColor({
208 isMode,
209 theme,
210 disabled,
211 customButtonColor,
212 });
213
214 const textColor = getButtonTextColor({
215 isMode,
216 theme,
217 disabled,
218 customTextColor,
219 backgroundColor,
220 dark,
221 });
222
223 const borderColor = getButtonBorderColor({ isMode, theme, disabled });
224
225 const borderWidth = getButtonBorderWidth({ isMode, theme });
226
227 return {
228 backgroundColor,
229 borderColor,
230 textColor,
231 borderWidth,
232 };
233};
234
235type ViewStyleBorderRadiusStyles = Partial<
236 Pick<

Callers 2

ButtonFunction · 0.90
Button.test.tsxFile · 0.90

Calls 4

getButtonBackgroundColorFunction · 0.85
getButtonTextColorFunction · 0.85
getButtonBorderColorFunction · 0.85
getButtonBorderWidthFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…