๐Ÿ“ฆ j-piasecki / expo-material-dynamic-colors

๐Ÿ“„ README.md ยท 73 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73# expo-material-dynamic-colors

A module providing access to the dynamic material 3 colors on Android.

## API

### `MATERIAL_YOU_SUPPORTED`

A `boolean` value which is `true` when the device supports dynamic material theming and `false` otherwise.

### `useMaterialPalette`

On Android returns the [dynamic color palette](https://developer.android.com/reference/android/R.color#system_accent1_0):

```ts
export interface MaterialPalette {
  systemAccent1: string[]
  systemAccent2: string[]
  systemAccent3: string[]
  systemNeutral1: string[]
  systemNeutral2: string[]
}
```

On other platforms returns `null`.

### `useMaterialTheme`

On Android returns the [color theme built upon the color palette](https://m3.material.io/styles/color/system/how-the-system-works#7e1088b5-2667-4bf1-b731-cb7eb290babe):

```ts
export interface MaterialColors {
  primary: string
  onPrimary: string
  primaryContainer: string
  onPrimaryContainer: string

  secondary: string
  onSecondary: string
  secondaryContainer: string
  onSecondaryContainer: string

  tertiary: string
  onTertiary: string
  tertiaryContainer: string
  onTertiaryContainer: string

  error: string
  onError: string
  errorContainer: string
  onErrorContainer: string

  surfaceDim: string
  surface: string
  surfaceBright: string
  surfaceContainerLowest: string
  surfaceContainerLow: string
  surfaceContainer: string
  surfaceContainerHigh: string
  surfaceContainerHighest: string

  onSurface: string
  onSurfaceVariant: string
  outline: string
  outlineVariant: string

  inverseSurface: string
  inversePrimary: string
  inverseOnSurface: string
}
```

On other platforms returns `null`.