Enhancement: use theme-color meta tag (#8359)

This commit is contained in:
shamoon
2024-11-26 10:24:48 -08:00
committed by GitHub
parent ecb300845c
commit a186527f07
3 changed files with 51 additions and 39 deletions

View File

@@ -17,6 +17,8 @@ export enum GlobalSearchType {
TITLE_CONTENT = 'title-content',
}
export const PAPERLESS_GREEN_HEX = '#17541f'
export const SETTINGS_KEYS = {
LANGUAGE: 'language',
APP_LOGO: 'app_logo',

View File

@@ -17,7 +17,12 @@ import {
hexToHsl,
} from 'src/app/utils/color'
import { environment } from 'src/environments/environment'
import { UiSettings, SETTINGS, SETTINGS_KEYS } from '../data/ui-settings'
import {
UiSettings,
SETTINGS,
SETTINGS_KEYS,
PAPERLESS_GREEN_HEX,
} from '../data/ui-settings'
import { User } from '../data/user'
import {
PermissionAction,
@@ -420,7 +425,7 @@ export class SettingsService {
)
}
if (themeColor) {
if (themeColor?.length) {
const hsl = hexToHsl(themeColor)
const bgBrightnessEstimate = estimateBrightnessForColor(themeColor)
@@ -445,6 +450,11 @@ export class SettingsService {
document.documentElement.style.removeProperty('--pngx-primary')
document.documentElement.style.removeProperty('--pngx-primary-lightness')
}
this.meta.updateTag({
name: 'theme-color',
content: themeColor?.length ? themeColor : PAPERLESS_GREEN_HEX,
})
}
getLanguageOptions(): LanguageOption[] {