Basic no-wallpaper support

This commit is contained in:
Henry Jameson 2020-12-16 18:25:07 +02:00
parent 674c302350
commit c197756767
13 changed files with 38 additions and 11 deletions

View File

@ -54,13 +54,16 @@ export default {
return this.currentUser.background_image || this.$store.state.instance.background return this.currentUser.background_image || this.$store.state.instance.background
}, },
bgStyle () { bgStyle () {
return { if (
'background-image': `url(${this.background})` this.currentUser.background_image ||
} (
}, this.$store.state.instance.background &&
bgAppStyle () { !this.$store.getters.mergedConfig.hideInstanceWallpaper
return { )
'--body-background-image': `url(${this.background})` ) {
return {
'--body-background-image': `url(${this.background})`
}
} }
}, },
chat () { return this.$store.state.chat.channel.state === 'joined' }, chat () { return this.$store.state.chat.channel.state === 'joined' },

View File

@ -14,7 +14,9 @@
right: -20px; right: -20px;
background-size: cover; background-size: cover;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: 0 50%; background-color: var(--wallpaper);
background-image: var(--body-background-image);
background-position: 50% 50px;
} }
i[class^='icon-'] { i[class^='icon-'] {

View File

@ -1,12 +1,11 @@
<template> <template>
<div <div
id="app" id="app"
:style="bgAppStyle" :style="bgStyle"
> >
<div <div
id="app_bg_wrapper" id="app_bg_wrapper"
class="app-bg-wrapper" class="app-bg-wrapper"
:style="bgStyle"
/> />
<MobileNav v-if="isMobileLayout" /> <MobileNav v-if="isMobileLayout" />
<DesktopNav v-else /> <DesktopNav v-else />

View File

@ -5,6 +5,10 @@
width: 100%; width: 100%;
position: fixed; position: fixed;
a {
color: var(--topBarLink, $fallback--link);
}
.inner-nav { .inner-nav {
display: grid; display: grid;
grid-template-rows: 50px; grid-template-rows: 50px;

View File

@ -34,6 +34,10 @@ const GeneralTab = {
return this.$store.state.instance.postFormats || [] return this.$store.state.instance.postFormats || []
}, },
instanceSpecificPanelPresent () { return this.$store.state.instance.showInstanceSpecificPanel }, instanceSpecificPanelPresent () { return this.$store.state.instance.showInstanceSpecificPanel },
instanceWallpaperUsed () {
return this.$store.state.instance.background &&
!this.$store.state.users.currentUser.background_image
},
...SharedComputedObject() ...SharedComputedObject()
} }
} }

View File

@ -11,6 +11,11 @@
{{ $t('settings.hide_isp') }} {{ $t('settings.hide_isp') }}
</Checkbox> </Checkbox>
</li> </li>
<li v-if="instanceWallpaperUsed">
<Checkbox v-model="hideInstanceWallpaper">
{{ $t('settings.hide_wallpaper') }}
</Checkbox>
</li>
</ul> </ul>
</div> </div>
<div class="setting-item"> <div class="setting-item">

View File

@ -165,7 +165,8 @@
border-color: var(--border, $fallback--border); border-color: var(--border, $fallback--border);
margin: 1em 0; margin: 1em 0;
padding: 1em; padding: 1em;
background: var(--body-background-image); background-color: var(--wallpaper);
background-image: var(--body-background-image);
background-size: cover; background-size: cover;
background-position: 50% 50%; background-position: 50% 50%;

View File

@ -328,6 +328,7 @@
"hide_muted_posts": "Hide posts of muted users", "hide_muted_posts": "Hide posts of muted users",
"max_thumbnails": "Maximum amount of thumbnails per post", "max_thumbnails": "Maximum amount of thumbnails per post",
"hide_isp": "Hide instance-specific panel", "hide_isp": "Hide instance-specific panel",
"hide_wallpaper": "Hide instance wallpaper",
"preload_images": "Preload images", "preload_images": "Preload images",
"use_one_click_nsfw": "Open NSFW attachments with just one click", "use_one_click_nsfw": "Open NSFW attachments with just one click",
"hide_post_stats": "Hide post statistics (e.g. the number of favorites)", "hide_post_stats": "Hide post statistics (e.g. the number of favorites)",

View File

@ -20,6 +20,7 @@ export const defaultState = {
customTheme: undefined, customTheme: undefined,
customThemeSource: undefined, customThemeSource: undefined,
hideISP: false, hideISP: false,
hideInstanceWallpaper: false,
// bad name: actually hides posts of muted USERS // bad name: actually hides posts of muted USERS
hideMutedPosts: undefined, // instance default hideMutedPosts: undefined, // instance default
collapseMessageWithSubject: undefined, // instance default collapseMessageWithSubject: undefined, // instance default

View File

@ -84,6 +84,10 @@ export const SLOT_INHERITANCE = {
opacity: 'bg', opacity: 'bg',
priority: 1 priority: 1
}, },
wallpaper: {
depends: ['bg'],
color: (mod, bg) => brightness(-2 * mod, bg).rgb
},
fg: { fg: {
depends: [], depends: [],
priority: 1 priority: 1

View File

@ -267,6 +267,7 @@
}, },
"colors": { "colors": {
"bg": "#c0c0c0", "bg": "#c0c0c0",
"wallpaper": "#008080",
"text": "#000000", "text": "#000000",
"link": "#0000ff", "link": "#0000ff",
"accent": "#000080", "accent": "#000080",

View File

@ -258,6 +258,7 @@
}, },
"colors": { "colors": {
"bg": "#c0c0c0", "bg": "#c0c0c0",
"wallpaper": "#008080",
"text": "#000000", "text": "#000000",
"link": "#0000ff", "link": "#0000ff",
"accent": "#000080", "accent": "#000080",

View File

@ -240,6 +240,7 @@
}, },
"colors": { "colors": {
"bg": "#d6d6ce", "bg": "#d6d6ce",
"wallpaper": "#396ba5",
"text": "#000000", "text": "#000000",
"link": "#0000ff", "link": "#0000ff",
"accent": "#0a246a", "accent": "#0a246a",