Skip to content

Commit

Permalink
Fix #1543 Windows high contrast mode overrides UI colors
Browse files Browse the repository at this point in the history
Auto-select contrast theme if high contrast mode is detected
Increase scrollbar width on mobile
  • Loading branch information
JannisX11 committed Aug 27, 2022
1 parent ccae641 commit 1024a4b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
7 changes: 4 additions & 3 deletions css/setup.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@
scrollbar-width: none;
}
body.is_mobile .mobile_scrollbar {
scrollbar-width: thin;
scrollbar-width: initial;
}
body.is_mobile .mobile_scrollbar::-webkit-scrollbar {
width: 12px;
height: 12px;
width: 20px;
height: 20px;
}
/*Assistant Font*/
@font-face {
Expand Down Expand Up @@ -353,6 +353,7 @@
outline-color: var(--color-accent);
background-color: var(--color-dark);
image-rendering: pixelated;
forced-color-adjust: none;
}
div {
cursor: default;
Expand Down
4 changes: 2 additions & 2 deletions js/boot_loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ console.log('%cBlockbench ' + appVersion + (isApp
: (' Web ('+capitalizeFirstLetter(Blockbench.browser) + (Blockbench.isPWA ? ', PWA)' : ')'))),
'border: 2px solid #3e90ff; padding: 4px 8px; font-size: 1.2em;'
)
var startups = parseInt(localStorage.getItem('startups')||0);
localStorage.setItem('startups', startups+1);
Blockbench.startup_count = parseInt(localStorage.getItem('startups')||0) + 1;
localStorage.setItem('startups', Blockbench.startup_count);

document.getElementById('blackout').addEventListener('click', event => {
if (typeof open_interface.cancel == 'function') {
Expand Down
5 changes: 5 additions & 0 deletions js/desktop.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ function initializeDesktopApp() {
return true;
});

if (Blockbench.startup_count <= 1 && electron.nativeTheme.inForcedColorsMode) {
let theme = CustomTheme.themes.find(t => t.id == 'contrast');
CustomTheme.loadTheme(theme);
}

function makeUtilFolder(name) {
let path = PathModule.join(app.getPath('userData'), name)
if (!fs.existsSync(path)) fs.mkdirSync(path)
Expand Down
1 change: 0 additions & 1 deletion js/interface/start_screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,6 @@ ModelLoader.loaders = {};
dataType: 'json'
});
documentReady.then(() => {
Blockbench.startup_count = parseInt(localStorage.getItem('startups')||0)

//Backup Model
if (localStorage.getItem('backup_model') && (!isApp || !currentwindow.webContents.second_instance) && localStorage.getItem('backup_model').length > 40) {
Expand Down

0 comments on commit 1024a4b

Please sign in to comment.