forked from wix/react-native-ui-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththemeManager.js
More file actions
66 lines (52 loc) · 1.23 KB
/
themeManager.js
File metadata and controls
66 lines (52 loc) · 1.23 KB
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
import _ from 'lodash';
import Colors from './colors';
class ThemeManager {
theme = {
primaryColor: Colors.blue30,
CTA: {
textColor: Colors.white,
disabledColor: Colors.dark60,
backgroundColor: Colors.blue30,
},
titleColor: Colors.dark10,
subtitleColor: Colors.dark40,
dividerColor: Colors.dark70,
components: {
TouchableOpacity: {
throttleTime: 0,
throttleOptions: {leading: true, trailing: false},
},
},
};
setTheme(overrides) {
this.theme = _.merge(this.theme, overrides);
}
setComponentTheme(componentName, overrides) {
this.theme.components[componentName] = _.cloneDeep(overrides);
}
get components() {
return this.theme.components;
}
get primaryColor() {
return this.theme.primaryColor;
}
get CTATextColor() {
return this.theme.CTA.textColor;
}
get CTADisabledColor() {
return this.theme.CTA.disabledColor;
}
get CTABackgroundColor() {
return this.theme.CTA.backgroundColor;
}
get titleColor() {
return this.theme.titleColor;
}
get subtitleColor() {
return this.theme.subtitleColor;
}
get dividerColor() {
return this.theme.dividerColor;
}
}
export default new ThemeManager();