1
0
mirror of https://github.com/kognise/water.css.git synced 2025-08-14 00:54:08 +02:00

feat: show when theme is overwritten by prefers-color-scheme

This commit is contained in:
Jonas Kuske
2019-06-09 01:56:38 +02:00
parent a8c482f5d8
commit eca4067fb0
8 changed files with 41 additions and 24 deletions

View File

@@ -139,6 +139,12 @@ new w.Vue({
copyStatus: null,
},
computed: {
/** @returns {boolean} */
isOverwritten() {
const { isStandalone, theme } = this.versionOptions
if (isStandalone || !this.preferedColorScheme) return false
return theme !== this.preferedColorScheme
},
/** @returns {{ fileName: string, fileSize: string, fileSnippet: string }} */
selectedVersion() {
return {
@@ -155,6 +161,11 @@ new w.Vue({
externalElements.init(this.versionOptions, this.preferedColorScheme)
},
methods: {
getTooltipMessage(/** @type {Theme} */ theme) {
if (this.versionOptions.theme === theme && this.isOverwritten) {
return 'Your theme selection is currently overwritten by the theme setting on your device.'
} else return "Selected theme can be overwritten by theme setting on user's device."
},
copyToClipboard() {
Promise.resolve()
.then(() => w.clipboard.writeText(this.selectedVersion.fileSnippet))