File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,14 @@ declare const colorObject: Colors & {
118
118
purple20 : string ;
119
119
purple30 : string ;
120
120
purple40 : string ;
121
+ /**
122
+ * Add alpha to hex or rgb color
123
+ * arguments:
124
+ * p1 - hex color / R part of RGB
125
+ * p2 - opacity / G part of RGB
126
+ * p3 - B part of RGB
127
+ * p4 - opacity
128
+ */
121
129
purple50 : string ;
122
130
purple60 : string ;
123
131
purple70 : string ;
Original file line number Diff line number Diff line change
1
+ import { Appearance } from 'react-native' ;
1
2
import _ from 'lodash' ;
2
3
//@ts -ignore
3
4
import Color from 'color' ;
@@ -15,6 +16,10 @@ export class Colors {
15
16
constructor ( ) {
16
17
const colors = Object . assign ( colorsPalette , themeColors ) ;
17
18
Object . assign ( this , colors ) ;
19
+
20
+ Appearance . addChangeListener ( ( { colorScheme} : Appearance . AppearancePreferences ) => {
21
+ Object . assign ( this , this . schemes [ colorScheme ?? 'light' ] ) ;
22
+ } ) ;
18
23
}
19
24
/**
20
25
* Load custom set of colors
@@ -41,6 +46,8 @@ export class Colors {
41
46
}
42
47
43
48
this . schemes = schemes ;
49
+ const colorScheme = Appearance . getColorScheme ( ) ;
50
+ Object . assign ( this , this . schemes [ colorScheme ?? 'light' ] ) ;
44
51
}
45
52
46
53
/**
You can’t perform that action at this time.
0 commit comments