Skip to content

Commit af3feba

Browse files
committed
feat: improve color picker UI for better dark theme support
Replace button-based color picker with a visual color preview box. The new design shows a colored square (36x36px) with the current selected color, making it more intuitive and visually clearer in both light and dark themes. Changes: - Remove PaletteIcon button in favor of direct color preview - Add clickable semantic label for better accessibility - Style preview box with border that highlights on hover - Better contrast with var(--color-border) for theme support - Label click also opens color picker for improved UX Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 37ab243 commit af3feba

File tree

1 file changed

+34
-13
lines changed

1 file changed

+34
-13
lines changed

src/Components/Draw/Editor.vue

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,19 @@
55
<template>
66
<div class="container-draw">
77
<div class="actions">
8-
<NcColorPicker ref="colorPicker"
9-
v-model="color"
10-
:palette="customPalette"
11-
@submit="updateColor">
12-
<NcButton type="tertiary">
13-
<template #icon>
14-
<PaletteIcon :size="20" :fill-color="color" />
15-
</template>
16-
{{ t('libresign', 'Change color') }}
17-
</NcButton>
18-
</NcColorPicker>
8+
<div class="color-selector">
9+
<label class="color-label" @click="$refs.colorPicker.$el.querySelector('button').click()">
10+
{{ t('libresign', 'Color') }}
11+
</label>
12+
<NcColorPicker ref="colorPicker"
13+
v-model="color"
14+
:palette="customPalette"
15+
@submit="updateColor">
16+
<button class="color-preview"
17+
:style="{ backgroundColor: color }"
18+
:aria-label="t('libresign', 'Choose color')" />
19+
</NcColorPicker>
20+
</div>
1921
<NcButton :aria-label="t('libresign', 'Delete')"
2022
@click="clear">
2123
<template #icon>
@@ -60,7 +62,6 @@ import debounce from 'debounce'
6062
import SignaturePad from 'signature_pad'
6163
6264
import DeleteIcon from 'vue-material-design-icons/Delete.vue'
63-
import PaletteIcon from 'vue-material-design-icons/Palette.vue'
6465
6566
import { getCapabilities } from '@nextcloud/capabilities'
6667
@@ -76,7 +77,6 @@ export default {
7677
components: {
7778
NcDialog,
7879
NcColorPicker,
79-
PaletteIcon,
8080
DeleteIcon,
8181
NcButton,
8282
PreviewSignature,
@@ -181,6 +181,27 @@ export default {
181181
flex-direction: row;
182182
justify-content: space-between;
183183
width: 100%;
184+
.color-selector {
185+
display: flex;
186+
align-items: center;
187+
gap: 8px;
188+
.color-label {
189+
font-weight: 500;
190+
cursor: pointer;
191+
user-select: none;
192+
}
193+
.color-preview {
194+
width: 36px;
195+
height: 36px;
196+
border-radius: var(--border-radius-large);
197+
border: 2px solid var(--color-border);
198+
cursor: pointer;
199+
transition: border-color 0.2s;
200+
&:hover {
201+
border-color: var(--color-primary-element);
202+
}
203+
}
204+
}
184205
.action-delete{
185206
cursor: pointer;
186207
margin-right: 20px;

0 commit comments

Comments
 (0)