optimize dark mode

This commit is contained in:
MaysWind 2021-02-12 14:25:26 +08:00
parent 9b312636bc
commit 2e9f93557d
5 changed files with 31 additions and 6 deletions

View file

@ -56,7 +56,7 @@
sessionSettings: ariaNgSettingService.getAllSessionOptions(), sessionSettings: ariaNgSettingService.getAllSessionOptions(),
rpcSettings: ariaNgSettingService.getAllRpcSettings(), rpcSettings: ariaNgSettingService.getAllRpcSettings(),
isSupportBlob: ariaNgFileService.isSupportBlob(), isSupportBlob: ariaNgFileService.isSupportBlob(),
isSupportMatchMedia: ariaNgSettingService.isBrowserSupportMatchMedia(), isSupportDarkMode: ariaNgSettingService.isBrowserSupportDarkMode(),
importSettings: null, importSettings: null,
exportSettings: null, exportSettings: null,
exportSettingsCopied: false exportSettingsCopied: false

View file

@ -33,7 +33,7 @@
}; };
var setThemeBySystemSettings = function () { var setThemeBySystemSettings = function () {
if (!ariaNgSettingService.isBrowserSupportMatchMedia()) { if (!ariaNgSettingService.isBrowserSupportDarkMode()) {
setLightTheme(); setLightTheme();
return; return;
} }
@ -451,7 +451,7 @@
$document.unbind('keypress'); $document.unbind('keypress');
}); });
if (ariaNgSettingService.isBrowserSupportMatchMedia()) { if (ariaNgSettingService.isBrowserSupportDarkMode()) {
var matchPreferColorScheme = $window.matchMedia('(prefers-color-scheme: dark)'); var matchPreferColorScheme = $window.matchMedia('(prefers-color-scheme: dark)');
matchPreferColorScheme.addEventListener('change', function (e) { matchPreferColorScheme.addEventListener('change', function (e) {
ariaNgLogService.info('[root] system switches to ' + (e.matches ? 'dark' : 'light') + ' theme'); ariaNgLogService.info('[root] system switches to ' + (e.matches ? 'dark' : 'light') + ' theme');

View file

@ -14,6 +14,7 @@
var browserSupportStorage = browserFeatures.localStroage || browserFeatures.cookies; var browserSupportStorage = browserFeatures.localStroage || browserFeatures.cookies;
var browserSupportAppCache = !!$window.applicationCache; var browserSupportAppCache = !!$window.applicationCache;
var browserSupportMatchMedia = !!$window.matchMedia; var browserSupportMatchMedia = !!$window.matchMedia;
var browserSupportDarkMode = browserSupportMatchMedia && $window.matchMedia('(prefers-color-scheme: dark)') && $window.matchMedia('(prefers-color-scheme: dark)').media !== 'not all';
var onAppCacheUpdatedCallbacks = []; var onAppCacheUpdatedCallbacks = [];
var onFirstVisitCallbacks = []; var onFirstVisitCallbacks = [];
@ -236,8 +237,8 @@
isBrowserSupportApplicationCache: function () { isBrowserSupportApplicationCache: function () {
return browserSupportAppCache; return browserSupportAppCache;
}, },
isBrowserSupportMatchMedia: function () { isBrowserSupportDarkMode: function () {
return browserSupportMatchMedia; return browserSupportDarkMode;
}, },
getBrowserFeatures: function () { getBrowserFeatures: function () {
return browserFeatures; return browserFeatures;

View file

@ -58,6 +58,10 @@
border-color: #666; border-color: #666;
} }
.theme-dark.skin-aria-ng .progress {
background-color: #444;
}
.theme-dark.skin-aria-ng .nav-tabs-custom { .theme-dark.skin-aria-ng .nav-tabs-custom {
background-color: #1a1a1a; background-color: #1a1a1a;
} }
@ -316,6 +320,22 @@
background-color: #333; background-color: #333;
} }
/* cg-busy */
.theme-dark.skin-aria-ng .cg-busy-default-sign {
color: #eee;
border-color: #666;
background-color: #444;
text-shadow: 0 1px 1px #000;
}
.theme-dark.skin-aria-ng .cg-busy-default-text {
color: #eee;
}
.theme-dark.skin-aria-ng .cg-busy-default-spinner div {
background-color: #eee;
}
/* scrollbar */ /* scrollbar */
.theme-dark.skin-aria-ng ::-webkit-scrollbar-thumb { .theme-dark.skin-aria-ng ::-webkit-scrollbar-thumb {
background-color: #3c4144; background-color: #3c4144;
@ -355,6 +375,10 @@
background-color: #2a2a2a; background-color: #2a2a2a;
} }
.theme-dark.skin-aria-ng .task-table .progress span.progress-lower {
color: #eee;
}
/* settings-table */ /* settings-table */
.theme-dark.skin-aria-ng .settings-table { .theme-dark.skin-aria-ng .settings-table {
background-color: #1a1a1a; background-color: #1a1a1a;

View file

@ -47,7 +47,7 @@
ng-change="setTheme(context.settings.theme)"> ng-change="setTheme(context.settings.theme)">
<option value="light" translate>Light</option> <option value="light" translate>Light</option>
<option value="dark" translate>Dark</option> <option value="dark" translate>Dark</option>
<option ng-if="context.isSupportMatchMedia" value="system" translate>Follow system settings</option> <option ng-if="context.isSupportDarkMode" value="system" translate>Follow system settings</option>
</select> </select>
</div> </div>
</div> </div>