simplify iconsetAuto
This commit is contained in:
parent
77672c109e
commit
bf90da9e29
|
@ -45,7 +45,7 @@ const iconMan = (() => {
|
||||||
});
|
});
|
||||||
colorScheme.onChange(val => {
|
colorScheme.onChange(val => {
|
||||||
isDark = val;
|
isDark = val;
|
||||||
if (prefs.get('iconsetAuto')) {
|
if (prefs.get('iconset') === -1) {
|
||||||
debounce(refreshAllIcons);
|
debounce(refreshAllIcons);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -60,7 +60,6 @@ const iconMan = (() => {
|
||||||
], () => debounce(refreshAllIconsBadgeText), {runNow: true});
|
], () => debounce(refreshAllIconsBadgeText), {runNow: true});
|
||||||
prefs.subscribe([
|
prefs.subscribe([
|
||||||
'disableAll',
|
'disableAll',
|
||||||
'iconsetAuto',
|
|
||||||
'iconset',
|
'iconset',
|
||||||
], () => debounce(refreshAllIcons), {runNow: true});
|
], () => debounce(refreshAllIcons), {runNow: true});
|
||||||
});
|
});
|
||||||
|
@ -101,14 +100,10 @@ const iconMan = (() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getIconName(hasStyles = false) {
|
function getIconName(hasStyles = false) {
|
||||||
const iconset = (
|
const i = prefs.get('iconset');
|
||||||
prefs.get('iconsetAuto') && isDark != null
|
const prefix = i === 0 || i === -1 && isDark ? '' : 'light/';
|
||||||
? !isDark
|
|
||||||
: prefs.get('iconset')
|
|
||||||
) ? 'light/'
|
|
||||||
: '';
|
|
||||||
const postfix = prefs.get('disableAll') ? 'x' : !hasStyles ? 'w' : '';
|
const postfix = prefs.get('disableAll') ? 'x' : !hasStyles ? 'w' : '';
|
||||||
return `${iconset}$SIZE$${postfix}`;
|
return `${prefix}$SIZE$${postfix}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshIcon(tabId, force = false) {
|
function refreshIcon(tabId, force = false) {
|
||||||
|
|
|
@ -120,10 +120,9 @@
|
||||||
|
|
||||||
'sync.enabled': 'none',
|
'sync.enabled': 'none',
|
||||||
|
|
||||||
'iconsetAuto': true,
|
|
||||||
'iconset': 0, // 0 = dark-themed icon
|
'iconset': 0, // 0 = dark-themed icon
|
||||||
// 1 = light-themed icon
|
// 1 = light-themed icon
|
||||||
|
// -1 = match dark/light mode
|
||||||
'badgeDisabled': '#8B0000', // badge background color when disabled
|
'badgeDisabled': '#8B0000', // badge background color when disabled
|
||||||
'badgeNormal': '#006666', // badge background color
|
'badgeNormal': '#006666', // badge background color
|
||||||
|
|
||||||
|
|
|
@ -98,10 +98,10 @@
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<span i18n-text="optionsIconAuto"></span>
|
<span i18n-text="optionsIconAuto"></span>
|
||||||
<span class="onoffswitch">
|
<div class="iconset">
|
||||||
<input type="checkbox" id="iconsetAuto" class="slider">
|
<input type="radio" name="iconset" value="-1" data-value-type="number">
|
||||||
<span></span>
|
<div class="iconset-auto"></div>
|
||||||
</span>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -196,15 +196,26 @@ input[type="color"] {
|
||||||
|
|
||||||
.iconset {
|
.iconset {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.iconset input {
|
.iconset input {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.iconset input[type="radio"] {
|
.iconset input[type="radio"] {
|
||||||
margin: 2px 4px 0 0;
|
margin: 2px 4px 0 0;
|
||||||
}
|
}
|
||||||
|
.iconset-auto {
|
||||||
|
width: 48px;
|
||||||
|
}
|
||||||
|
.iconset-auto::after {
|
||||||
|
content: '?';
|
||||||
|
background: var(--accent-1);
|
||||||
|
color: var(--bg);
|
||||||
|
padding: 1px 4px;
|
||||||
|
border-radius: 50%;
|
||||||
|
line-height: 1;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
#actions {
|
#actions {
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user