edemaine / cocreate

Cocreate Shared Whiteboard/Drawing
MIT License
209 stars 27 forks source link

Custom Colors #56

Closed adqm closed 3 years ago

adqm commented 4 years ago

This is a hacky attempt at implementing #14. I'm not sure if it's actually what's we want, and this approach differs a little from what you described in #14. Happy to discuss the high-level approach, but I figured it would be easier to do that with a working prototype than with just an idea (I've tested on Chromium 81.0.4044.138 and Firefox 77.0.1 on GNU/Linux). High level outline is below, along with some questions and concerns.


This changeset adds two new pieces:

  1. a "custom color" square that you can use to pick a new color. when clicking on this square:

    • if the custom color square is already selected (or if no custom color has yet been chosen), then it opens a color picker.

      • if you cancel out rather than choosing a color, the original color selection is preserved (regardless of whether that was a custom color or one of the built-in ones)
    • if you previously chose a custom color but currently have something else selected, this just selects the old custom color again (if you want to choose a new color, you have to click again)

  2. an "eyedropper" tool that allows switching to other colors that exist on the whiteboard

    • when moving around, the color of the eyedropper icon changes to match the color that will be chosen if you click.

    • clicking on an element switches to the drawing tool, with that element's color, regardless of whether it was a built-in color or a custom color (in the latter case, it also updates the custom color square to match the new selection)

    • clicking in empty space switches back to the drawing tool but does not change the selected color


A couple of concerns:

adqm commented 4 years ago

Also, apologies if cleaning up my code is more work than just implementing these things yourself :slightly_smiling_face: I'm having fun, anyway...

adqm commented 4 years ago

I also implemented #50 since it was related (except that remote eyedroppers currently don't change color as they move around, which I think is OK). If you want to scrap this high-level approach to #14, I think that piece is easily separable.

edemaine commented 3 years ago

I finally got to working on this, merged it with the latest Cocreate, and changed the interface to something I'm happier with:

It's all a little weird in dark mode (color selection interface isn't inverted, but everything else is), but it's functional, and I think this is good to deploy now.