forked from GetStream/stream-chat-react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuseStreamChatTheme.ts
72 lines (69 loc) · 2.32 KB
/
useStreamChatTheme.ts
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
import { useEffect, useState } from 'react';
import { useColorScheme } from 'react-native';
import type { DeepPartial, Theme } from 'stream-chat-react-native';
export const useStreamChatTheme = () => {
const colorScheme = useColorScheme();
const getChatStyle = (): DeepPartial<Theme> => ({
avatar: {
image: {
height: 32,
width: 32,
},
},
colors:
colorScheme === 'dark'
? {
accent_blue: '#005FFF',
accent_green: '#20E070',
accent_red: '#FF3742',
bg_gradient_end: '#101214',
bg_gradient_start: '#070A0D',
black: '#FFFFFF',
blue_alice: '#00193D',
border: '#141924',
grey: '#7A7A7A',
grey_gainsboro: '#2D2F2F',
grey_whisper: '#1C1E22',
icon_background: '#FFFFFF',
modal_shadow: '#000000',
overlay: '#FFFFFFCC', // CC = 80% opacity
shadow_icon: '#00000080', // 80 = 50% opacity
targetedMessageBackground: '#302D22',
transparent: 'transparent',
white: '#101418',
white_smoke: '#13151B',
white_snow: '#070A0D',
}
: {
accent_blue: '#005FFF',
accent_green: '#20E070',
accent_red: '#FF3742',
bg_gradient_end: '#F7F7F7',
bg_gradient_start: '#FCFCFC',
black: '#000000',
blue_alice: '#E9F2FF',
border: '#00000014', // 14 = 8% opacity; top: x=0, y=-1; bottom: x=0, y=1
grey: '#7A7A7A',
grey_gainsboro: '#DBDBDB',
grey_whisper: '#ECEBEB',
icon_background: '#FFFFFF',
modal_shadow: '#00000099', // 99 = 60% opacity; x=0, y= 1, radius=4
overlay: '#00000099', // 99 = 60% opacity
shadow_icon: '#00000040', // 40 = 25% opacity; x=0, y=0, radius=4
targetedMessageBackground: '#FBF4DD', // dark mode = #302D22
transparent: 'transparent',
white: '#FFFFFF',
white_smoke: '#F2F2F2',
white_snow: '#FCFCFC',
},
spinner: {
height: 15,
width: 15,
},
});
const [chatStyle, setChatStyle] = useState(getChatStyle());
useEffect(() => {
setChatStyle(getChatStyle());
}, [colorScheme]);
return chatStyle;
};