I create gradients all the time and i'm wondering if there's a quick way to create a gradient based on the current selected object's fill color. For example: I have selected a box with a fill color of BLUE. I go to the gradient panel and see that what the gradient will be if I click on it (that is usally based on a default gradient WHITE to BLACK, or it comes from the most recent gradiented object I touched). So I click on it and the gradient is activated with the stops being not BLUE. What i want is... if i select a box with a BLUE fill and click on gradient - it will create a gradient with both stops being the same BLUE as the fill color. This would be very convenient because instead of clicking on each stop, shift-eyedropping the the blue color from a duplicated box, it would instantly start with the blue-blue gradient for me to tweak (in the case below for a button i would make the higher stop lighter and lower stop darker).
It's somewhat useful to select an object with a gradient to "copy" that gradient, select a new object, click on the gradient panel and have this new object take on that exact gradient. But most of the time i'm not copying gradients but i'm creating new ones, and it makes more sense for me to create a gradient derived from the fill color. Would this be useful to anyone else?
It would be useful.
Of course, you could always have 2 fills in the Appearance panel - a base color fill, then a gradient fill with transparency above the color fill. Then simply altering the color fill would retain the gradient. Could set this up as a Graphic style to quickly apply it.
You bet this would be useful. I often build gradients based on percentages of the same color. This is closely related to my thread about editing gradients by dragging a swatch from the color panel.
My workaround has been to have a simple 2-color default gradient, then select a filled objected and drag the color directly from the color panel to one of the gradient stops. Then drag the same color to the second stop. This works for both global and non-global colors in CS5, but only for non-global colors in CS6.
Scott xuggested graphic style but you can also set it up as a gradient swatch for both the swatch panel and for user defined gradient swatch for the swatch panel.
Which as rcraighead suggested can be used like a template but i think it would be a better feature a new function for Illustrators gradients. Definitely a missing feature.
The following action is a prototype that currently just shows how you may automatise the task.
Currently it requires a document that contains just one filled path and a gradient swatch (pure white to white) with the specific name "grad_white_white" (without quotation marks).
Of course, the action could be modified, such that it would work in any document. Now, it just points to the principle.
Note that the action has been recorded in AI CS 5. It may or it may not work in CS 6.
thesergie wrote: What i want is... if i select a box with a BLUE fill and click on gradient - it will create a gradient with both stops being the same BLUE as the fill color.
As one possible alternative, you could create a script that gathers the selected object fill color values and creates a new gradient from this color, setting both the start and end gradient stops to this gathered color information, then it would apply this newly created gradient to the selected object.
this script does just that, it creates a gradient with both stops having the same color as the selected object
var idoc = app.activeDocument; var sel = idoc.selection; var myGrad = idoc.gradients.add(); myGrad.gradientStops.color = sel.fillColor; myGrad.gradientStops.color = sel.fillColor; var fillcolor = new GradientColor; fillcolor.gradient = myGrad; sel.fillColor = fillcolor;
This is very helpful! It does exactly what I want. How can I place this script into the File > Scripts list instead of having to always click "Other Script" and open it? Also, how do I set the rotational angle to 90 degrees (because most of my gradients are top to bottom instead of side to side)?
thesergie wrote: How can I place this script into the File > Scripts list instead of having to always click "Other Script" and open it?
Something along the lines of the following depending on your version...
OS X: Applications/Adobe Illustrator CS5/Presets/en_US/Scripts
Windows: C:\Program Files\Adobe\Adobe Illustrator CS5\Presets\en_US\Scripts
thesergie wrote: Also, how do I set the rotational angle to 90 degrees (because most of my gradients are top to bottom instead of side to side)?
var idoc = app.activeDocument; var sel = idoc.selection; var myGrad = idoc.gradients.add(); myGrad.gradientStops.color = sel.fillColor; myGrad.gradientStops.color = sel.fillColor; var fillcolor = new GradientColor; fillcolor.gradient = myGrad; sel.fillColor = fillcolor; sel.rotate(90, false, false, true, false, Transformation.CENTER); // <--- For rotation
you're welcome, if you use it a lot, and I mean "a lot", consider creating an action to run the script, then you can run the action via hotkey. One minor drawback is, it will not survive a restart, you'll have to re-record it everytime you restart illustrator....but as I said, if you heavily use it, it will be worth the trouble.
thanks for adding rotation W_J_T