Last Instinct

Tag: Kuler

Using Adobe Kuler via AS3 in Flash

by on Apr.01, 2010, under Graphics and effects

A great source for inspiration and making your own color themes is Adobe Kuler. It’s a free service and features all the common color picking techniques. They also have an API available for non-commercial use. It’s perfect for use with flash and its really simple to use thanks to the ColorMunch AS3 class by Ben Kanizay. I used it for color picking in my ChannelColorizer.

Here is a basic example for making a search for “banana”-themes from Kuler in Actionscript 3. To use it you need the ColorMunch class an your own Kuler API key. There are some more examples in the ColorMunch wiki, but you’ll find the most useful information in the documentation provided in the ColorMunch zip-package.

Example of using Adobe Kuler in Flash AS3 via the ColorMunch class:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import beekay.colormunch.*;
 
// creates a new ColorMunch instance with your Kuler API key
var colormunch:ColorMunch = new ColorMunch("INSERT_YOUR_KULER_API_KEY_HERE");
 
// At a minimum listen for the 'resultReady' event
// This will fire when the result has been recieved and processed
colormunch.addEventListener(ColorMunchEvent.RESULT_READY, onResultReady);
colormunch.addEventListener(ColorMunchEvent.ERROR, onResultError);
 
function onResultReady(event:ColorMunchEvent) {
	trace("Kuler recieved");
	var theme:Theme = colormunch.getRandomTheme();
	var themeSprite:Sprite = theme.getThemeSprite();
	themeSprite.width = stage.stageWidth;
	themeSprite.height = stage.stageHeight;
 
	// Put the theme sprite on the stage
	addChild(themeSprite);
 
	// Get information about the selected theme
	trace("Loading theme: " + theme.getThemeTitle());
 
	// access swatch information through the theme object
	var swatch:Swatch;
	var col:uint;
	var cR:uint;
	var cG:uint;
	var cB:uint;
 
	for (var i:int = 0; i < theme.getSwatchCount(); i++) {
		// get the color
		swatch= theme.getSwatchByIndex(i);
		col	= swatch.getHex();
 
		// Split the color into RGB
		cR 	= (col >> 16) & 0xFF;
		cG 	= (col >> 8) & 0xFF;
		cB 	= col & 0xFF;
		trace("RGB:", cR, cG, cB);
	}	
}
function onResultError(event:ColorMunchEvent) {
	trace("Kuler error: " + event.data);
}
 
// Everything prepared, now search for 10 "banana" themes starting at 0
colormunch.searchThemes(ColorMunch.FILTER_NONE, "banana", 0, 10);
1 Comment :, , , more...

Channel Colorizer Demo Application

by on Mar.25, 2010, under Graphics and effects

Try the live demo of the Channel Colorizer Pixel Bender filter I made a couple of weeks ago. You can load an image or use your webcam and then change the RGB colors to some cool theme using coloring by Adobe Kuler. And naturally, you can save your images back to your disk to use them for anything you like.

Adobe Kuler gives the coloring an extra dimension. You can search for whatever comes to your mind: bananas, fire, happiness, an author or a specific color. Just keep in mind that you have to be a little bit patient with the search times, since the kuler-servers seems to be a bit overloaded.

The demo features a couple of really cool techniques:

Go ahead and make some cool images and feel free to post some comments about it!

Creative Commons LicenseChannelColorizer by Klas Lundberg is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 Sweden.
Feel free to contact me if you want it for commercial use.

2 Comments :, , , , , , , , , , , , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...