forked from ElectronNET/Electron.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnativeTheme.ts
More file actions
41 lines (30 loc) · 1.4 KB
/
Copy pathnativeTheme.ts
File metadata and controls
41 lines (30 loc) · 1.4 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
import { Socket } from 'net';
import { nativeTheme } from 'electron';
let electronSocket;
export = (socket: Socket) => {
electronSocket = socket;
socket.on('nativeTheme-shouldUseDarkColors', () => {
const shouldUseDarkColors = nativeTheme.shouldUseDarkColors;
electronSocket.emit('nativeTheme-shouldUseDarkColors-completed', shouldUseDarkColors);
});
socket.on('nativeTheme-shouldUseHighContrastColors', () => {
const shouldUseHighContrastColors = nativeTheme.shouldUseHighContrastColors;
electronSocket.emit('nativeTheme-shouldUseHighContrastColors-completed', shouldUseHighContrastColors);
});
socket.on('nativeTheme-shouldUseInvertedColorScheme', () => {
const shouldUseInvertedColorScheme = nativeTheme.shouldUseInvertedColorScheme;
electronSocket.emit('nativeTheme-shouldUseInvertedColorScheme-completed', shouldUseInvertedColorScheme);
});
socket.on('nativeTheme-themeSource-get', () => {
const themeSource = nativeTheme.themeSource;
electronSocket.emit('nativeTheme-themeSource-getCompleted', themeSource);
});
socket.on('nativeTheme-themeSource', (themeSource) => {
nativeTheme.themeSource = themeSource;
});
socket.on('register-nativeTheme-updated-event', (id) => {
nativeTheme.on('updated', () => {
electronSocket.emit('nativeTheme-updated' + id);
});
});
};