diff --git a/CHANGELOG.md b/CHANGELOG.md index 587a301..7150a2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ * Fixed ad fields becoming uneditable after an ad is removed * Fixed ads attempting to send after leaving a channel * Linux users now get automatic updates -* Added configuration option to opt out from Windows High Contrast setting +* Added configuration option to opt out from Windows high-contrast setting (Menu > F-Chat > Rising > Disable high-contrast mode) ## 1.16.0 * Upgraded to Electron 14.x diff --git a/chat/SettingsView.vue b/chat/SettingsView.vue index f18d34d..5a93a49 100644 --- a/chat/SettingsView.vue +++ b/chat/SettingsView.vue @@ -199,13 +199,6 @@ </label> </div> - <div class="form-group"> - <label class="control-label" for="risingDisableWindowsHighContrast"> - <input type="checkbox" id="risingDisableWindowsHighContrast" v-model="risingDisableWindowsHighContrast"/> - Disable high-contrast mode (Windows) - </label> - </div> - </div> <div v-show="selectedTab === '3'"> <template v-if="hidden.length"> @@ -275,7 +268,6 @@ risingShowUnreadOfflineCount!: boolean; risingColorblindMode!: boolean; - risingDisableWindowsHighContrast!: boolean; async load(): Promise<void> { @@ -313,7 +305,6 @@ this.risingShowUnreadOfflineCount = settings.risingShowUnreadOfflineCount; this.risingColorblindMode = settings.risingColorblindMode; - this.risingDisableWindowsHighContrast = settings.risingDisableWindowsHighContrast; } async doImport(): Promise<void> { @@ -369,7 +360,6 @@ risingShowUnreadOfflineCount: this.risingShowUnreadOfflineCount, risingColorblindMode: this.risingColorblindMode, - risingDisableWindowsHighContrast: this.risingDisableWindowsHighContrast }; if(this.notifications) await core.notifications.requestPermission(); } diff --git a/chat/common.ts b/chat/common.ts index bb1bc98..d9b5c2b 100644 --- a/chat/common.ts +++ b/chat/common.ts @@ -54,7 +54,6 @@ export class Settings implements ISettings { risingShowUnreadOfflineCount = true; risingColorblindMode = false; - risingDisableWindowsHighContrast = false; } diff --git a/chat/interfaces.ts b/chat/interfaces.ts index 3f5a151..747132b 100644 --- a/chat/interfaces.ts +++ b/chat/interfaces.ts @@ -221,7 +221,6 @@ export namespace Settings { readonly risingShowUnreadOfflineCount: boolean; readonly risingColorblindMode: boolean; - readonly risingDisableWindowsHighContrast: boolean; } } diff --git a/electron/Index.vue b/electron/Index.vue index 8c8922a..9cdeb87 100644 --- a/electron/Index.vue +++ b/electron/Index.vue @@ -490,7 +490,7 @@ return { [`theme-${this.settings.theme}`]: true, colorblindMode: core.state.settings.risingColorblindMode, - disableWindowsHighContrast: core.state.settings.risingDisableWindowsHighContrast + disableWindowsHighContrast: core.state.generalSettings.risingDisableWindowsHighContrast }; } catch(err) { return { [`theme-${this.settings.theme}`]: true }; @@ -729,4 +729,8 @@ } } } + + .disableWindowsHighContrast, .disableWindowsHighContrast * { + forced-color-adjust: none; + } </style> diff --git a/electron/Window.vue b/electron/Window.vue index 900681a..cee7106 100644 --- a/electron/Window.vue +++ b/electron/Window.vue @@ -1,5 +1,5 @@ <template> - <div style="display: flex;flex-direction:column;height:100%" :class="'platform-' + platform" @auxclick.prevent> + <div style="display: flex;flex-direction:column;height:100%" :class="getThemeClass()" @auxclick.prevent> <div v-html="styling"></div> <div style="display:flex;align-items:stretch;border-bottom-width:1px" class="border-bottom" id="window-tabs"> <h4 style="padding:2px 0">F-Chat</h4> @@ -47,7 +47,8 @@ import l from '../chat/localize'; import {GeneralSettings} from './common'; import { getSafeLanguages, updateSupportedLanguages } from './language'; - import log from 'electron-log'; // tslint:disable-line: match-default-export-name + import log from 'electron-log'; + import core from '../chat/core'; // tslint:disable-line: match-default-export-name const browserWindow = remote.getCurrentWindow(); @@ -378,6 +379,19 @@ openMenu(): void { remote.Menu.getApplicationMenu()!.popup({}); } + + getThemeClass() { + try { + return { + ['platform-' + this.platform]: true, + disableWindowsHighContrast: core.state.generalSettings.risingDisableWindowsHighContrast + }; + } catch (err) { + return { + ['platform-' + this.platform]: true + }; + } + } } </script> @@ -451,4 +465,8 @@ } } } + + .disableWindowsHighContrast, .disableWindowsHighContrast * { + forced-color-adjust: none; + } </style> diff --git a/electron/common.ts b/electron/common.ts index 336f507..22e75a2 100644 --- a/electron/common.ts +++ b/electron/common.ts @@ -28,6 +28,7 @@ export class GeneralSettings { hwAcceleration = true; risingCacheExpiryDays = 30; risingSystemLogLevel: log.LevelOption = 'info'; + risingDisableWindowsHighContrast = false; } //tslint:disable diff --git a/electron/main.ts b/electron/main.ts index a9b564a..8d203f2 100644 --- a/electron/main.ts +++ b/electron/main.ts @@ -519,6 +519,16 @@ function onReady(): void { type: <'radio'>'radio' } )) + }, + { + visible: process.platform === 'win32', + label: 'Disable Windows high-contrast mode', + type: 'checkbox', + checked: settings.risingDisableWindowsHighContrast, + click: (item: electron.MenuItem) => { + settings.risingDisableWindowsHighContrast = item.checked; + setGeneralSettings(settings); + } } ] }, diff --git a/helpers/dialog.ts b/helpers/dialog.ts index ea05c3f..b7d4c6b 100644 --- a/helpers/dialog.ts +++ b/helpers/dialog.ts @@ -4,6 +4,7 @@ export class Dialog { static confirmDialog(message: string): boolean { const result = remote.dialog.showMessageBoxSync({ message, + title: 'F-Chat Rising', type: 'question', buttons: ['Yes', 'No'], defaultId: 1, diff --git a/scss/themes/chat/dark.scss b/scss/themes/chat/dark.scss index cee27f7..1c4eeee 100644 --- a/scss/themes/chat/dark.scss +++ b/scss/themes/chat/dark.scss @@ -40,7 +40,3 @@ --#{$varName}: #{$value}; } } - -.disableWindowsHighContrast { - forced-colors-adjust: none !important; -} diff --git a/scss/themes/chat/default.scss b/scss/themes/chat/default.scss index 74f6595..0cf5681 100644 --- a/scss/themes/chat/default.scss +++ b/scss/themes/chat/default.scss @@ -41,11 +41,6 @@ } } -.disableWindowsHighContrast { - forced-colors-adjust: none !important; -} - - //@import "../../util/accecss"; // //@include accecss( diff --git a/scss/themes/chat/light.scss b/scss/themes/chat/light.scss index 2935e30..97992e0 100644 --- a/scss/themes/chat/light.scss +++ b/scss/themes/chat/light.scss @@ -41,6 +41,3 @@ } } -.disableWindowsHighContrast { - forced-colors-adjust: none !important; -}