Sg2.0
.
Recent RSS
.
From:  
Date:  4. November 2006, 22:07
.
Re: Tutorial 02 (Color)
From:  Lehni
Date:  4. November 2006, 22:57
Again, thanks a lot!
Just a little remark this time:

instead of calling activeDocument.getSelectedItems() and then checking for Paths, you could do:

activeDocument.getMatchingItems(Path, { selected: true });

As this is not really documented yet it is impossible to know abou tit. This is soon going to change...
Re: Tutorial 02 (Color)
From:  Steve Light
Date:  2. November 2007, 13:16
CS2 + Sg (ver 2.0.023)
How to get color model [Gray, CMYK, Spot] of selection?
like in "original" JS:
app.selection[0].fillColor.toString()

activeDocument.selectedItems[0].style.fill.color....?
Re: Tutorial 02 (Color)
From:  Alexei Vella
Date:  18. November 2007, 07:39
is it possible to randomize the colour of objects out of a list of pre-created colours?
something like this?

http://workshop.joshuadavis.com/001/001-hidden-canvas/
Re: Tutorial 02 (Color)
From:  Jonathan
Date:  18. November 2007, 15:56
var colors = [
		new RGBColor(0,0.5,1),
		new RGBColor(1,0,0),
		new RGBColor(0,1,0),
		new RGBColor(1,0,0),
		new RGBColor(0,0,1)
	];
var sel = activeDocument.getMatchingItems(Path, { selected: true }); 
for (var i = 0; i < sel.length; i++) {
	art = sel[i];
	var color = colors[Math.round(Math.random()*(colors.length-1))];
	if (art.style.stroke.color != null) art.style.stroke.color = color;
	if (art.style.fill.color != null) art.style.fill.color = color;
}


If you want to work with CMYK colors use: new CMYKColor(c,m,y,k) instead of new RGBColor(r,g,b)
 
Scripts
13.10.08, 01:28
03.10.08, 00:01
18.09.08, 20:43
16.09.08, 21:36
14.09.08, 18:50
Posts
03.01.09, 20:57
02.01.09, 20:40
29.12.08, 18:05
29.12.08, 10:20
27.12.08, 14:28
LKPR Announcement 20.04.08
If you use Scriptographer regularly, please consider making a donation via PayPal: $$$ €€€ £££ CHF