Adding a different gradient to stroke and fill of an object

Post questions on how to use or achieve an effect in Inkscape.
tobbAddol
Posts: 1
Joined: Tue Jul 09, 2019 7:16 pm

Adding a different gradient to stroke and fill of an object

Postby tobbAddol » Tue Jul 09, 2019 7:34 pm

Is there any way to do this easily? The gradient editor seems to be doing everything in its power to prevent me from getting there.

Also, is there any way to turn off the auto-clean feature for the gradients? I don't understand why I can't just create a gradient and keep it around for use later, and not have it disappear as soon as it's deselected.

Moini
Posts: 3333
Joined: Mon Oct 05, 2015 10:44 am

Re: Adding a different gradient to stroke and fill of an object

Postby Moini » Wed Jul 10, 2019 10:25 am

Yes. Open the Fill and stroke dialog and choose different gradients for the fill and the stroke. With the gradient tool, make sure to not have the gradients linked.

There is no such autoclean feature, as far as I know. You need to trigger that with File > Clean up document, and for that you can set whether to remove swatches or not. What file format are you saving to?
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

tylerdurden
Posts: 2337
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: Adding a different gradient to stroke and fill of an object

Postby tylerdurden » Wed Jul 10, 2019 11:27 pm

Looks like my version of Inkscape (0.92.2) is deleting gradients that have no users.

That leaves a couple of options:
Make a copy of the object and hide it on a layer
Save the gradients as a swatches, but ensure the cleanup button is unchecked in preferences. Otherwise, the swatches will auto-prune (before cleanup) just like the gradients do.

InkscapeForum.com_-_Post_a_reply_-_Google_Chrome_2_2019-07-10_09-20-28.jpg
InkscapeForum.com_-_Post_a_reply_-_Google_Chrome_2_2019-07-10_09-20-28.jpg (201.44 KiB) Viewed 1027 times

Notice that swatch #838 has zero users.

The attached SVG has one gradient, #884, that is not a swatch. If you delete that rectangle object, the gradient is also deleted. :-\
Attachments
grads1.svg
(5.48 KiB) Downloaded 43 times
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

Moini
Posts: 3333
Joined: Mon Oct 05, 2015 10:44 am

Re: Adding a different gradient to stroke and fill of an object

Postby Moini » Fri Jul 12, 2019 2:23 am

Okay, I checked, it's correct. However, gradients that you *name* will not be removed automatically. Give them a name in the editor, and they will stay, even when the object is removed.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

tylerdurden
Posts: 2337
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: Adding a different gradient to stroke and fill of an object

Postby tylerdurden » Fri Jul 12, 2019 3:14 am

Moini wrote:...gradients that you *name* will not be removed automatically. Give them a name in the editor, and they will stay, even when the object is removed.


I was so excited, but alas, I must be doing something wrong. Named gradients also seem to go away when I delete a single user.

2019-07-11_13-10-07.gif
2019-07-11_13-10-07.gif (248.98 KiB) Viewed 987 times


:(
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

Moini
Posts: 3333
Joined: Mon Oct 05, 2015 10:44 am

Re: Adding a different gradient to stroke and fill of an object

Postby Moini » Fri Jul 12, 2019 6:13 am

Works for me. What version?
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

Moini
Posts: 3333
Joined: Mon Oct 05, 2015 10:44 am

Re: Adding a different gradient to stroke and fill of an object

Postby Moini » Fri Jul 12, 2019 6:15 am

Oookay. Work*ed* for me. What's that?...
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

Moini
Posts: 3333
Joined: Mon Oct 05, 2015 10:44 am

Re: Adding a different gradient to stroke and fill of an object

Postby Moini » Fri Jul 12, 2019 6:17 am

It works *sometimes*...
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

Moini
Posts: 3333
Joined: Mon Oct 05, 2015 10:44 am

Re: Adding a different gradient to stroke and fill of an object

Postby Moini » Fri Jul 12, 2019 6:19 am

Okay. The difference is that if I edit the gradient with the legacy gradient editor, it will not be cleaned out.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

Moini
Posts: 3333
Joined: Mon Oct 05, 2015 10:44 am

Re: Adding a different gradient to stroke and fill of an object

Postby Moini » Fri Jul 12, 2019 6:19 am

It's not the name at all.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

Moini
Posts: 3333
Joined: Mon Oct 05, 2015 10:44 am

Re: Adding a different gradient to stroke and fill of an object

Postby Moini » Fri Jul 12, 2019 6:26 am

There's the property 'inkscape:collect' set to 'always' on gradients edited with the old gradient editor. This property is not added to gradients that are edited on canvas only.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

tylerdurden
Posts: 2337
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: Adding a different gradient to stroke and fill of an object

Postby tylerdurden » Fri Jul 12, 2019 8:25 am

I'm still running 0.92.2 on Win 8.1.

I used the legacy editor and also named the gradients, and.... it still purges the gradients from the defs when I delete the last user of a gradient.

At least the swatches are available as a fallback.
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

Moini
Posts: 3333
Joined: Mon Oct 05, 2015 10:44 am

Re: Adding a different gradient to stroke and fill of an object

Postby Moini » Fri Jul 12, 2019 8:43 am

Hm... That works for me, using 0.92.4 on Linux Mint 19 Tara. But it seems it's not intended to work - in 2013, someone removed that, so as not to clutter memory and gradient list with unused things.

Swatches would be the intended alternative, if they worked so well that one could trust them.

Problem with swatches is that:

- they fork gradients on edit (https://gitlab.com/inkscape/inbox/issues/648) (maybe that depends on the preferences setting for linking gradients)
- they don't keep radial gradients (https://gitlab.com/inkscape/inbox/issues/647)
- and probably many usability issues and other bugs ...
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

Moini
Posts: 3333
Joined: Mon Oct 05, 2015 10:44 am

Re: Adding a different gradient to stroke and fill of an object

Postby Moini » Fri Jul 12, 2019 8:43 am

Oh, I also submitted a feature request for a 'last used styles' list.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

tylerdurden
Posts: 2337
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: Adding a different gradient to stroke and fill of an object

Postby tylerdurden » Sat Jul 13, 2019 2:08 am

Here's what I see happening...

With the new gradient editor, the inkscape:collect attribute is added to any new parent gradient, and to any duplicates made from that parent. The attribute causes the gradients to purge when the last object using the gradient is deleted.

This can be overcome by deleting the attribute on the parent gradient in the defs, using the XML editor. A duplicate of the edited gradient can be spawned without the attribute, by using the plus-sign in the Fill/Stroke dialog, or by using the edited parent gradient on another object, then changing its colors to create new gradients.

Gradients without the attribute will still be removed when the document is cleaned, if no objects are using them.

Another way to remove the attribute is to use the legacy gradient editor, but the process must use the edit-gradient button in the Fill/Stroke dialog.
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

Moini
Posts: 3333
Joined: Mon Oct 05, 2015 10:44 am

Re: Adding a different gradient to stroke and fill of an object

Postby Moini » Sat Jul 13, 2019 7:47 am

So that's basically the opposite from what I saw... I'm confused, but too tired to re-check at the moment. Patrick suggested to make a bug report about this, as the inconsistent behaviour is strange, so devs could figure out what to do, and decide if they should do anything about it. Would you like to make one, tylerdurden?
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

tylerdurden
Posts: 2337
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: Adding a different gradient to stroke and fill of an object

Postby tylerdurden » Sat Jul 13, 2019 9:29 am

Moini wrote:Patrick suggested to make a bug report about this, as the inconsistent behaviour is strange, so devs could figure out what to do, and decide if they should do anything about it. Would you like to make one, tylerdurden?

Will do.
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

tylerdurden
Posts: 2337
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: Adding a different gradient to stroke and fill of an object

Postby tylerdurden » Sat Jul 13, 2019 10:41 pm

Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

Moini
Posts: 3333
Joined: Mon Oct 05, 2015 10:44 am

Re: Adding a different gradient to stroke and fill of an object

Postby Moini » Mon Jul 15, 2019 3:13 am

Thank you!
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)


Return to “Help with using Inkscape”

Who is online

Users browsing this forum: No registered users and 3 guests