Skip to content

WIP: Port sane iemgui colors

Jonathan Wilkes requested to merge port-sane-iemgui-colors into master

This is "ported" from Vanilla, with "port" in scare quotes because it seems to be half-implemented in Vanilla with no error checking.

I added:

  • check to make sure only 3 or 6 digit hex colors are accepted. Vanilla accepts any number of hex digits after the initial "#", which leads it to accept typos and set the wrong color silently. Also, it means Vanilla's 3-digit hex colors are non-standard and/or broken
  • actually implement saving the hex symbols to the Pd file for iemguis. Vanilla doesn't do this, resulting in a mis-feature where initializing a color through the "color" message works while saving it with the patch loses data and generates a different color on next load
  • give pd_error messages on wrong color syntax/typos so the user can click the link to find the object associated with that error
  • print out the erroneous color name with the error so the user can search for where it originated
  • warn when mixing old lossy int colors with hex syntax in the color message for iemguis
  • don't force the user to remember a pd_compatibility number to get correct color message syntax for old patches. Instead, just use the old format for the lossy ints and the new format for the hex format symbols
  • print out a fun error message if the user somehow sends an empty symbol as one of the color message args

Still need:

  1. regression tests
  2. remove debugging messages
  3. probably want to send hex syntax symbols to the GUI-- currently we're still sending raw ints, but Javascript uses double precision for numbers so 32-bit ints should be fine. But this isn't necessary to merge this.
  4. Make sure to test that the old color format still works with the lossy color ints, and that the new format works going forward.
Edited by Jonathan Wilkes

Merge request reports