Skip to content

Commit 7e1dfa2

Browse files
author
Raúl Gómez Acuña
authored
Feat/app example (#30)
Closes #3, closes #29
1 parent 2baecd3 commit 7e1dfa2

40 files changed

Lines changed: 1786 additions & 979 deletions

.eslintrc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"extends": "callstack-io",
3+
"plugins": [
4+
"flowtype",
5+
"react",
6+
"prettier"
7+
],
8+
"env": {
9+
"jest": true
10+
},
11+
"globals": {
12+
"ReactClass": true
13+
},
14+
"parserOptions": {
15+
"sourceType": "module"
16+
},
17+
"rules": {
18+
"prettier/prettier": [
19+
"error",
20+
{
21+
"trailingComma": "all",
22+
"singleQuote": true
23+
}
24+
],
25+
"flowtype/require-parameter-type": 0
26+
}
27+
}

README.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,21 @@ type Swatch = {
6969
titleTextColor: string, // appropriate color to use for any 'title' text
7070
}
7171

72+
type DefaultSwatch = {
73+
color: string,
74+
bodyTextColor: string,
75+
titleTextColor: string,
76+
};
77+
78+
type PaletteDefaults = {
79+
[key: ColorProfile]: DefaultSwatch,
80+
};
81+
7282
PaletteInstance = {
7383
[key: ColorProfile]: ?Swatch,
7484
};
7585

76-
createMaterialPalette: (image: Image, options?: Options) => Promise<PaletteInstance>
86+
createMaterialPalette: (image: Image, options?: Options, defaults?: PaletteDefaults) => Promise<PaletteInstance>
7787
```
7888
7989
#### Examples
@@ -96,6 +106,25 @@ const palette = await createMaterialPalette(require('./assets/image.jpg'), {
96106
});
97107
```
98108
109+
##### Creating a palette from an internal image asset and custom defaults
110+
```js
111+
import { createMaterialPalette } from "react-native-material-palette";
112+
113+
const palette = await createMaterialPalette(
114+
require('./assets/image.jpg'),
115+
{
116+
type: ['lightVibrant', 'darkMuted'],
117+
},
118+
{
119+
darkMuted: {
120+
color: '#000000',
121+
bodyTextColor: '#B2B2B2',
122+
titleTextColor: '#F4F4F4',
123+
},
124+
},
125+
);
126+
```
127+
99128
## Development
100129
101130
Development instructions can be found here: [`react-native-material-palette` development](./docs/DEVELOPMENT.md).

example/android/app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ android {
130130
}
131131

132132
dependencies {
133+
compile project(':react-native-vector-icons')
133134
compile project(':react-native-material-palette')
134135
compile fileTree(dir: "libs", include: ["*.jar"])
135136
compile "com.android.support:appcompat-v7:25.0.1"
64 KB
Binary file not shown.
12.8 KB
Binary file not shown.
162 KB
Binary file not shown.
55.6 KB
Binary file not shown.
141 KB
Binary file not shown.
Binary file not shown.
125 KB
Binary file not shown.

0 commit comments

Comments
 (0)