Skip to content

Commit b0ad7a4

Browse files
skjnldsvnextcloud-command
authored andcommitted
Force editor with dark theme
Signed-off-by: John Molakvoæ <[email protected]> Signed-off-by: nextcloud-command <[email protected]>
1 parent e4bce96 commit b0ad7a4

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

js/viewer-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/viewer-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/ImageEditor.vue

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div ref="editor" class="viewer__image-editor" />
2+
<div ref="editor" class="viewer__image-editor" v-bind="themeDataAttr" />
33
</template>
44
<script>
55
import FilerobotImageEditor from 'filerobot-image-editor'
@@ -84,12 +84,29 @@ export default {
8484
},
8585
}
8686
},
87+
8788
defaultSavedImageName() {
8889
return basename(this.src, extname(this.src))
8990
},
9091
defaultSavedImageType() {
9192
return extname(this.src).slice(1) || 'jpeg'
9293
},
94+
95+
hasHighContrastEnabled() {
96+
const themes = OCA?.Theming?.enabledThemes || []
97+
return themes.find(theme => theme.indexOf('highcontrast') !== -1)
98+
},
99+
100+
themeDataAttr() {
101+
if (this.hasHighContrastEnabled) {
102+
return {
103+
'data-theme-dark-highcontrast': true,
104+
}
105+
}
106+
return {
107+
'data-theme-dark': true,
108+
}
109+
}
93110
},
94111
95112
mounted() {

0 commit comments

Comments
 (0)