forced roundness tweak config
This commit is contained in:
parent
eca8da6593
commit
eed05f1380
|
@ -22,6 +22,11 @@ const AppearanceTab = {
|
||||||
key: mode,
|
key: mode,
|
||||||
value: mode,
|
value: mode,
|
||||||
label: this.$t(`settings.third_column_mode_${mode}`)
|
label: this.$t(`settings.third_column_mode_${mode}`)
|
||||||
|
})),
|
||||||
|
forcedRoundnessOptions: ['disabled', 'sharp', 'nonsharp', 'round'].map((mode, i) => ({
|
||||||
|
key: mode,
|
||||||
|
value: i - 1,
|
||||||
|
label: this.$t(`settings.forced_roundness_mode_${mode}`)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -128,6 +128,15 @@
|
||||||
<div class="setting-item">
|
<div class="setting-item">
|
||||||
<h2>{{ $t('settings.visual_tweaks') }}</h2>
|
<h2>{{ $t('settings.visual_tweaks') }}</h2>
|
||||||
<ul class="setting-list">
|
<ul class="setting-list">
|
||||||
|
<li>
|
||||||
|
<ChoiceSetting
|
||||||
|
id="forcedRoundness"
|
||||||
|
path="forcedRoundness"
|
||||||
|
:options="forcedRoundnessOptions"
|
||||||
|
>
|
||||||
|
{{ $t('settings.force_interface_roundness') }}
|
||||||
|
</ChoiceSetting>
|
||||||
|
</li>
|
||||||
<li v-if="instanceWallpaperUsed">
|
<li v-if="instanceWallpaperUsed">
|
||||||
<BooleanSetting path="hideInstanceWallpaper">
|
<BooleanSetting path="hideInstanceWallpaper">
|
||||||
{{ $t('settings.hide_wallpaper') }}
|
{{ $t('settings.hide_wallpaper') }}
|
||||||
|
|
|
@ -386,6 +386,12 @@
|
||||||
"navbar_size": "Top bar size",
|
"navbar_size": "Top bar size",
|
||||||
"panel_header_size": "Panel header size",
|
"panel_header_size": "Panel header size",
|
||||||
"visual_tweaks": "Minor visual tweaks",
|
"visual_tweaks": "Minor visual tweaks",
|
||||||
|
"force_interface_roundness": "Override interface roundness/sharpness",
|
||||||
|
"forced_roundness_mode_disabled": "Use theme defaults",
|
||||||
|
"forced_roundness_mode_sharp": "Force sharp edges",
|
||||||
|
"forced_roundness_mode_nonsharp": "Force not-so-sharp (1px roundness) edges",
|
||||||
|
"forced_roundness_mode_round": "Force round edges",
|
||||||
|
"scale_and_layout": "Interface scale and layout",
|
||||||
"mfa": {
|
"mfa": {
|
||||||
"otp": "OTP",
|
"otp": "OTP",
|
||||||
"setup_otp": "Setup OTP",
|
"setup_otp": "Setup OTP",
|
||||||
|
|
|
@ -119,6 +119,8 @@ export const defaultState = {
|
||||||
textSize: undefined, // instance default
|
textSize: undefined, // instance default
|
||||||
emojiSize: undefined, // instance default
|
emojiSize: undefined, // instance default
|
||||||
navbarSize: undefined, // instance default
|
navbarSize: undefined, // instance default
|
||||||
|
panelHeaderSize: undefined, // instance default
|
||||||
|
forcedRoundness: undefined, // instance default
|
||||||
navbarColumnStretch: false,
|
navbarColumnStretch: false,
|
||||||
greentext: undefined, // instance default
|
greentext: undefined, // instance default
|
||||||
useAtIcon: undefined, // instance default
|
useAtIcon: undefined, // instance default
|
||||||
|
@ -266,6 +268,7 @@ const config = {
|
||||||
case 'textSize':
|
case 'textSize':
|
||||||
case 'navbarSize':
|
case 'navbarSize':
|
||||||
case 'panelHeaderSize':
|
case 'panelHeaderSize':
|
||||||
|
case 'forcedRoundness':
|
||||||
case 'emojiSize':
|
case 'emojiSize':
|
||||||
case 'emojiReactionsScale':
|
case 'emojiReactionsScale':
|
||||||
applyConfig(state)
|
applyConfig(state)
|
||||||
|
|
|
@ -103,6 +103,7 @@ const defaultState = {
|
||||||
emojiSize: '2.2rem',
|
emojiSize: '2.2rem',
|
||||||
navbarSize: '3.5rem',
|
navbarSize: '3.5rem',
|
||||||
panelHeaderSize: '3.2rem',
|
panelHeaderSize: '3.2rem',
|
||||||
|
forcedRoundness: -1,
|
||||||
virtualScrolling: true,
|
virtualScrolling: true,
|
||||||
sensitiveByDefault: false,
|
sensitiveByDefault: false,
|
||||||
conversationDisplay: 'linear',
|
conversationDisplay: 'linear',
|
||||||
|
|
|
@ -153,22 +153,41 @@ const extractStyleConfig = ({
|
||||||
contentColumnWidth,
|
contentColumnWidth,
|
||||||
notifsColumnWidth,
|
notifsColumnWidth,
|
||||||
emojiReactionsScale,
|
emojiReactionsScale,
|
||||||
roundnessOverride,
|
|
||||||
emojiSize,
|
emojiSize,
|
||||||
navbarSize,
|
navbarSize,
|
||||||
panelHeaderSize,
|
panelHeaderSize,
|
||||||
textSize
|
textSize,
|
||||||
}) => ({
|
forcedRoundness
|
||||||
sidebarColumnWidth,
|
}) => {
|
||||||
contentColumnWidth,
|
const result = {
|
||||||
notifsColumnWidth,
|
sidebarColumnWidth,
|
||||||
emojiReactionsScale,
|
contentColumnWidth,
|
||||||
roundnessOverride,
|
notifsColumnWidth,
|
||||||
emojiSize,
|
emojiReactionsScale,
|
||||||
navbarSize,
|
emojiSize,
|
||||||
panelHeaderSize,
|
navbarSize,
|
||||||
textSize
|
panelHeaderSize,
|
||||||
})
|
textSize
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(forcedRoundness)
|
||||||
|
switch (forcedRoundness) {
|
||||||
|
case 'disable':
|
||||||
|
break
|
||||||
|
case '0':
|
||||||
|
result.forcedRoundness = '0'
|
||||||
|
break
|
||||||
|
case '1':
|
||||||
|
result.forcedRoundness = '1px'
|
||||||
|
break
|
||||||
|
case '2':
|
||||||
|
result.forcedRoundness = '0.4rem'
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
const defaultStyleConfig = extractStyleConfig(defaultState)
|
const defaultStyleConfig = extractStyleConfig(defaultState)
|
||||||
|
|
||||||
|
@ -197,6 +216,12 @@ export const applyConfig = (input) => {
|
||||||
styleSheet.toString()
|
styleSheet.toString()
|
||||||
styleSheet.insertRule(`:root { ${rules} }`, 'index-max')
|
styleSheet.insertRule(`:root { ${rules} }`, 'index-max')
|
||||||
|
|
||||||
|
if (Object.prototype.hasOwnProperty.call(config, 'forcedRoundness')) {
|
||||||
|
styleSheet.insertRule(` * {
|
||||||
|
--roundness: var(--forcedRoundness) !important;
|
||||||
|
}`, 'index-max')
|
||||||
|
}
|
||||||
|
|
||||||
body.classList.remove('hidden')
|
body.classList.remove('hidden')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue