Skip to content
vormplus edited this page Oct 27, 2014 · 1 revision

The Toned class is used to create an shaded color palette based on a color. It does this by mixing the color with a neutral gray. The end result is a color palette with six colors. The Toned class is closely related to the Shaded class, which mixes a color with black, and the Tinted class, which mixes a color with white.

The Toned class extends the Palette class, which means you can use all methods from the Palette class.

You can create a Toned color palette with one of the constructors below.

p1 = new Toned( this, c );
p2 = new Toned( this ).setColor( color( 255, 0, 0 ) );

This is the full code for the sketch, you can also find it in the examples folder that comes with the colorLib download.

import colorlib.webservices.*;
import colorlib.tools.*;
import colorlib.*;

Toned p1, p2;

void setup()
{
	size( 200, 200 );
	smooth();
	noStroke();
	   
	color c = color( 255, 255, 0 );
	
	p1 = new Toned( this, c );
	p2 = new Toned( this ).setColor( color( 255, 0, 0 ) );
}

void draw()
{
	background( 0 );
	translate( 10, 10 );
	p1.drawSwatches();
	
	translate( 0, 50 );
	p2.drawSwatches( 180, 60 );
}

Clone this wiki locally