public class ColorScheme
extends java.lang.Object
Vona's utils: a color scheme, a-la "Color Bytes" by Jean Bourges.
First read the class header doc for Hue
.
Copyright (C) 2004 Marsette A. Vona, III
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Modifier and Type | Field and Description |
---|---|
java.lang.String |
baseName
The base name of this ColorScheme.
|
static ColorScheme |
blueVioletScheme
A ColorScheme where
Hue.blueVioletHue is the primary Hue . |
Hue |
complimentHue
The compliment
Hue of this ColorScheme. |
Hue |
complimentRelatedHue
The compliment related
Hue of this ColorScheme. |
java.awt.Color |
complimentRelatedRGB
The compliment related Color of this ColorScheme.
|
java.awt.Color |
complimentRGB
The compliment Color of this ColorScheme.
|
private static java.lang.String |
cvsid
CVS id.
|
static ColorScheme |
cyanScheme
A ColorScheme where
Hue.cyanHue is the primary Hue . |
static float |
DARKER
|
private ColorScheme |
darkerScheme
Memo for
darker() . |
private ColorScheme |
darkestScheme
Memo for
darkest() . |
private ColorScheme |
leastTransparentScheme
Memo for
leastTransparent() . |
private ColorScheme |
lessTransparentScheme
Memo for
lessTransparent() . |
private ColorScheme |
lighterScheme
Memo for
lighter() . |
private ColorScheme |
lightestScheme
Memo for
lightest() . |
private ColorScheme |
louderScheme
Memo for
louder() . |
private ColorScheme |
loudestScheme
Memo for
loudest() . |
private ColorScheme |
moreTransparentScheme
Memo for
moreTransparent() . |
private ColorScheme |
mostTransparentScheme
Memo for
mostTransparent() . |
java.lang.String |
name
The name of this ColorScheme.
|
Hue |
primaryHue
The primary
Hue of this ColorScheme. |
java.awt.Color |
primaryRGB
The primary Color of this ColorScheme.
|
static ColorScheme |
purpleScheme
A ColorScheme where
Hue.purpleHue is the primary Hue . |
float |
relAlpha
The relative alpha of this ColorScheme.
|
Hue |
relatedHue
The related
Hue of this ColorScheme. |
java.awt.Color |
relatedRGB
The related Color of this ColorScheme.
|
float |
relBlack
The relative black of this ColorScheme.
|
float |
relTint
The relative tint of this ColorScheme.
|
protected static ColorScheme[] |
schemes
all the schemes
|
static ColorScheme |
skyBlueScheme
A ColorScheme where
Hue.skyBlueHue is the primary Hue . |
static ColorScheme |
softBlueVioletScheme
A
softer() ColorScheme than blueVioletScheme . |
static ColorScheme |
softCyanScheme
A
softer() ColorScheme than cyanScheme . |
static float |
SOFTER
|
private ColorScheme |
softerScheme
Memo for
softer() . |
private ColorScheme |
softestScheme
Memo for
softest() . |
static ColorScheme |
softPurpleScheme
A
softer() ColorScheme than purpleScheme . |
static ColorScheme |
softSkyBlueScheme
A
softer() ColorScheme than skyBlueScheme . |
static ColorScheme |
softUltramarineScheme
A
softer() ColorScheme than ultramarineScheme . |
static float |
TRANSPARENTER
Amount by which alpha is decreased/increased to make a
moreTransparent() /lessTransparent() derivative ColorScheme. |
static ColorScheme |
ultramarineScheme
A ColorScheme where
Hue.ultramarineHue is the primary Hue . |
Constructor and Description |
---|
ColorScheme(ColorScheme base,
float relTint)
Make a new ColorScheme baed on an existing one.
|
ColorScheme(ColorScheme base,
float relTint,
float relBlack)
Make a new ColorScheme baed on an existing one.
|
ColorScheme(ColorScheme base,
float relTint,
float relBlack,
float relAlpha)
Make a new ColorScheme baed on an existing one.
|
ColorScheme(Hue primaryHue)
Covers
ColorScheme(Hue, Hue, Hue, Hue) , derives all hues from
the primary Hue. |
ColorScheme(Hue primaryHue,
Hue relatedHue,
Hue complimentHue,
Hue complimentRelatedHue)
Covers
ColorScheme(Hue, Hue, Hue, Hue, float) , uses relative
tint 1.0. |
ColorScheme(Hue primaryHue,
Hue relatedHue,
Hue complimentHue,
Hue complimentRelatedHue,
float relTint)
Covers
ColorScheme(Hue, Hue, Hue, Hue, float, float) , uses
relative black 0.0. |
ColorScheme(Hue primaryHue,
Hue relatedHue,
Hue complimentHue,
Hue complimentRelatedHue,
float relTint,
float relBlack)
Covers
ColorScheme(Hue, Hue, Hue, Hue, float, float, float) ,
uses relative alpha 1.0 (full opaque). |
ColorScheme(Hue primaryHue,
Hue relatedHue,
Hue complimentHue,
Hue complimentRelatedHue,
float relTint,
float relBlack,
float relAlpha)
Covers
ColorScheme(Hue, Hue, Hue, Hue, float, float, float,
String) , uses the name of the primary hue as the base name of the
ColorScheme. |
ColorScheme(Hue primaryHue,
Hue relatedHue,
Hue complimentHue,
Hue complimentRelatedHue,
float relTint,
float relBlack,
float relAlpha,
java.lang.String baseName)
Make a ColorScheme.
|
Modifier and Type | Method and Description |
---|---|
ColorScheme |
darker()
Return a derived ColorScheme with relative black
DARKER
towards 1.0. |
ColorScheme |
darkest()
Return a derived ColorScheme with 1.0 relative black.
|
float |
getAlpha()
Get the alpha of this ColorScheme.
|
java.lang.String |
getBaseName()
Returns the base name of this ColorScheme.
|
float |
getBlack()
Get the black of this ColorScheme.
|
java.awt.Color |
getComplimentColor()
Get the compliment Color of this ColorScheme.
|
java.awt.Color |
getComplimentColor(java.awt.color.ColorSpace colorSpace)
Get the compliment Color of this ColorScheme.
|
Hue |
getComplimentHue()
Get the compliment
Hue of this ColorScheme. |
java.awt.Color |
getComplimentRelatedColor()
Get the compliment related Color of this ColorScheme.
|
java.awt.Color |
getComplimentRelatedColor(java.awt.color.ColorSpace colorSpace)
Get the compliment related Color of this ColorScheme.
|
Hue |
getComplimentRelatedHue()
Get the compliment related
Hue of this ColorScheme. |
java.awt.Color |
getCoolPrimaryColor()
Get the primary color in this ColorScheme which is "cool".
|
java.awt.Color |
getCoolRelatedColor()
Get the non-primary color in this ColorScheme which is "cool".
|
java.lang.String |
getName()
Returns the name of this ColorScheme.
|
static int |
getNumSchemes()
Get the number of schemes available from
getScheme(int) . |
java.awt.Color |
getPrimaryColor()
Get the primary Color of this ColorScheme.
|
java.awt.Color |
getPrimaryColor(java.awt.color.ColorSpace colorSpace)
Get the primary Color of this ColorScheme.
|
Hue |
getPrimaryHue()
Get the primary
Hue of this ColorScheme. |
float |
getRelAlpha()
Get the relative alpha of this ColorScheme.
|
java.awt.Color |
getRelatedColor()
Get the related Color of this ColorScheme.
|
java.awt.Color |
getRelatedColor(java.awt.color.ColorSpace colorSpace)
Get the related Color of this ColorScheme.
|
Hue |
getRelatedHue()
Get the related
Hue of this ColorScheme. |
float |
getRelBlack()
Get the relative black of this ColorScheme.
|
float |
getRelTint()
Get the relative tint of this ColorScheme.
|
static ColorScheme |
getScheme(int index)
Get one of the
getNumSchemes() hues by index. |
static ColorScheme |
getScheme(java.lang.String name)
Get one of the standard schemes by name.
|
float |
getTint()
Get the tint of this ColorScheme.
|
java.awt.Color |
getWarmPrimaryColor()
Get the primary color in this ColorScheme which is "warm".
|
java.awt.Color |
getWarmRelatedColor()
Get the non-primary color in this ColorScheme which is "warm".
|
boolean |
hasHue(Hue hue)
Check whether any of the 4
Hue s of this ColorScheme match a
specified Hue. |
ColorScheme |
leastTransparent()
Return a derived ColorScheme with 1.0 relative alpha.
|
ColorScheme |
lessTransparent()
Return a derived ColorScheme with relative alpha
TRANSPARENTER
towards 1.0. |
ColorScheme |
lighter()
Return a derived ColorScheme with relative black
DARKER
towards 0.0. |
ColorScheme |
lightest()
Return a derived ColorScheme with 0.0 relative black.
|
ColorScheme |
louder()
Return a derived ColorScheme with relative tint
SOFTER
towards 1.0. |
ColorScheme |
loudest()
Return a derived ColorScheme with 1.0 relative tint.
|
private static java.lang.String |
makeName(java.lang.String base,
float relTint,
float relBlack,
float relAlpha)
Compose a default name for a ColorScheme.
|
ColorScheme |
moreTransparent()
Return a derived ColorScheme with relative alpha
TRANSPARENTER
towards 0.0. |
ColorScheme |
mostTransparent()
Return a derived ColorScheme with 0.0 relative alpha.
|
ColorScheme |
softer()
Return a derived ColorScheme with relative tint
SOFTER
towards 0.0. |
ColorScheme |
softest()
Return a derived ColorScheme with 0.0 relative tint.
|
java.lang.String |
toString()
Returns the name of this ColorScheme.
|
private static final java.lang.String cvsid
CVS id.
public static final float SOFTER
public static final float DARKER
public static final float TRANSPARENTER
Amount by which alpha is decreased/increased to make a moreTransparent()
/lessTransparent()
derivative ColorScheme.
public static final ColorScheme cyanScheme
A ColorScheme where Hue.cyanHue
is the primary Hue
.
public static final ColorScheme softCyanScheme
A softer()
ColorScheme than cyanScheme
.
public static final ColorScheme skyBlueScheme
A ColorScheme where Hue.skyBlueHue
is the primary Hue
.
public static final ColorScheme softSkyBlueScheme
A softer()
ColorScheme than skyBlueScheme
.
public static final ColorScheme ultramarineScheme
A ColorScheme where Hue.ultramarineHue
is the primary Hue
.
public static final ColorScheme softUltramarineScheme
A softer()
ColorScheme than ultramarineScheme
.
public static final ColorScheme blueVioletScheme
A ColorScheme where Hue.blueVioletHue
is the primary Hue
.
public static final ColorScheme softBlueVioletScheme
A softer()
ColorScheme than blueVioletScheme
.
public static final ColorScheme purpleScheme
A ColorScheme where Hue.purpleHue
is the primary Hue
.
public static final ColorScheme softPurpleScheme
A softer()
ColorScheme than purpleScheme
.
protected static final ColorScheme[] schemes
public final Hue complimentRelatedHue
The compliment related Hue
of this ColorScheme.
public final float relTint
The relative tint of this ColorScheme.
public final float relBlack
The relative black of this ColorScheme.
public final float relAlpha
The relative alpha of this ColorScheme.
public final java.awt.Color primaryRGB
The primary Color of this ColorScheme.
public final java.awt.Color relatedRGB
The related Color of this ColorScheme.
public final java.awt.Color complimentRGB
The compliment Color of this ColorScheme.
public final java.awt.Color complimentRelatedRGB
The compliment related Color of this ColorScheme.
public final java.lang.String name
The name of this ColorScheme.
public final java.lang.String baseName
The base name of this ColorScheme.
private ColorScheme louderScheme
Memo for louder()
.
private ColorScheme loudestScheme
Memo for loudest()
.
private ColorScheme softerScheme
Memo for softer()
.
private ColorScheme softestScheme
Memo for softest()
.
private ColorScheme lighterScheme
Memo for lighter()
.
private ColorScheme lightestScheme
Memo for lightest()
.
private ColorScheme darkerScheme
Memo for darker()
.
private ColorScheme darkestScheme
Memo for darkest()
.
private ColorScheme moreTransparentScheme
Memo for moreTransparent()
.
private ColorScheme mostTransparentScheme
Memo for mostTransparent()
.
private ColorScheme lessTransparentScheme
Memo for lessTransparent()
.
private ColorScheme leastTransparentScheme
Memo for leastTransparent()
.
public ColorScheme(Hue primaryHue, Hue relatedHue, Hue complimentHue, Hue complimentRelatedHue, float relTint, float relBlack, float relAlpha, java.lang.String baseName)
Make a ColorScheme.
The relative tint/black/alpha are normalized values in the range [0.0,
1.0] indicating the tint/black/alpha value of Hue
s in this
ColorScheme by interpolation between
Hue.MIN_{TINT/BLACK/ALPHA}
and
Hue.MAX_{TINT/BLACK/ALPHA}
.
primaryHue
- the primary huerelatedHue
- the related huecomplimentHue
- the compliment huecomplimentRelatedHue
- the complimentRelated huerelTint
- the relative tintrelBlack
- the relative blackrelAlpha
- the relative alphabaseName
- the base name of this ColorSchemepublic ColorScheme(Hue primaryHue, Hue relatedHue, Hue complimentHue, Hue complimentRelatedHue, float relTint, float relBlack, float relAlpha)
Covers ColorScheme(Hue, Hue, Hue, Hue, float, float, float,
String)
, uses the name of the primary hue as the base name of the
ColorScheme.
public ColorScheme(Hue primaryHue, Hue relatedHue, Hue complimentHue, Hue complimentRelatedHue, float relTint, float relBlack)
Covers ColorScheme(Hue, Hue, Hue, Hue, float, float, float)
,
uses relative alpha 1.0 (full opaque).
public ColorScheme(Hue primaryHue, Hue relatedHue, Hue complimentHue, Hue complimentRelatedHue, float relTint)
Covers ColorScheme(Hue, Hue, Hue, Hue, float, float)
, uses
relative black 0.0.
public ColorScheme(Hue primaryHue, Hue relatedHue, Hue complimentHue, Hue complimentRelatedHue)
Covers ColorScheme(Hue, Hue, Hue, Hue, float)
, uses relative
tint 1.0.
public ColorScheme(Hue primaryHue)
Covers ColorScheme(Hue, Hue, Hue, Hue)
, derives all hues from
the primary Hue.
public ColorScheme(ColorScheme base, float relTint, float relBlack, float relAlpha)
Make a new ColorScheme baed on an existing one.
The Hue
s and base name are copied from base
.
base
- the existing ColorScheme to copyrelTint
- the relative tintrelBlack
- the relative blackrelAlpha
- the relative alphapublic ColorScheme(ColorScheme base, float relTint, float relBlack)
Make a new ColorScheme baed on an existing one.
The Hue
s, base name, and relative alpha are copied from
base
.
base
- the existing ColorScheme to copyrelTint
- the relative tintrelBlack
- the relative blackpublic ColorScheme(ColorScheme base, float relTint)
Make a new ColorScheme baed on an existing one.
The Hue
s, base name, relative black, and relative alpha are
copied from base
.
base
- the existing ColorScheme to copyrelTint
- the relative tintprivate static java.lang.String makeName(java.lang.String base, float relTint, float relBlack, float relAlpha)
Compose a default name for a ColorScheme.
base
- the base namerelTint
- the relative tintrelBlack
- the relative blackrelAlpha
- the relative alphapublic ColorScheme louder()
Return a derived ColorScheme with relative tint SOFTER
towards 1.0.
public ColorScheme loudest()
Return a derived ColorScheme with 1.0 relative tint.
public ColorScheme softer()
Return a derived ColorScheme with relative tint SOFTER
towards 0.0.
public ColorScheme softest()
Return a derived ColorScheme with 0.0 relative tint.
public ColorScheme darker()
Return a derived ColorScheme with relative black DARKER
towards 1.0.
public ColorScheme darkest()
Return a derived ColorScheme with 1.0 relative black.
public ColorScheme lighter()
Return a derived ColorScheme with relative black DARKER
towards 0.0.
public ColorScheme lightest()
Return a derived ColorScheme with 0.0 relative black.
public ColorScheme moreTransparent()
Return a derived ColorScheme with relative alpha TRANSPARENTER
towards 0.0.
public ColorScheme mostTransparent()
Return a derived ColorScheme with 0.0 relative alpha.
public ColorScheme lessTransparent()
Return a derived ColorScheme with relative alpha TRANSPARENTER
towards 1.0.
public ColorScheme leastTransparent()
Return a derived ColorScheme with 1.0 relative alpha.
public java.lang.String getName()
Returns the name of this ColorScheme.
public java.lang.String getBaseName()
Returns the base name of this ColorScheme.
public java.lang.String toString()
Returns the name of this ColorScheme.
toString
in class java.lang.Object
public boolean hasHue(Hue hue)
Check whether any of the 4 Hue
s of this ColorScheme match a
specified Hue.
hue
- the Hue to check forhue
is one of the 4 Hues of this ColorSchemepublic Hue getPrimaryHue()
Get the primary Hue
of this ColorScheme.
public Hue getRelatedHue()
Get the related Hue
of this ColorScheme.
public Hue getComplimentHue()
Get the compliment Hue
of this ColorScheme.
public Hue getComplimentRelatedHue()
Get the compliment related Hue
of this ColorScheme.
public float getTint()
Get the tint of this ColorScheme.
public float getRelTint()
Get the relative tint of this ColorScheme.
The relative tint is a normalized value in the range [0.0, 1.0]
indicating the tint value of Hue
s in this ColorScheme by
interpolation between Hue.MIN_TINT
and Hue.MAX_TINT
.
public float getBlack()
Get the black of this ColorScheme.
public float getRelBlack()
Get the relative black of this ColorScheme.
The relative black is a normalized value in the range [0.0, 1.0]
indicating the black value of Hue
s in this ColorScheme by
interpolation between Hue.MIN_BLACK
and Hue.MAX_BLACK
.
public float getAlpha()
Get the alpha of this ColorScheme.
public float getRelAlpha()
Get the relative alpha of this ColorScheme.
The relative alpha is a normalized value in the range [0.0, 1.0]
indicating the alpha value of Hue
s this ColorScheme by
interpolation between Hue.MIN_ALPHA
and Hue.MAX_ALPHA
.
public java.awt.Color getPrimaryColor(java.awt.color.ColorSpace colorSpace)
Get the primary Color of this ColorScheme.
colorSpace
- the return ColorSpace, null for defaultpublic java.awt.Color getPrimaryColor()
Get the primary Color of this ColorScheme.
public java.awt.Color getRelatedColor(java.awt.color.ColorSpace colorSpace)
Get the related Color of this ColorScheme.
colorSpace
- the return ColorSpace, null for defaultpublic java.awt.Color getRelatedColor()
Get the related Color of this ColorScheme.
public java.awt.Color getComplimentColor(java.awt.color.ColorSpace colorSpace)
Get the compliment Color of this ColorScheme.
colorSpace
- the return ColorSpace, null for defaultpublic java.awt.Color getComplimentColor()
Get the compliment Color of this ColorScheme.
public java.awt.Color getComplimentRelatedColor(java.awt.color.ColorSpace colorSpace)
Get the compliment related Color of this ColorScheme.
colorSpace
- the return ColorSpace, null for defaultpublic java.awt.Color getComplimentRelatedColor()
Get the compliment related Color of this ColorScheme.
public java.awt.Color getWarmPrimaryColor()
Get the primary color in this ColorScheme which is "warm".
public java.awt.Color getWarmRelatedColor()
Get the non-primary color in this ColorScheme which is "warm".
public java.awt.Color getCoolPrimaryColor()
Get the primary color in this ColorScheme which is "cool".
public java.awt.Color getCoolRelatedColor()
Get the non-primary color in this ColorScheme which is "cool".
public static ColorScheme getScheme(int index)
Get one of the getNumSchemes()
hues by index.
index
- the zero-based index of the hue in the range [0, getNumSchemes()
-1]public static int getNumSchemes()
Get the number of schemes available from getScheme(int)
.
getScheme(int)
public static ColorScheme getScheme(java.lang.String name)
Get one of the standard schemes by name.
name
- the name of the scheme