mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-11 13:44:38 +00:00
43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
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);
|
|
});
|
|
});
|
|
};
|