@rific/auto-paper 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +117 -16
- package/dist/index.d.mts +130 -27
- package/dist/index.d.ts +130 -27
- package/dist/index.js +2197 -1886
- package/dist/index.mjs +1417 -1109
- package/package.json +6 -7
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @rific/auto-paper
|
|
2
2
|
|
|
3
|
-
Adaptive theming for [`react-native-paper`](https://callstack.github.io/react-native-paper/). Give it one color and an appearance setting — it generates
|
|
3
|
+
Adaptive theming for [`react-native-paper`](https://callstack.github.io/react-native-paper/). Give it one color and an appearance setting — it generates an MD3 palette and handles light/dark/system mode automatically.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- Color harmony palette from a single seed color (primary → secondary → tertiary) — 6 harmony modes available, defaulting to `split-complementary`
|
|
8
8
|
- System/light/dark appearance with live updates via `Appearance` API
|
|
9
9
|
- Tinted surface, surfaceVariant, outline, and elevation levels derived from the seed
|
|
10
10
|
- Optional Redux slice for wiring appearance and color into your store
|
|
@@ -37,11 +37,8 @@ npm install expo-navigation-bar
|
|
|
37
37
|
import { Provider as AutoPaperProvider } from '@rific/auto-paper'
|
|
38
38
|
|
|
39
39
|
export default function App() {
|
|
40
|
-
const [appearance, setAppearance] = useState<'system' | 'light' | 'dark'>('system')
|
|
41
|
-
const [color, setColor] = useState('#6750a4')
|
|
42
|
-
|
|
43
40
|
return (
|
|
44
|
-
<AutoPaperProvider
|
|
41
|
+
<AutoPaperProvider initialValue={{ appearance: 'system', color: '#6750a4' }}>
|
|
45
42
|
{/* your app */}
|
|
46
43
|
</AutoPaperProvider>
|
|
47
44
|
)
|
|
@@ -51,11 +48,44 @@ export default function App() {
|
|
|
51
48
|
`Provider` renders `null` on the first render while the theme computes, then wraps your app in `PaperProvider` with the computed theme, a matching `StatusBar`, and a background `View`. Use `onReady` to hook into that moment — e.g. to dismiss a splash screen:
|
|
52
49
|
|
|
53
50
|
```tsx
|
|
54
|
-
<AutoPaperProvider
|
|
51
|
+
<AutoPaperProvider initialValue={{ appearance: 'system', color: '#6750a4' }} onReady={SplashScreen.hideAsync}>
|
|
55
52
|
{/* your app */}
|
|
56
53
|
</AutoPaperProvider>
|
|
57
54
|
```
|
|
58
55
|
|
|
56
|
+
Update theme settings from anywhere inside the tree using `useThemeSettings`:
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
import { useThemeSettings } from '@rific/auto-paper'
|
|
60
|
+
|
|
61
|
+
function SettingsScreen() {
|
|
62
|
+
const { settings, set } = useThemeSettings()
|
|
63
|
+
return (
|
|
64
|
+
<>
|
|
65
|
+
<Button onPress={() => set({ appearance: 'dark' })}>Dark mode</Button>
|
|
66
|
+
<Button onPress={() => set({ color: '#e91e63' })}>Change color</Button>
|
|
67
|
+
</>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Choosing a color harmony
|
|
73
|
+
|
|
74
|
+
The `harmony` prop controls how secondary and tertiary colors are derived from your seed. The default is `split-complementary`, which works well for most apps — it keeps secondary and tertiary close together in hue so they feel like a family of accents rather than three competing dominant colors.
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
<AutoPaperProvider initialValue={{ appearance: 'system', color: '#6750a4', harmony: 'split-complementary' }}>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
| Harmony | Offsets | Character |
|
|
81
|
+
|---|---|---|
|
|
82
|
+
| `split-complementary` *(default)* | 0°, +150°, +210° | Harmonious contrast — flanks the complement by ±30° |
|
|
83
|
+
| `triadic` | 0°, +120°, +240° | Equilateral — maximum variety, three equal-weight colors |
|
|
84
|
+
| `analogous` | 0°, +30°, +60° | Cohesive, natural — neighboring hues |
|
|
85
|
+
| `square` | 0°, +90°, +270° | Balanced, structured — right-angle symmetry |
|
|
86
|
+
| `complementary` | 0°, +90°, +180° | Bold — accent at 90° plus true opposite |
|
|
87
|
+
| `double-split` | 0°, +30°, +330° | Tight — flanks the primary by ±30° |
|
|
88
|
+
|
|
59
89
|
### With component defaults
|
|
60
90
|
|
|
61
91
|
Pass a `defaults` object to `Provider` to set prop defaults for any of the included wrapper components. Each component merges defaults under its own props, so per-instance props always win:
|
|
@@ -64,8 +94,7 @@ Pass a `defaults` object to `Provider` to set prop defaults for any of the inclu
|
|
|
64
94
|
import { Button, Chip, Provider as AutoPaperProvider } from '@rific/auto-paper'
|
|
65
95
|
|
|
66
96
|
<AutoPaperProvider
|
|
67
|
-
|
|
68
|
-
color={color}
|
|
97
|
+
initialValue={{ appearance: 'system', color: '#6750a4' }}
|
|
69
98
|
defaults={{
|
|
70
99
|
AppbarHeader: { elevated: true },
|
|
71
100
|
BottomNavigation: { labeled: false },
|
|
@@ -107,7 +136,7 @@ import { Provider as AutoPaperProvider } from '@rific/auto-paper'
|
|
|
107
136
|
export default function App() {
|
|
108
137
|
const { appearance, color } = useSelector((state: RootState) => state.theme)
|
|
109
138
|
return (
|
|
110
|
-
<AutoPaperProvider
|
|
139
|
+
<AutoPaperProvider initialValue={{ appearance, color }} onReady={SplashScreen.hideAsync}>
|
|
111
140
|
{/* your app */}
|
|
112
141
|
</AutoPaperProvider>
|
|
113
142
|
)
|
|
@@ -161,20 +190,45 @@ export default function App() {
|
|
|
161
190
|
|
|
162
191
|
| Prop | Type | Description |
|
|
163
192
|
|---|---|---|
|
|
164
|
-
| `
|
|
165
|
-
| `
|
|
193
|
+
| `initialValue` | `Partial<ThemeSettings>` | Initial theme settings — `appearance`, `color`, `harmony`, `blur`, `blurTint`. Defaults from `defaultThemeSettings` fill any omitted fields. |
|
|
194
|
+
| `onChange` | `(settings: ThemeSettings) => void` | Called whenever settings change via `useThemeSettings().set()` |
|
|
166
195
|
| `children` | `ReactNode` | |
|
|
167
196
|
| `defaults` | `PaperDefaults` | Prop defaults for wrapper components (see below) |
|
|
168
197
|
| `onReady` | `() => void` | Called once when the theme first resolves |
|
|
169
198
|
| `statusBarProps` | `StatusBarProps` | Spread over the auto-derived `StatusBar` defaults |
|
|
170
199
|
| `style` | `StyleProp<ViewStyle>` | Applied to the wrapper `View` |
|
|
171
200
|
|
|
172
|
-
|
|
201
|
+
`ThemeSettings` fields:
|
|
202
|
+
|
|
203
|
+
| Field | Type | Default |
|
|
204
|
+
|---|---|---|
|
|
205
|
+
| `appearance` | `'system' \| 'light' \| 'dark'` | `'system'` |
|
|
206
|
+
| `color` | `string` | `'#6750a4'` |
|
|
207
|
+
| `harmony` | `ColorHarmony` | `'split-complementary'` |
|
|
208
|
+
| `blur` | `boolean` | `true` |
|
|
209
|
+
| `blurTint` | `number` | `0.2` |
|
|
210
|
+
|
|
211
|
+
### `useThemeSettings()`
|
|
212
|
+
|
|
213
|
+
Returns `{ settings: ThemeSettings, set: (patch: Partial<ThemeSettings>) => void }`. Use this hook from any component inside `Provider` to read or update the current theme settings.
|
|
214
|
+
|
|
215
|
+
```tsx
|
|
216
|
+
import { useThemeSettings } from '@rific/auto-paper'
|
|
217
|
+
|
|
218
|
+
const { settings, set } = useThemeSettings()
|
|
219
|
+
|
|
220
|
+
set({ appearance: 'dark' })
|
|
221
|
+
set({ color: '#e91e63' })
|
|
222
|
+
set({ harmony: 'triadic' })
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### `useComputedTheme(appearance, color, harmony?)`
|
|
173
226
|
|
|
174
227
|
Returns `MD3Theme | null`. `null` on the first render while the theme computes.
|
|
175
228
|
|
|
176
229
|
```ts
|
|
177
230
|
const theme = useComputedTheme('system', '#6750a4')
|
|
231
|
+
const theme = useComputedTheme('system', '#6750a4', 'triadic')
|
|
178
232
|
```
|
|
179
233
|
|
|
180
234
|
### `Appbar`
|
|
@@ -209,6 +263,48 @@ import { BottomNavigation } from '@rific/auto-paper'
|
|
|
209
263
|
|
|
210
264
|
`BottomNavigation.Bar` and `BottomNavigation.SceneMap` are also available and both sync the navigation bar.
|
|
211
265
|
|
|
266
|
+
### `Chip`
|
|
267
|
+
|
|
268
|
+
A thin wrapper around `react-native-paper`'s `Chip` that adds a `variant` prop for applying theme-derived container colors.
|
|
269
|
+
|
|
270
|
+
```tsx
|
|
271
|
+
import { Chip } from '@rific/auto-paper'
|
|
272
|
+
|
|
273
|
+
<Chip>Default</Chip>
|
|
274
|
+
<Chip variant="primary">Primary</Chip>
|
|
275
|
+
<Chip variant="secondary">Secondary</Chip>
|
|
276
|
+
<Chip variant="tertiary">Tertiary</Chip>
|
|
277
|
+
<Chip variant="surface">Surface</Chip>
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
| Prop | Type | Description |
|
|
281
|
+
|---|---|---|
|
|
282
|
+
| `variant` | `'primary' \| 'secondary' \| 'tertiary' \| 'surface'` | Applies the matching container color as background and its `on*` counterpart as `selectedColor` |
|
|
283
|
+
| ...all `ChipProps` | | All props from `react-native-paper`'s `Chip` are supported |
|
|
284
|
+
|
|
285
|
+
`ChipProps` is exported from `@rific/auto-paper` and extends `react-native-paper`'s `ChipProps` with the `variant` field. Use `PaperChipProps` if you need the base paper type.
|
|
286
|
+
|
|
287
|
+
### `IconButton`
|
|
288
|
+
|
|
289
|
+
A thin wrapper around `react-native-paper`'s `IconButton` that adds a `variant` prop for applying theme-derived container and icon colors.
|
|
290
|
+
|
|
291
|
+
```tsx
|
|
292
|
+
import { IconButton } from '@rific/auto-paper'
|
|
293
|
+
|
|
294
|
+
<IconButton icon="pencil" />
|
|
295
|
+
<IconButton icon="pencil" variant="primary" />
|
|
296
|
+
<IconButton icon="pencil" variant="secondary" />
|
|
297
|
+
<IconButton icon="pencil" variant="tertiary" />
|
|
298
|
+
<IconButton icon="pencil" variant="surface" />
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
| Prop | Type | Description |
|
|
302
|
+
|---|---|---|
|
|
303
|
+
| `variant` | `'primary' \| 'secondary' \| 'tertiary' \| 'surface'` | Sets `containerColor` and `iconColor` from the matching theme color pair |
|
|
304
|
+
| ...all `IconButtonProps` | | All props from `react-native-paper`'s `IconButton` are supported — explicit `containerColor` or `iconColor` override the variant |
|
|
305
|
+
|
|
306
|
+
`IconButtonProps` is exported from `@rific/auto-paper` and extends `react-native-paper`'s `IconButtonProps` with the `variant` field. Use `PaperIconButtonProps` if you need the base paper type.
|
|
307
|
+
|
|
212
308
|
### `PaperDefaults` / `usePaperDefaults`
|
|
213
309
|
|
|
214
310
|
`PaperDefaults` is the type for the `defaults` prop on `Provider`:
|
|
@@ -264,9 +360,14 @@ const appearance = useSelector((state: RootState) => selectThemeAppearance(state
|
|
|
264
360
|
|
|
265
361
|
```ts
|
|
266
362
|
import { getTriadicPalette, getBlendedColor, isDarkColor, getRgb, getHex } from '@rific/auto-paper'
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
363
|
+
import type { ColorHarmony } from '@rific/auto-paper'
|
|
364
|
+
|
|
365
|
+
getTriadicPalette('#6750a4') // split-complementary (default)
|
|
366
|
+
getTriadicPalette('#6750a4', 'triadic') // → { primary, secondary, tertiary }
|
|
367
|
+
getTriadicPalette('#6750a4', 'analogous')
|
|
368
|
+
getTriadicPalette('#6750a4', 'square')
|
|
369
|
+
getTriadicPalette('#6750a4', 'complementary')
|
|
370
|
+
getTriadicPalette('#6750a4', 'double-split')
|
|
270
371
|
|
|
271
372
|
getBlendedColor('#ff0000', '#0000ff', 0.5) // → '#800080'
|
|
272
373
|
isDarkColor('#6750a4') // → true
|
package/dist/index.d.mts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import * as react_native_paper_lib_typescript_utils_forwardRef from 'react-native-paper/lib/typescript/utils/forwardRef';
|
|
2
2
|
import * as react_native from 'react-native';
|
|
3
|
-
import { TextInput as TextInput$1, StatusBarProps
|
|
3
|
+
import { StyleProp, ViewStyle, TextInput as TextInput$1, StatusBarProps } from 'react-native';
|
|
4
|
+
import * as react_native_paper from 'react-native-paper';
|
|
5
|
+
import { AppbarHeaderProps, MD3Theme, BottomNavigationRoute, BottomNavigationProps, BottomNavigation as BottomNavigation$1, ButtonProps, ChipProps as ChipProps$1, DialogProps as DialogProps$1, DialogTitleProps, DialogContentProps, DialogActionsProps, DialogScrollAreaProps, FABProps, IconButtonProps as IconButtonProps$1, MenuProps as MenuProps$1, MenuItemProps, TextInputProps } from 'react-native-paper';
|
|
6
|
+
export { AppbarHeaderProps, BottomNavigationProps, BottomNavigationRoute, ButtonProps, FABProps, ChipProps as PaperChipProps, DialogProps as PaperDialogProps, IconButtonProps as PaperIconButtonProps, MenuProps as PaperMenuProps, TextInputProps } from 'react-native-paper';
|
|
4
7
|
import * as react from 'react';
|
|
5
8
|
import react__default, { ReactNode } from 'react';
|
|
6
|
-
import
|
|
7
|
-
import { AppbarHeaderProps, BottomNavigationRoute, BottomNavigationProps, BottomNavigation as BottomNavigation$1, ButtonProps, ChipProps, FABProps, IconButtonProps, TextInputProps, MD3Theme } from 'react-native-paper';
|
|
8
|
-
export { AppbarHeaderProps, BottomNavigationProps, BottomNavigationRoute, ButtonProps, ChipProps, FABProps, IconButtonProps, TextInputProps } from 'react-native-paper';
|
|
9
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
9
|
+
import { BlurViewProps as BlurViewProps$1 } from 'expo-blur';
|
|
10
10
|
import * as _reduxjs_toolkit from '@reduxjs/toolkit';
|
|
11
11
|
import { PayloadAction } from '@reduxjs/toolkit';
|
|
12
12
|
import * as redux from 'redux';
|
|
13
13
|
|
|
14
|
-
declare function
|
|
14
|
+
declare function useBlur(override?: boolean): boolean;
|
|
15
|
+
|
|
16
|
+
declare function Header({ style, ...props }: AppbarHeaderProps): react.JSX.Element;
|
|
15
17
|
declare const Appbar: {
|
|
16
18
|
Header: typeof Header;
|
|
17
19
|
Content: {
|
|
@@ -22,9 +24,34 @@ declare const Appbar: {
|
|
|
22
24
|
BackAction: react_native_paper_lib_typescript_utils_forwardRef.ForwardRefComponent<react_native.View, react_native_paper.AppbarBackActionProps>;
|
|
23
25
|
};
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
type ColorHarmony = 'triadic' | 'split-complementary' | 'analogous' | 'square' | 'complementary' | 'double-split';
|
|
28
|
+
type TriadicPalette = {
|
|
29
|
+
primary: string;
|
|
30
|
+
secondary: string;
|
|
31
|
+
tertiary: string;
|
|
32
|
+
};
|
|
33
|
+
declare function getTriadicPalette(primaryColor: string, harmony?: ColorHarmony): TriadicPalette;
|
|
34
|
+
|
|
35
|
+
type ThemeAppearance = 'system' | 'light' | 'dark';
|
|
36
|
+
declare function useComputedTheme(appearance: ThemeAppearance, color: string, harmony?: ColorHarmony): MD3Theme | null;
|
|
37
|
+
|
|
38
|
+
type Props$2 = {
|
|
39
|
+
value: ThemeAppearance;
|
|
40
|
+
onChange: (appearance: ThemeAppearance) => void;
|
|
41
|
+
};
|
|
42
|
+
declare const AppearancePicker: ({ value, onChange }: Props$2) => react.JSX.Element;
|
|
43
|
+
|
|
44
|
+
type BlurViewProps = BlurViewProps$1 & {
|
|
45
|
+
blur?: boolean;
|
|
46
|
+
children?: ReactNode;
|
|
47
|
+
elevation?: 0 | 1 | 2 | 3 | 4 | 5;
|
|
48
|
+
style?: StyleProp<ViewStyle>;
|
|
49
|
+
};
|
|
50
|
+
declare const BlurView: ({ blur, children, elevation, style, ...props }: BlurViewProps) => react.JSX.Element;
|
|
51
|
+
|
|
52
|
+
declare function BottomNavigationComponent<Route extends BottomNavigationRoute>(props: BottomNavigationProps<Route>): react__default.JSX.Element;
|
|
26
53
|
declare namespace BottomNavigationComponent {
|
|
27
|
-
var Bar: (props: BarProps) =>
|
|
54
|
+
var Bar: (props: BarProps) => react__default.JSX.Element;
|
|
28
55
|
var SceneMap: <Route extends BottomNavigationRoute>(scenes: {
|
|
29
56
|
[key: string]: react__default.ComponentType<{
|
|
30
57
|
route: Route;
|
|
@@ -38,13 +65,58 @@ declare namespace BottomNavigationComponent {
|
|
|
38
65
|
type BarProps = react__default.ComponentProps<typeof BottomNavigation$1.Bar>;
|
|
39
66
|
declare const BottomNavigation: typeof BottomNavigationComponent;
|
|
40
67
|
|
|
41
|
-
declare function Button(props: ButtonProps):
|
|
68
|
+
declare function Button(props: ButtonProps): react.JSX.Element;
|
|
69
|
+
|
|
70
|
+
type ChipProps = ChipProps$1 & {
|
|
71
|
+
variant?: 'primary' | 'secondary' | 'tertiary' | 'surface';
|
|
72
|
+
};
|
|
73
|
+
declare function Chip({ variant, style, selectedColor, ...props }: ChipProps): react.JSX.Element;
|
|
74
|
+
|
|
75
|
+
type SeedColor = {
|
|
76
|
+
label: string;
|
|
77
|
+
value: string;
|
|
78
|
+
};
|
|
79
|
+
declare const defaultColors: SeedColor[];
|
|
80
|
+
type Props$1 = {
|
|
81
|
+
value: string;
|
|
82
|
+
onChange: (color: string) => void;
|
|
83
|
+
colors?: SeedColor[];
|
|
84
|
+
blur?: boolean;
|
|
85
|
+
};
|
|
86
|
+
declare const ColorPicker: ({ value, onChange, colors, blur: blurProp }: Props$1) => react.JSX.Element;
|
|
42
87
|
|
|
43
|
-
|
|
88
|
+
type DialogProps = DialogProps$1 & {
|
|
89
|
+
blur?: boolean;
|
|
90
|
+
};
|
|
91
|
+
declare function DialogComponent({ blur: blurProp, visible, onDismiss, children, style, ...rest }: DialogProps): react__default.JSX.Element | null;
|
|
92
|
+
declare namespace DialogComponent {
|
|
93
|
+
var Title: react__default.FC<DialogTitleProps>;
|
|
94
|
+
var Content: react__default.FC<DialogContentProps>;
|
|
95
|
+
var Actions: react__default.FC<DialogActionsProps>;
|
|
96
|
+
var ScrollArea: react__default.FC<DialogScrollAreaProps>;
|
|
97
|
+
}
|
|
98
|
+
declare const Dialog: typeof DialogComponent;
|
|
44
99
|
|
|
45
|
-
declare function FAB(props: FABProps):
|
|
100
|
+
declare function FAB(props: FABProps): react.JSX.Element;
|
|
46
101
|
|
|
47
|
-
|
|
102
|
+
type Props = {
|
|
103
|
+
value: ColorHarmony;
|
|
104
|
+
onChange: (harmony: ColorHarmony) => void;
|
|
105
|
+
blur?: boolean;
|
|
106
|
+
};
|
|
107
|
+
declare const HarmonyPicker: ({ value, onChange, blur: blurProp }: Props) => react.JSX.Element;
|
|
108
|
+
|
|
109
|
+
type IconButtonProps = IconButtonProps$1 & {
|
|
110
|
+
variant?: 'primary' | 'secondary' | 'tertiary' | 'surface';
|
|
111
|
+
};
|
|
112
|
+
declare function IconButton({ variant, iconColor, containerColor, ...props }: IconButtonProps): react.JSX.Element;
|
|
113
|
+
|
|
114
|
+
type MenuProps = MenuProps$1 & {
|
|
115
|
+
blur?: boolean;
|
|
116
|
+
};
|
|
117
|
+
declare const Menu: (({ blur: blurProp, children, ...props }: MenuProps) => react__default.JSX.Element) & {
|
|
118
|
+
Item: react__default.FC<MenuItemProps>;
|
|
119
|
+
};
|
|
48
120
|
|
|
49
121
|
declare const TextInput: react.ForwardRefExoticComponent<Omit<TextInputProps, "ref"> & react.RefAttributes<TextInput$1>>;
|
|
50
122
|
|
|
@@ -52,52 +124,90 @@ type PaperDefaults = {
|
|
|
52
124
|
AppbarHeader?: Partial<AppbarHeaderProps>;
|
|
53
125
|
BottomNavigation?: Partial<BottomNavigationProps<BottomNavigationRoute>>;
|
|
54
126
|
Button?: Partial<ButtonProps>;
|
|
55
|
-
Chip?: Partial<ChipProps>;
|
|
127
|
+
Chip?: Partial<ChipProps$1>;
|
|
56
128
|
FAB?: Partial<FABProps>;
|
|
57
|
-
IconButton?: Partial<IconButtonProps>;
|
|
129
|
+
IconButton?: Partial<IconButtonProps$1>;
|
|
58
130
|
TextInput?: Partial<TextInputProps>;
|
|
59
131
|
};
|
|
60
132
|
declare function usePaperDefaults(): PaperDefaults;
|
|
61
133
|
|
|
62
|
-
type ThemeAppearance = 'system' | 'light' | 'dark';
|
|
63
|
-
declare function useComputedTheme(appearance: ThemeAppearance, color: string): MD3Theme | null;
|
|
64
|
-
|
|
65
134
|
type ThemeState = {
|
|
66
135
|
appearance: ThemeAppearance;
|
|
136
|
+
blur: boolean;
|
|
67
137
|
color: string;
|
|
138
|
+
harmony: ColorHarmony;
|
|
68
139
|
};
|
|
69
140
|
declare function createThemeReducer(initialState?: Partial<ThemeState>): redux.Reducer<{
|
|
70
141
|
appearance: ThemeAppearance;
|
|
142
|
+
blur: boolean;
|
|
71
143
|
color: string;
|
|
144
|
+
harmony: ColorHarmony;
|
|
72
145
|
}>;
|
|
73
146
|
declare const themeActions: _reduxjs_toolkit.CaseReducerActions<{
|
|
74
147
|
initialize: (state: ThemeState, action: PayloadAction<Partial<ThemeState>>) => {
|
|
75
148
|
appearance: ThemeAppearance;
|
|
149
|
+
blur: boolean;
|
|
76
150
|
color: string;
|
|
151
|
+
harmony: ColorHarmony;
|
|
77
152
|
};
|
|
78
153
|
setAppearance: (state: ThemeState, action: PayloadAction<ThemeAppearance>) => {
|
|
79
154
|
appearance: ThemeAppearance;
|
|
155
|
+
blur: boolean;
|
|
80
156
|
color: string;
|
|
157
|
+
harmony: ColorHarmony;
|
|
158
|
+
};
|
|
159
|
+
setBlur: (state: ThemeState, action: PayloadAction<boolean>) => {
|
|
160
|
+
blur: boolean;
|
|
161
|
+
appearance: ThemeAppearance;
|
|
162
|
+
color: string;
|
|
163
|
+
harmony: ColorHarmony;
|
|
81
164
|
};
|
|
82
165
|
setColor: (state: ThemeState, action: PayloadAction<string>) => {
|
|
83
166
|
color: string;
|
|
84
167
|
appearance: ThemeAppearance;
|
|
168
|
+
blur: boolean;
|
|
169
|
+
harmony: ColorHarmony;
|
|
170
|
+
};
|
|
171
|
+
setHarmony: (state: ThemeState, action: PayloadAction<ColorHarmony>) => {
|
|
172
|
+
harmony: ColorHarmony;
|
|
173
|
+
appearance: ThemeAppearance;
|
|
174
|
+
blur: boolean;
|
|
175
|
+
color: string;
|
|
85
176
|
};
|
|
86
177
|
}, "theme">;
|
|
87
178
|
declare const themeReducer: redux.Reducer<ThemeState>;
|
|
88
179
|
declare const selectThemeAppearance: (state: ThemeState) => ThemeAppearance;
|
|
180
|
+
declare const selectThemeBlur: (state: ThemeState) => boolean;
|
|
89
181
|
declare const selectThemeColor: (state: ThemeState) => string;
|
|
182
|
+
declare const selectThemeHarmony: (state: ThemeState) => ColorHarmony;
|
|
90
183
|
|
|
91
|
-
type
|
|
184
|
+
type ThemeSettings = {
|
|
92
185
|
appearance: ThemeAppearance;
|
|
186
|
+
blur: boolean;
|
|
187
|
+
blurTint: number;
|
|
93
188
|
color: string;
|
|
189
|
+
harmony: ColorHarmony;
|
|
190
|
+
};
|
|
191
|
+
declare const defaultThemeSettings: ThemeSettings;
|
|
192
|
+
type ThemeSettingsContextType = {
|
|
193
|
+
settings: ThemeSettings;
|
|
194
|
+
set: (patch: Partial<ThemeSettings>) => void;
|
|
195
|
+
};
|
|
196
|
+
declare const ThemeSettingsContext: react.Context<ThemeSettingsContextType>;
|
|
197
|
+
|
|
198
|
+
type ProviderProps = {
|
|
199
|
+
initialValue?: Partial<ThemeSettings>;
|
|
200
|
+
onChange?: (settings: ThemeSettings) => void;
|
|
94
201
|
children: ReactNode;
|
|
95
202
|
defaults?: PaperDefaults;
|
|
203
|
+
onNavBarChange?: (color: string, dark: boolean) => void;
|
|
96
204
|
onReady?: () => void;
|
|
97
205
|
statusBarProps?: StatusBarProps;
|
|
98
206
|
style?: StyleProp<ViewStyle>;
|
|
99
207
|
};
|
|
100
|
-
declare function Provider({
|
|
208
|
+
declare function Provider({ initialValue, onChange, children, defaults, onNavBarChange, onReady, statusBarProps, style }: ProviderProps): react.JSX.Element | null;
|
|
209
|
+
|
|
210
|
+
declare const useThemeSettings: () => ThemeSettingsContextType;
|
|
101
211
|
|
|
102
212
|
declare const getBlendedColor: (foreground: string, background: string, alpha: number) => string;
|
|
103
213
|
|
|
@@ -111,13 +221,6 @@ type RGB = {
|
|
|
111
221
|
};
|
|
112
222
|
declare const getRgb: (value: string) => RGB | null;
|
|
113
223
|
|
|
114
|
-
type TriadicPalette = {
|
|
115
|
-
primary: string;
|
|
116
|
-
secondary: string;
|
|
117
|
-
tertiary: string;
|
|
118
|
-
};
|
|
119
|
-
declare function getTriadicPalette(primaryColor: string): TriadicPalette;
|
|
120
|
-
|
|
121
224
|
declare const isDarkColor: (value: string) => boolean;
|
|
122
225
|
|
|
123
|
-
export { Appbar, BottomNavigation, Button, Chip, FAB, IconButton, type PaperDefaults, Provider, type ProviderProps, type RGB, TextInput, type ThemeAppearance, type ThemeState, type TriadicPalette, createThemeReducer, getBlendedColor, getHex, getRgb, getTriadicPalette, isDarkColor, selectThemeAppearance, selectThemeColor, themeActions, themeReducer, useComputedTheme, usePaperDefaults };
|
|
226
|
+
export { Appbar, AppearancePicker, BlurView, type BlurViewProps, BottomNavigation, Button, Chip, type ChipProps, type ColorHarmony, ColorPicker, Dialog, type DialogProps, FAB, HarmonyPicker, IconButton, type IconButtonProps, Menu, type MenuProps, type PaperDefaults, Provider, type ProviderProps, type RGB, type SeedColor, TextInput, type ThemeAppearance, type ThemeSettings, ThemeSettingsContext, type ThemeSettingsContextType, type ThemeState, type TriadicPalette, createThemeReducer, defaultColors, defaultThemeSettings, getBlendedColor, getHex, getRgb, getTriadicPalette, isDarkColor, selectThemeAppearance, selectThemeBlur, selectThemeColor, selectThemeHarmony, themeActions, themeReducer, useBlur, useComputedTheme, usePaperDefaults, useThemeSettings };
|