Named Color Swatches

Created by: Michael Grosberg 


The purpose of this suggestion is to add functionality of named colors to Inkscape. Currently, it is not possible for a user to easily create and edit a palette for the purpose of using it in just one document. Also,while it is possible to share gradients and patterns among a number of shapes, you can't share flat colors. This is important for when you want  to create complex artwork - for example, a large number of icons or web buttons - with a few key colors, and want to be able  to change the color scheme without having to go over every shape and manually changing all the colors. In effect, this is like using CSS in HTML.

Basic named color swatches

In its most basic form, this is just a user-editable color palette with no color-sharing capabilities. 

A new Dialog for  "Named Colors" or "Named Swatches" will be added to inkscape. This dialog has a grid or list of colors. Each has an RGB (or other, when such is possible) and a name, selected by the user. These colors can be used to paint the fill or stroke of objects on the canvas by selecting a shape and clicking the color (or dragging).

The dialog allows the user, through buttons and an arrow menu,  to create new colors, delete them, load and save palettes, and acquire  colors from existing fills or strokes in the selected shapes. It also allows the user to edit the proerties of existing named colors - both name and value.

Behavior - Basic

When a named color's value  is  created from scratch a floating dialog pops up, with a field for the name and a color control for the color value. This dialog updates the value of the relevant named color once it is closed, or when the "set" button is pressed.

when a named color swatch is selected, it shows a black double-pixel border to show it is the currently active swatch.

If a shape is selected on the canvas while this is done, the color is applied to the shape's fill as an RGB value.

If a shape is selected on the canvas while this is done, and the shift key is pressed, the named color is applied to the shape's stroke as an RGB value.

After a swatch is selected, pressing the properties button opens the named swatch properties dialog, where it is possible to change its name and RGB value.

Advanced named color swatches

A more advanced dialog also allows you to update the shapes using the named colors when a swatch is changed by the user. In this case, shapes using the named color reference its name instead of an RGB value. When the user changes the swatch, shapes using it are also also changed.

advanced behavior:

When a named color's RGB value  is changed in the named swatch properties dialog, all object which use this color in the document also change their color.

When a named color's name is changed in the named swatch properties dialog, objects using this color should not visibly change, but they should be updated so they continue using this color with its new name.

When a named color is deleted, objects using this color should be converted to normal color values (like deleting the source of a linked clone).





















Other changes to UI

In order for this functionality to be added to Inkscape, there must be a way to select a shape and convert its named color back to a normal RGB value. this can be added as a menu item. 

Another problem is what to show in the stroke & fill dialog. Three options exist: one, instead of a color widget show a button to the named color properties dialog. Second, allow editing of color, but somehow notify the user that changing it will unlink the shape from the named color. Third, allow editing of color, but somehow notify the user this will change the named color and so may change other shapes in the document.

Even more advanced swatches

It would be nice to be able to also load gradients and patterns in the same dialog. 

Currently, when a complex document is being worked on, the list of gradients is very long and it is difficult to find the right one. Also, it is currently impossible to rename patters and gradients without going into the XML and then manually editing every shape using this gradient or pattern. 

Creating colors is still possible, but to create a new gradient or pattern swatch, the user must acquire it from an existing shape. The new swatch will not be shared with the source pattern/gradient. Instead, the properties window opens to allow the user to name this new gradient.

editing color swatches work as before, but when the user edits the properties of a gradient/pattern swatch's properties, only the name will be directly editable in this dialog. It will not be possible to change the value from the swatch properties dialog. In a gradient, the user will  only see an "edit" button that opens  the normal gradient editor.  For patterns,  either no editing will be possible, or there will be a button to edit the source on canvas, if/when such functionality is added to inkscape.  Gradients and patterns are  already sharable  between shapes so the functionality is the same as now,  but  the user will only see, in the dialog, those gradients and patterns they WANT to see - not every gradient that exists in the document.