|
32 | 32 | @click="pickFile"> |
33 | 33 | {{ t('theming', 'Pick from Files') }} |
34 | 34 | </button> |
35 | | - <NcColorPicker v-model="Theming.color" @input="pickColor"> |
36 | | - <button class="background color" |
37 | | - :class="{ active: background === Theming.color}" |
38 | | - tabindex="0" |
39 | | - :data-color="Theming.color" |
40 | | - :data-color-bright="invertTextColor(Theming.color)" |
41 | | - :style="{ backgroundColor: Theming.color, color: invertTextColor(Theming.color) ? '#000000' : '#ffffff'}" |
42 | | - @click="pickColor"> |
43 | | - {{ t('theming', 'Custom color') }} |
44 | | - </button> |
45 | | - </NcColorPicker> |
46 | 35 |
|
47 | 36 | <!-- Default background --> |
48 | 37 | <button class="background default" |
|
52 | 41 | {{ t('theming', 'Default image') }} |
53 | 42 | </button> |
54 | 43 |
|
| 44 | + <!-- Custom color picker --> |
| 45 | + <NcColorPicker v-model="Theming.color" @input="debouncePickColor"> |
| 46 | + <button class="background color" |
| 47 | + :class="{ active: background === Theming.color}" |
| 48 | + tabindex="0" |
| 49 | + :data-color="Theming.color" |
| 50 | + :data-color-bright="invertTextColor(Theming.color)" |
| 51 | + :style="{ backgroundColor: Theming.color, color: invertTextColor(Theming.color) ? '#000000' : '#ffffff'}"> |
| 52 | + {{ t('theming', 'Custom color') }} |
| 53 | + </button> |
| 54 | + </NcColorPicker> |
| 55 | + |
55 | 56 | <!-- Default admin primary color --> |
56 | 57 | <button class="background color" |
57 | 58 | :class="{ active: background === Theming.defaultColor }" |
58 | 59 | tabindex="0" |
59 | 60 | :data-color="Theming.defaultColor" |
60 | 61 | :data-color-bright="invertTextColor(Theming.defaultColor)" |
61 | 62 | :style="{ color: invertTextColor(Theming.defaultColor) ? '#000000' : '#ffffff'}" |
62 | | - @click="pickColor"> |
| 63 | + @click="debouncePickColor"> |
63 | 64 | {{ t('theming', 'Plain background') }} |
64 | 65 | </button> |
65 | 66 |
|
|
77 | 78 | </template> |
78 | 79 |
|
79 | 80 | <script> |
80 | | -import axios from '@nextcloud/axios' |
81 | | -import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip' |
82 | | -import NcColorPicker from '@nextcloud/vue/dist/Components/NcColorPicker' |
83 | 81 | import { generateUrl } from '@nextcloud/router' |
84 | | -import { loadState } from '@nextcloud/initial-state' |
85 | 82 | import { getBackgroundUrl } from '../helpers/getBackgroundUrl.js' |
| 83 | +import { loadState } from '@nextcloud/initial-state' |
86 | 84 | import { prefixWithBaseUrl } from '../helpers/prefixWithBaseUrl.js' |
| 85 | +import axios from '@nextcloud/axios' |
| 86 | +import debounce from 'debounce' |
| 87 | +import NcColorPicker from '@nextcloud/vue/dist/Components/NcColorPicker' |
| 88 | +import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip' |
87 | 89 |
|
88 | 90 | const shippedBackgroundList = loadState('theming', 'shippedBackgrounds') |
89 | 91 |
|
@@ -179,6 +181,9 @@ export default { |
179 | 181 | const result = await axios.post(generateUrl('/apps/theming/background/custom'), { value: path }) |
180 | 182 | this.update(result.data) |
181 | 183 | }, |
| 184 | + debouncePickColor: debounce(function() { |
| 185 | + this.pickColor(...arguments) |
| 186 | + }, 200), |
182 | 187 | async pickColor(event) { |
183 | 188 | this.loading = 'color' |
184 | 189 | const color = event?.target?.dataset?.color || this.Theming?.color || '#0082c9' |
|
0 commit comments