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

Function getToggleButtonColor

src/components/ToggleButton/utils.ts:6–26  ·  view source on GitHub ↗
({
  theme,
  checked,
}: {
  theme: InternalTheme;
  checked: boolean | null;
})

Source from the content-addressed store, hash-verified

4import type { InternalTheme } from '../../types';
5
6export const getToggleButtonColor = ({
7 theme,
8 checked,
9}: {
10 theme: InternalTheme;
11 checked: boolean | null;
12}) => {
13 if (checked) {
14 if (theme.isV3) {
15 return color(theme.colors.onSecondaryContainer)
16 .alpha(tokens.md.ref.opacity.level2)
17 .rgb()
18 .string();
19 }
20 if (theme.dark) {
21 return 'rgba(255, 255, 255, .12)';
22 }
23 return 'rgba(0, 0, 0, .08)';
24 }
25 return 'transparent';
26};

Callers 2

ToggleButton.tsxFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…