forked from AkkomaGang/akkoma-fe
added keep-colors option
This commit is contained in:
parent
51dccb7887
commit
c189a08dff
5 changed files with 62 additions and 52 deletions
|
@ -38,6 +38,7 @@ export default {
|
||||||
colorsInvalid: true,
|
colorsInvalid: true,
|
||||||
radiiInvalid: true,
|
radiiInvalid: true,
|
||||||
|
|
||||||
|
keepColor: false,
|
||||||
keepShadows: false,
|
keepShadows: false,
|
||||||
keepOpacity: false,
|
keepOpacity: false,
|
||||||
keepRoundness: false,
|
keepRoundness: false,
|
||||||
|
@ -296,31 +297,30 @@ export default {
|
||||||
return !this.shadowsInvalid && !this.colorsInvalid && !this.radiiInvalid
|
return !this.shadowsInvalid && !this.colorsInvalid && !this.radiiInvalid
|
||||||
},
|
},
|
||||||
exportedTheme () {
|
exportedTheme () {
|
||||||
const saveEverything = !this.keepFonts && !this.keepShadows && !this.keepColors && !this.keepOpacity && !this.keepRoundness
|
const saveEverything = (
|
||||||
|
!this.keepFonts &&
|
||||||
|
!this.keepShadows &&
|
||||||
|
!this.keepOpacity &&
|
||||||
|
!this.keepRoundness &&
|
||||||
|
!this.keepColor
|
||||||
|
)
|
||||||
|
|
||||||
// TODO change into delete-less version.
|
const theme = {}
|
||||||
const theme = {
|
|
||||||
shadows: this.shadowsLocal,
|
|
||||||
fonts: this.fontsLocal,
|
|
||||||
opacity: this.currentOpacity,
|
|
||||||
colors: this.currentColors,
|
|
||||||
radii: this.currentRadii
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.keepFonts && !saveEverything) {
|
if (this.keepFonts || saveEverything) {
|
||||||
delete theme.fonts
|
theme.fonts = this.fontsLocal
|
||||||
}
|
}
|
||||||
if (!this.keepShadows && !saveEverything) {
|
if (this.keepShadows || saveEverything) {
|
||||||
delete theme.shadows
|
theme.shadows = this.shadowsLocal
|
||||||
}
|
}
|
||||||
if (!this.keepOpacity && !saveEverything) {
|
if (this.keepOpacity || saveEverything) {
|
||||||
delete theme.opacity
|
theme.opacity = this.currentOpacity
|
||||||
}
|
}
|
||||||
if (!this.keepColors && !saveEverything) {
|
if (this.keepColor || saveEverything) {
|
||||||
delete theme.colors
|
theme.colors = this.currentColors
|
||||||
}
|
}
|
||||||
if (!this.keepRoundness && !saveEverything) {
|
if (this.keepRoundness || saveEverything) {
|
||||||
delete theme.radii
|
theme.radii = this.currentRadii
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -438,6 +438,7 @@ export default {
|
||||||
this.textColorLocal = rgb2hex(colors.fg)
|
this.textColorLocal = rgb2hex(colors.fg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.keepColor) {
|
||||||
this.clearV1()
|
this.clearV1()
|
||||||
const keys = new Set(version !== 1 ? Object.keys(colors) : [])
|
const keys = new Set(version !== 1 ? Object.keys(colors) : [])
|
||||||
if (version === 1 || version === 'l1') {
|
if (version === 1 || version === 'l1') {
|
||||||
|
@ -453,6 +454,7 @@ export default {
|
||||||
keys.forEach(key => {
|
keys.forEach(key => {
|
||||||
this[key + 'ColorLocal'] = rgb2hex(colors[key])
|
this[key + 'ColorLocal'] = rgb2hex(colors[key])
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.keepRoundness) {
|
if (!this.keepRoundness) {
|
||||||
this.clearRoundness()
|
this.clearRoundness()
|
||||||
|
@ -553,6 +555,7 @@ export default {
|
||||||
this.clearOpacity()
|
this.clearOpacity()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.keepColor) {
|
||||||
this.clearV1()
|
this.clearV1()
|
||||||
|
|
||||||
this.bgColorLocal = this.selected[1]
|
this.bgColorLocal = this.selected[1]
|
||||||
|
@ -563,6 +566,7 @@ export default {
|
||||||
this.cGreenColorLocal = this.selected[6]
|
this.cGreenColorLocal = this.selected[6]
|
||||||
this.cBlueColorLocal = this.selected[7]
|
this.cBlueColorLocal = this.selected[7]
|
||||||
this.cOrangeColorLocal = this.selected[8]
|
this.cOrangeColorLocal = this.selected[8]
|
||||||
|
}
|
||||||
} else if (this.selectedVersion >= 2) {
|
} else if (this.selectedVersion >= 2) {
|
||||||
this.normalizeLocalState(this.selected.theme, 2)
|
this.normalizeLocalState(this.selected.theme, 2)
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,11 +54,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.import-warning {
|
|
||||||
color: $fallback--cRed;
|
|
||||||
color: var(--cRed, $fallback--cRed);
|
|
||||||
}
|
|
||||||
|
|
||||||
.tab-switcher {
|
.tab-switcher {
|
||||||
margin: 0 -1em;
|
margin: 0 -1em;
|
||||||
}
|
}
|
||||||
|
@ -154,8 +149,10 @@
|
||||||
.save-load-options {
|
.save-load-options {
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
margin-top: .5em;
|
margin-top: .5em;
|
||||||
span {
|
justify-content: center;
|
||||||
|
.keep-option {
|
||||||
margin: 0 .5em .5em;
|
margin: 0 .5em .5em;
|
||||||
|
min-width: 25%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,28 +28,35 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="save-load-options">
|
<div class="save-load-options">
|
||||||
<span>
|
<span class="keep-option">
|
||||||
|
<input
|
||||||
|
id="keep-color"
|
||||||
|
type="checkbox"
|
||||||
|
v-model="keepColor">
|
||||||
|
<label for="keep-color">{{$t('settings.style.switcher.keep_color')}}</label>
|
||||||
|
</span>
|
||||||
|
<span class="keep-option">
|
||||||
<input
|
<input
|
||||||
id="keep-shadows"
|
id="keep-shadows"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
v-model="keepShadows">
|
v-model="keepShadows">
|
||||||
<label for="keep-shadows">{{$t('settings.style.switcher.keep_shadows')}}</label>
|
<label for="keep-shadows">{{$t('settings.style.switcher.keep_shadows')}}</label>
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span class="keep-option">
|
||||||
<input
|
<input
|
||||||
id="keep-opacity"
|
id="keep-opacity"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
v-model="keepOpacity">
|
v-model="keepOpacity">
|
||||||
<label for="keep-opacity">{{$t('settings.style.switcher.keep_opacity')}}</label>
|
<label for="keep-opacity">{{$t('settings.style.switcher.keep_opacity')}}</label>
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span class="keep-option">
|
||||||
<input
|
<input
|
||||||
id="keep-roundness"
|
id="keep-roundness"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
v-model="keepRoundness">
|
v-model="keepRoundness">
|
||||||
<label for="keep-roundness">{{$t('settings.style.switcher.keep_roundness')}}</label>
|
<label for="keep-roundness">{{$t('settings.style.switcher.keep_roundness')}}</label>
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span class="keep-option">
|
||||||
<input
|
<input
|
||||||
id="keep-fonts"
|
id="keep-fonts"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
|
|
|
@ -191,6 +191,7 @@
|
||||||
},
|
},
|
||||||
"style": {
|
"style": {
|
||||||
"switcher": {
|
"switcher": {
|
||||||
|
"keep_color": "Keep colors",
|
||||||
"keep_shadows": "Keep shadows",
|
"keep_shadows": "Keep shadows",
|
||||||
"keep_opacity": "Keep opacity",
|
"keep_opacity": "Keep opacity",
|
||||||
"keep_roundness": "Keep roundness",
|
"keep_roundness": "Keep roundness",
|
||||||
|
|
|
@ -156,6 +156,7 @@
|
||||||
"user_settings": "Настройки пользователя",
|
"user_settings": "Настройки пользователя",
|
||||||
"style": {
|
"style": {
|
||||||
"switcher": {
|
"switcher": {
|
||||||
|
"keep_color": "Оставить цвета",
|
||||||
"keep_shadows": "Оставить тени",
|
"keep_shadows": "Оставить тени",
|
||||||
"keep_opacity": "Оставить прозрачность",
|
"keep_opacity": "Оставить прозрачность",
|
||||||
"keep_roundness": "Оставить скругление",
|
"keep_roundness": "Оставить скругление",
|
||||||
|
|
Loading…
Reference in a new issue