mirror of
https://github.com/JannisX11/blockbench.git
synced 2025-02-23 16:31:20 +08:00
Improve contrast background color in color palette
Improve thumbnail grid style in recent list
This commit is contained in:
parent
b8b98a22c4
commit
f69ac11a6e
@ -589,17 +589,17 @@
|
||||
}
|
||||
|
||||
#start_screen .recent_project.thumbnail {
|
||||
width: 180px;
|
||||
display: block;
|
||||
margin: 0;
|
||||
height: 130px;
|
||||
position: relative;
|
||||
float: left;
|
||||
margin: 2px;
|
||||
background-color: var(--color-back);
|
||||
cursor: pointer;
|
||||
}
|
||||
#start_screen .recent_project.thumbnail .thumbnail_image {
|
||||
width: 180px;
|
||||
height: 100px;
|
||||
margin: auto;
|
||||
background-size: 180px;
|
||||
background-repeat: no-repeat;
|
||||
cursor: pointer;
|
||||
@ -663,8 +663,11 @@
|
||||
}
|
||||
#start_screen section right > ul {
|
||||
max-height: 465px;
|
||||
overflow-y: auto;
|
||||
padding-right: 5px;
|
||||
overflow-y: auto;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(170px ,1fr));
|
||||
grid-gap: 5px;
|
||||
}
|
||||
#start_screen left {
|
||||
flex-grow: 0;
|
||||
|
@ -129,16 +129,9 @@ Interface.definePanels(() => {
|
||||
},
|
||||
isDarkColor(hex) {
|
||||
if (hex) {
|
||||
hex = hex.replace('#', '')
|
||||
let dgts = hex.substr(0, 1) + hex.substr(2, 1) + hex.substr(4, 1)
|
||||
let bg = parseInt(CustomTheme.data.colors.back.substr(1, 1), 16);
|
||||
let color_range = (bg).toString(16)
|
||||
+ (Math.isBetween(bg+2, 0, 15) ? (bg+2).toString(16) : '')
|
||||
+ (Math.isBetween(bg+1, 0, 15) ? (bg+1).toString(16) : '')
|
||||
+ (Math.isBetween(bg-1, 0, 15) ? (bg-1).toString(16) : '')
|
||||
+ (Math.isBetween(bg-2, 0, 15) ? (bg-2).toString(16) : '')
|
||||
let regex = new RegExp(`[^${color_range}]`)
|
||||
return dgts.search(regex) == -1
|
||||
let color_val = new tinycolor(hex).getBrightness();
|
||||
let bg_val = new tinycolor(CustomTheme.data.colors.back).getBrightness();
|
||||
return Math.abs(color_val - bg_val) <= 50;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user