nextcloud-vue icon indicating copy to clipboard operation
nextcloud-vue copied to clipboard

Add a 'clear' option to `NcColorPicker`

Open Antreesy opened this issue 2 years ago • 3 comments

Would be nice to have a 'Clear' button inside of NcPopover to be able to reset color, which has been set up before. Same could be applied for the second click on picked color (unselect)

Source code: https://github.com/nextcloud/nextcloud-vue/blob/master/src/components/NcColorPicker/NcColorPicker.vue

Important:

Current upstream library (Chrome component) does not support undefined as a color value.

[Vue warn]: Error in render: "TypeError: this.colors is undefined"

found in

---> <Chrome> at src/components/Chrome.vue

Something neutral should be passed:

  • empty string
  • fallback color
  • neutral color (black, white)
  • default color (Nc blue or defaultPallete[0]

Antreesy avatar May 04 '23 14:05 Antreesy

@Antreesy @susnux if there is currently no color selected, the advanced fields won't work. So the 'clear' button is only a good idea after the bug is fixed.

[Vue warn]: Error in render: "TypeError: this.colors is undefined"

and

[Vue warn]: Error in data(): "TypeError: e3 is undefined"

found in

---> <Chrome> at src/components/Chrome.vue
       <VPopperContent>
         <VPopper>
           <VDropdown>
             <NcPopover>
               <NcColorPicker>

Chartman123 avatar May 18 '25 19:05 Chartman123

[Vue warn]: Error in render: "TypeError: this.colors is undefined"

modelValue | A HEX color that represents the initial value of the picker | string - required

undefined is atm not supported by a component. Would setting an empty string work for you, @Chartman123 ?

Antreesy avatar May 19 '25 10:05 Antreesy

@Antreesy yes, empty string works for me :) I can handle the 'null' for/from the backend in the code 👍🏻

Chartman123 avatar May 19 '25 11:05 Chartman123