mental@...32... wrote:
Quoting Phil Endecott <spam_from_inkscape_users@...1394...>:
Mental suggested:
This is basically what CSS classes are for; I think we do have sufficient CSS support to use them now, but not good UI for CSS yet.
So, I can set a class attribute on things using the XML editor [is there an easier way?] and I can write a CSS stylesheet in a text editor. Can you help me to associate the stylesheet with the document?
For now, you'll also need to embed the stylesheet in the document; use an svg:style element inside svg:defs, give it a type="text/css" attribute, and add a single text node inside it to hold the actual stylesheet. The XML editor includes a simple text editor for modifying text nodes.
[ You will find "unset" fills helpful here too, to allow the class properties to "take over". ]
I've had a go and it doesn't immediately work; maybe I'm missing something? (This is with the Debian package of 0.43.) Here's what I did:
I created a rectangle. I set a class="foo" attribute using the XML editor.
I created an svg:style type="text/css" as a child of svg:defs containing:
.foo { color: green; background-color: blue; }
[As an aside, I tried pressing ctrl+enter to save the content of the text node, as is necessary for attributes, but got this:
** (inkscape:10764): CRITICAL **: virtual void Inkscape::XML::SimpleNode::setAttribute(const gchar*, const gchar*, bool): assertion `name && *name' failed
I'll assume that there's no need to save the text node contents.]
I selected my rectangle and chose undefined paint for the fill and stroke.
I was hoping to see some green and blue stuff at this point, but didn't. Looking at the style attribute on the rectangle I noticed that color: was still defined, so I removed it manually. Still no luck.
I decided to save the file so that I could try and view it with another SVG viewer, or post it here, but I got an internal error.
The file was saved though, and looks sensible. rsvg-view also doesn't show the green and blue that I was asking for, but I don't know if they claim to do css at all.
I've also tried with #rect1309 as the css selector, and #RRGGBB colour values, without any luck.
So, the file is attached. Am I doing something wrong, or have I just gone beyond what Inkscape currently supports?
Cheers,
--Phil.