Monday, March 23, 2009

Swatches Moving In

It's been a while since I first started on swatches work for Inkscape. Much of the time has been taken in preparing the code internals, and some with coordinating with others on new standards and formats. I've also had other things going for bugs fixing, needing to fix icon regression, etc. However the first cut of functionality has gone in. The new menu on the popup for swatches now has add and edit if you are on the "Auto" swatch set for the current document.

One of the nice uses that works now is that if you drag a "solid color" (implemented behind the scenes as a SVG 1.1 compliant single-stop gradient) on to multiple objects you can then edit that source gradient to change all objects with that color automatically. After I fix some bugs elsewhere in the code I'll be revisiting this and extending it with linked colors to automatically keep and update tints, tones and shades. (The people who know what those things are will be quite happy, and the others will like it once they see it in action)

While I was cleaning things up, I did manage to get initial support for more than just simple color in also. So custom per-document palettes can contain both solid colors and gradients too. The previews and even the drag-n-drop color patch should show gradients nicely. Behind the scenes I've been moving functionality into some common shared classes, including drag-n-drop and exporting that will support Open SwatchBook. I'm still roughing out the format so that it will be based on using the new color format worked out in CREATE, but with more than just simple solid colors. The code could also be reused in applications like Scribus.

While I was in there, it was easy to implement another feature request to highlight selected color in the palette. For the moment I did just simple square and diamond markers to note selected fill and stroke respectively. I'm pretty sure that visually this is... sub-optimal, and will need reworking. But at least it gets the code functional and the feature usable. Suggestions on how to make it look in the long run are very welcome.

There are a few things that still need implementing, including updating the swatch down in the palette when the color/gradient is edited and also misc problems when working with multiple documents. External saving and loading of these swatch sets also needs to be put it, along with some management for updating and reloading.

I'm tossing it out for some initial feedback and requests. More work is ongoing, but I do need to get those pesky icon issues finalized and fixes put back in. Well... I probably should get some sleep... but drop notes with what to do to improve it (again, once I get some existing bugs elsewhere fixed to keep Inkscape moving to a 0.47 release).


Jarle Richard Akselsen said...

I really appreciate the great work that makes Inkscape so fantastic. This sound to me like very clever and useful ideas that will improve the work-flow in many scenarios. Thank you :-)

Unknown said...

Heyn Jon this is very cool. At least when you just had this idea of using stop color 2 years ago in Montreal, it was just the beginning and it's becoming Real. may be it will don done for this year's meeting in Montreal too :)

ishmal said...

Good idea, Jon. I hope that eventually the people who are hooked on Pantone will be able to be unshackled. If people or apps could specify a color or ink in a w3c-style format, it would lessen the grip that Pantone has on the printing world. It seems silly that something as basic as colors can be copyrighted/trademarked.

Guillem said...

Hi Jon, I'm using Inkscape 0.48. Do you have any idea where the Add option has gone? BTW when I click to Edit context menu option nothing happens. Thank you in advance. Cheers, Guillem