public final class Color extends Paint implements Interpolatable<Color>
Color
を構築する場合、あるいはColorの色成分またはアルファ成分を取得する場合、色成分とアルファ成分があらかじめ乗算されている可能性はありません。
Color
は、コンストラクタを使用するか、いくつかのユーティリティ・メソッドのいずれかを使用して作成できます。次のコード行ではいずれも同じ青色を作成しています。
Color c = Color.BLUE; //use the blue constant
Color c = new Color(0,0,1,1.0); // standard constructor, use 0->1.0 values, explicit alpha of 1.0
Color c = Color.color(0,0,1.0); //use 0->1.0 values. implicit alpha of 1.0
Color c = Color.color(0,0,1.0,1.0); //use 0->1.0 values, explicit alpha of 1.0
Color c = Color.rgb(0,0,255); //use 0->255 integers, implicit alpha of 1.0
Color c = Color.rgb(0,0,255,1.0); //use 0->255 integers, explicit alpha of 1.0
Color c = Color.hsb(270,1.0,1.0); //hue = 270, saturation & value = 1.0. inplicit alpha of 1.0
Color c = Color.hsb(270,1.0,1.0,1.0); //hue = 270, saturation & value = 1.0, explicit alpha of 1.0
Color c = Color.web("0x0000FF",1.0);// blue as a hex web value, explicit alpha
Color c = Color.web("0x0000FF");// blue as a hex web value, implicit alpha
Color c = Color.web("0x00F");// blue as a short hex web value, implicit alpha
Color c = Color.web("#0000FF",1.0);// blue as a hex web value, explicit alpha
Color c = Color.web("#0000FF");// blue as a hex web value, implicit alpha
Color c = Color.web("#00F");// blue as a short hex web value, implicit alpha
Color c = Color.web("0000FF",1.0);// blue as a hex web value, explicit alpha
Color c = Color.web("0000FF");// blue as a hex web value, implicit alpha
Color c = Color.web("00F");// blue as a short hex web value, implicit alpha
Color c = Color.web("rgba(0,0,255,1.0)");// blue as an rgb web value, explicit alpha
Color c = Color.web("rgb(0,0,255)");// blue as an rgb web value, implicit alpha
Color c = Color.web("rgba(0,0,100%,1.0)");// blue as an rgb percent web value, explicit alpha
Color c = Color.web("rgb(0,0,100%)");// blue as an rgb percent web value, implicit alpha
Color c = Color.web("hsla(270,100%,100%,1.0)");// blue as an hsl web value, explicit alpha
Color c = Color.web("hsl(270,100%,100%)");// blue as an hsl web value, implicit alpha
Color
の作成時に値のいずれかが範囲外の場合、IllegalArgumentException
がスローされます。
例:
Rectangle rec1 = new Rectangle(5, 5, 50, 40);
rec1.setFill(Color.RED);
rec1.setStroke(Color.GREEN);
rec1.setStrokeWidth(3);
Rectangle rec2 = new Rectangle(65, 5, 50, 40);
rec2.setFill(Color.rgb(91, 127, 255));
rec2.setStroke(Color.hsb(40, 0.7, 0.8));
rec2.setStrokeWidth(3);
修飾子と型 | フィールドと説明 |
---|---|
static Color |
ALICEBLUE
アリス・ブルー色(RGB値#F0F8FF)
|
static Color |
ANTIQUEWHITE
アンティーク・ホワイト色(RGB値#FAEBD7)
|
static Color |
AQUA
アクア色(RGB値#00FFFF)
|
static Color |
AQUAMARINE
アクアマリン色(RGB値#7FFFD4)
|
static Color |
AZURE
アズール色(RGB値#F0FFFF)
|
static Color |
BEIGE
ベージュ色(RGB値#F5F5DC)
|
static Color |
BISQUE
ビスク色(RGB値#FFE4C4)
|
static Color |
BLACK
黒色(RGB値#000000)
|
static Color |
BLANCHEDALMOND
ブランチド・アーモンド色(RGB値#FFEBCD)
|
static Color |
BLUE
青色(RGB値#0000FF)
|
static Color |
BLUEVIOLET
ブルー・バイオレット色(RGB値#8A2BE2)
|
static Color |
BROWN
ブラウン色(RGB値#A52A2A)
|
static Color |
BURLYWOOD
バーリー・ウッド色(RGB値#DEB887)
|
static Color |
CADETBLUE
カデット・ブルー色(RGB値#5F9EA0)
|
static Color |
CHARTREUSE
シャルトルーズ色(RGB値#7FFF00)
|
static Color |
CHOCOLATE
チョコレート色(RGB値#D2691E)
|
static Color |
CORAL
コーラル色(RGB値#FF7F50)
|
static Color |
CORNFLOWERBLUE
コーンフラワー・ブルー色(RGB値#6495ED)
|
static Color |
CORNSILK
コーンシルク色(RGB値#FFF8DC)
|
static Color |
CRIMSON
クリムゾン色(RGB値#DC143C)
|
static Color |
CYAN
シアン色(RGB値#00FFFF)
|
static Color |
DARKBLUE
ダーク・ブルー色(RGB値#00008B)
|
static Color |
DARKCYAN
ダーク・シアン色(RGB値#008B8B)
|
static Color |
DARKGOLDENROD
ダーク・ゴールデンロッド色(RGB値#B8860B)
|
static Color |
DARKGRAY
ダーク・グレー色(RGB値#A9A9A9)
|
static Color |
DARKGREEN
ダーク・グリーン色(RGB値#006400)
|
static Color |
DARKGREY
ダーク・グレー色(RGB値#A9A9A9)
|
static Color |
DARKKHAKI
ダーク・カーキ色(RGB値#BDB76B)
|
static Color |
DARKMAGENTA
ダーク・マゼンタ色(RGB値#8B008B)
|
static Color |
DARKOLIVEGREEN
ダーク・オリーブ・グリーン色(RGB値#556B2F)
|
static Color |
DARKORANGE
ダーク・オレンジ色(RGB値#FF8C00)
|
static Color |
DARKORCHID
ダーク・オーキッド色(RGB値#9932CC)
|
static Color |
DARKRED
ダーク・レッド色(RGB値#8B0000)
|
static Color |
DARKSALMON
ダーク・サーモン色(RGB値#E9967A)
|
static Color |
DARKSEAGREEN
ダーク・シー・グリーン色(RGB値#8FBC8F)
|
static Color |
DARKSLATEBLUE
ダーク・スレート・ブルー色(RGB値#483D8B)
|
static Color |
DARKSLATEGRAY
ダーク・スレート・グレー色(RGB値#2F4F4F)
|
static Color |
DARKSLATEGREY
ダーク・スレート・グレー色(RGB値#2F4F4F)
|
static Color |
DARKTURQUOISE
ダーク・ターコイズ色(RGB値#00CED1)
|
static Color |
DARKVIOLET
ダーク・バイオレット色(RGB値#9400D3)
|
static Color |
DEEPPINK
ディープ・ピンク色(RGB値#FF1493)
|
static Color |
DEEPSKYBLUE
ディープ・スカイ・ブルー色(RGB値#00BFFF)
|
static Color |
DIMGRAY
ディム・グレー色(RGB値#696969)
|
static Color |
DIMGREY
ディム・グレー色(RGB値#696969)
|
static Color |
DODGERBLUE
ドジャー・ブルー色(RGB値#1E90FF)
|
static Color |
FIREBRICK
ファイアブリック色(RGB値#B22222)
|
static Color |
FLORALWHITE
フローラル・ホワイト色(RGB値#FFFAF0)
|
static Color |
FORESTGREEN
フォレスト・グリーン色(RGB値#228B22)
|
static Color |
FUCHSIA
フクシャ色(RGB値#FF00FF)
|
static Color |
GAINSBORO
ゲインズボロ色(RGB値#DCDCDC)
|
static Color |
GHOSTWHITE
ゴースト・ホワイト色(RGB値#F8F8FF)
|
static Color |
GOLD
ゴールド色(RGB値#FFD700)
|
static Color |
GOLDENROD
ゴールデンロッド色(RGB値#DAA520)
|
static Color |
GRAY
グレー色(RGB値#808080)
|
static Color |
GREEN
緑色(RGB値#008000)
|
static Color |
GREENYELLOW
グリーン・イエロー色(RGB値#ADFF2F)
|
static Color |
GREY
グレー色(RGB値#808080)
|
static Color |
HONEYDEW
ハニーデュー色(RGB値#F0FFF0)
|
static Color |
HOTPINK
ホット・ピンク色(RGB値#FF69B4)
|
static Color |
INDIANRED
インディアン・レッド色(RGB値#CD5C5C)
|
static Color |
INDIGO
インディゴ色(RGB値#4B0082)
|
static Color |
IVORY
アイボリー色(RGB値#FFFFF0)
|
static Color |
KHAKI
カーキ色(RGB値#F0E68C)
|
static Color |
LAVENDER
ラベンダー色(RGB値#E6E6FA)
|
static Color |
LAVENDERBLUSH
ラベンダー・ブラッシュ色(RGB値#FFF0F5)
|
static Color |
LAWNGREEN
ローン・グリーン色(RGB値#7CFC00)
|
static Color |
LEMONCHIFFON
レモン・シフォン色(RGB値#FFFACD)
|
static Color |
LIGHTBLUE
ライト・ブルー色(RGB値#ADD8E6)
|
static Color |
LIGHTCORAL
ライト・コーラル色(RGB値#F08080)
|
static Color |
LIGHTCYAN
ライト・シアン色(RGB値#E0FFFF)
|
static Color |
LIGHTGOLDENRODYELLOW
ライト・ゴールデンロッド・イエロー色(RGB値#FAFAD2)
|
static Color |
LIGHTGRAY
ライト・グレー色(RGB値#D3D3D3)
|
static Color |
LIGHTGREEN
ライト・グリーン色(RGB値#90EE90)
|
static Color |
LIGHTGREY
ライト・グレー色(RGB値#D3D3D3)
|
static Color |
LIGHTPINK
ライト・ピンク色(RGB値#FFB6C1)
|
static Color |
LIGHTSALMON
ライト・サーモン色(RGB値#FFA07A)
|
static Color |
LIGHTSEAGREEN
ライト・シー・グリーン色(RGB値#20B2AA)
|
static Color |
LIGHTSKYBLUE
ライト・スカイ・ブルー色(RGB値#87CEFA)
|
static Color |
LIGHTSLATEGRAY
ライト・スレート・グレー色(RGB値#778899)
|
static Color |
LIGHTSLATEGREY
ライト・スレート・グレー色(RGB値#778899)
|
static Color |
LIGHTSTEELBLUE
ライト・スチール・ブルー色(RGB値#B0C4DE)
|
static Color |
LIGHTYELLOW
ライト・イエロー色(RGB値#FFFFE0)
|
static Color |
LIME
ライム色(RGB値#00FF00)
|
static Color |
LIMEGREEN
ライム・グリーン色(RGB値#32CD32)
|
static Color |
LINEN
リネン色(RGB値#FAF0E6)
|
static Color |
MAGENTA
マゼンタ色(RGB値#FF00FF)
|
static Color |
MAROON
マルーン色(RGB値#800000)
|
static Color |
MEDIUMAQUAMARINE
ミディアム・アクアマリン色(RGB値#66CDAA)
|
static Color |
MEDIUMBLUE
ミディアム・ブルー色(RGB値#0000CD)
|
static Color |
MEDIUMORCHID
ミディアム・オーキッド色(RGB値#BA55D3)
|
static Color |
MEDIUMPURPLE
ミディアム・パープル色(RGB値#9370DB)
|
static Color |
MEDIUMSEAGREEN
ミディアム・シー・グリーン色(RGB値#3CB371)
|
static Color |
MEDIUMSLATEBLUE
ミディアム・スレート・ブルー色(RGB値#7B68EE)
|
static Color |
MEDIUMSPRINGGREEN
ミディアム・スプリング・グリーン色(RGB値#00FA9A)
|
static Color |
MEDIUMTURQUOISE
ミディアム・ターコイズ色(RGB値#48D1CC)
|
static Color |
MEDIUMVIOLETRED
ミディアム・バイオレット・レッド色(RGB値#C71585)
|
static Color |
MIDNIGHTBLUE
ミッドナイト・ブルー色(RGB値#191970)
|
static Color |
MINTCREAM
ミント・クリーム色(RGB値#F5FFFA)
|
static Color |
MISTYROSE
ミスティ・ローズ色(RGB値#FFE4E1)
|
static Color |
MOCCASIN
モカシン色(RGB値#FFE4B5)
|
static Color |
NAVAJOWHITE
ナバホ・ホワイト色(RGB値#FFDEAD)
|
static Color |
NAVY
ネイビー色(RGB値#000080)
|
static Color |
OLDLACE
オールド・レース色(RGB値#FDF5E6)
|
static Color |
OLIVE
オリーブ色(RGB値#808000)
|
static Color |
OLIVEDRAB
オリーブ・ドラブ色(RGB値#6B8E23)
|
static Color |
ORANGE
オレンジ色(RGB値#FFA500)
|
static Color |
ORANGERED
オレンジ・レッド色(RGB値#FF4500)
|
static Color |
ORCHID
オーキッド色(RGB値#DA70D6)
|
static Color |
PALEGOLDENROD
ペール・ゴールデンロッド色(RGB値#EEE8AA)
|
static Color |
PALEGREEN
ペール・グリーン色(RGB値#98FB98)
|
static Color |
PALETURQUOISE
ペール・ターコイズ色(RGB値#AFEEEE)
|
static Color |
PALEVIOLETRED
ペール・バイオレット・レッド色(RGB値#DB7093)
|
static Color |
PAPAYAWHIP
パパイヤ・ホイップ色(RGB値#FFEFD5)
|
static Color |
PEACHPUFF
ピーチ・パフ色(RGB値#FFDAB9)
|
static Color |
PERU
ペルー色(RGB値#CD853F)
|
static Color |
PINK
ピンク色(RGB値#FFC0CB)
|
static Color |
PLUM
プラム色(RGB値#DDA0DD)
|
static Color |
POWDERBLUE
パウダー・ブルー色(RGB値#B0E0E6)
|
static Color |
PURPLE
紫色(RGB値#800080)
|
static Color |
RED
赤色(RGB値#FF0000)
|
static Color |
ROSYBROWN
ロージー・ブラウン色(RGB値#BC8F8F)
|
static Color |
ROYALBLUE
ロイヤル・ブルー色(RGB値#4169E1)
|
static Color |
SADDLEBROWN
サドル・ブラウン色(RGB値#8B4513)
|
static Color |
SALMON
サーモン色(RGB値#FA8072)
|
static Color |
SANDYBROWN
サンディ・ブラウン色(RGB値#F4A460)
|
static Color |
SEAGREEN
シー・グリーン色(RGB値#2E8B57)
|
static Color |
SEASHELL
シー・シェル色(RGB値#FFF5EE)
|
static Color |
SIENNA
シエナ色(RGB値#A0522D)
|
static Color |
SILVER
シルバー色(RGB値#C0C0C0)
|
static Color |
SKYBLUE
スカイ・ブルー色(RGB値#87CEEB)
|
static Color |
SLATEBLUE
スレート・ブルー色(RGB値#6A5ACD)
|
static Color |
SLATEGRAY
スレート・グレー色(RGB値#708090)
|
static Color |
SLATEGREY
スレート・グレー色(RGB値#708090)
|
static Color |
SNOW
スノー色(RGB値#FFFAFA)
|
static Color |
SPRINGGREEN
スプリング・グリーン色(RGB値#00FF7F)
|
static Color |
STEELBLUE
スチール・ブルー色(RGB値#4682B4)
|
static Color |
TAN
タン色(RGB値#D2B48C)
|
static Color |
TEAL
ティール色(RGB値#008080)
|
static Color |
THISTLE
チスル色(RGB値#D8BFD8)
|
static Color |
TOMATO
トマト色(RGB値#FF6347)
|
static Color |
TRANSPARENT
全透明色(ARGB値#00000000)
|
static Color |
TURQUOISE
ターコイズ色(RGB値#40E0D0)
|
static Color |
VIOLET
バイオレット色(RGB値#EE82EE)
|
static Color |
WHEAT
ウィート色(RGB値#F5DEB3)
|
static Color |
WHITE
白色(RGB値#FFFFFF)
|
static Color |
WHITESMOKE
ホワイト・スモーク色(RGB値#F5F5F5)
|
static Color |
YELLOW
黄色(RGB値#FFFF00)
|
static Color |
YELLOWGREEN
イエロー・グリーン色(RGB値#9ACD32)
|
コンストラクタと説明 |
---|
Color(double red, double green, double blue, double opacity)
色の新しいインスタンスを作成します
|
修飾子と型 | メソッドと説明 |
---|---|
Color |
brighter()
このColorをより明るくした新しいColorを作成します。
|
static Color |
color(double red, double green, double blue)
範囲
0.0-1.0 で指定された赤、緑、青の値を使用して、不透明なsRGB色を作成します。 |
static Color |
color(double red, double green, double blue, double opacity)
範囲
0.0-1.0 で指定された赤、緑、青の値、および指定された不透明度を使用して、sRGB色を作成します。 |
Color |
darker()
このColorをより暗くした新しいColorを作成します。
|
Color |
deriveColor(double hueShift, double saturationFactor, double brightnessFactor, double opacityFactor)
この
Color をベースに、色相、彩度、明度および不透明度の値を変更して新しいColor を作成します。 |
Color |
desaturate()
このColorより彩度を下げて新しいColorを作成します。
|
boolean |
equals(Object obj)
このオブジェクトと他のオブジェクトが等しいかどうかを示します。
|
double |
getBlue()
Color の青成分(範囲0.0-1.0 )。 |
double |
getBrightness()
この
Color の明度成分を取得します。 |
double |
getGreen()
Color の緑成分(範囲0.0-1.0 )。 |
double |
getHue()
この
Color の色相成分を取得します。 |
double |
getOpacity()
Color の不透明度(範囲0.0-1.0 )。 |
double |
getRed()
Color の赤成分(範囲0.0-1.0 )。 |
double |
getSaturation()
この
Color の彩度成分を取得します。 |
static Color |
gray(double gray)
不透明なグレー色を作成します。
|
static Color |
gray(double gray, double opacity)
グレー色を作成します。
|
static Color |
grayRgb(int gray)
これは
rgb(gray, gray, gray) のショートカットです。 |
static Color |
grayRgb(int gray, double opacity)
これは
rgb(gray, gray, gray, opacity) のショートカットです。 |
Color |
grayscale()
このColorと同等のグレースケールを適用した新しいColorを作成します。
|
int |
hashCode()
この
Color オブジェクトのハッシュ・コードを返します。 |
static Color |
hsb(double hue, double saturation, double brightness)
HSBカラー・モデルで指定された値に基づいて、不透明な
Color を作成します。 |
static Color |
hsb(double hue, double saturation, double brightness, double opacity)
HSBカラー・モデルで指定された値、および指定された不透明度に基づく
Color を作成します。 |
Color |
interpolate(Color endValue, double t)
関数では、
0.0 から1.0 までの比率t に沿って補間された値が計算されます。 |
Color |
invert()
このColorを反転して新しいColorを作成します。
|
boolean |
isOpaque()
この描画が完全に不透明かどうかを取得します。
|
static Color |
rgb(int red, int green, int blue)
範囲
0-255 で指定されたRGB値を使用して、不透明なsRGB色を作成します。 |
static Color |
rgb(int red, int green, int blue, double opacity)
範囲
0-255 で指定されたRGB値、および指定された不透明度を使用して、sRGB色を作成します。 |
Color |
saturate()
このColorより彩度を上げて新しいColorを作成します。
|
String |
toString()
この
Color の文字列表現を返します。 |
static Color |
valueOf(String value)
文字列表現から色値を作成します。
|
static Color |
web(String colorString)
HTMLまたはCSS属性文字列で指定されたRGB色を作成します。
|
static Color |
web(String colorString, double opacity)
HTMLまたはCSS属性文字列で指定されたRGB色を作成します。
|
public static final Color TRANSPARENT
public static final Color ALICEBLUE
public static final Color ANTIQUEWHITE
public static final Color AQUA
public static final Color AQUAMARINE
public static final Color AZURE
public static final Color BEIGE
public static final Color BISQUE
public static final Color BLACK
public static final Color BLANCHEDALMOND
public static final Color BLUE
public static final Color BLUEVIOLET
public static final Color BROWN
public static final Color BURLYWOOD
public static final Color CADETBLUE
public static final Color CHARTREUSE
public static final Color CHOCOLATE
public static final Color CORAL
public static final Color CORNFLOWERBLUE
public static final Color CORNSILK
public static final Color CRIMSON
public static final Color CYAN
public static final Color DARKBLUE
public static final Color DARKCYAN
public static final Color DARKGOLDENROD
public static final Color DARKGRAY
public static final Color DARKGREEN
public static final Color DARKGREY
public static final Color DARKKHAKI
public static final Color DARKMAGENTA
public static final Color DARKOLIVEGREEN
public static final Color DARKORANGE
public static final Color DARKORCHID
public static final Color DARKRED
public static final Color DARKSALMON
public static final Color DARKSEAGREEN
public static final Color DARKSLATEBLUE
public static final Color DARKSLATEGRAY
public static final Color DARKSLATEGREY
public static final Color DARKTURQUOISE
public static final Color DARKVIOLET
public static final Color DEEPPINK
public static final Color DEEPSKYBLUE
public static final Color DIMGRAY
public static final Color DIMGREY
public static final Color DODGERBLUE
public static final Color FIREBRICK
public static final Color FLORALWHITE
public static final Color FORESTGREEN
public static final Color FUCHSIA
public static final Color GAINSBORO
public static final Color GHOSTWHITE
public static final Color GOLD
public static final Color GOLDENROD
public static final Color GRAY
public static final Color GREEN
public static final Color GREENYELLOW
public static final Color GREY
public static final Color HONEYDEW
public static final Color HOTPINK
public static final Color INDIANRED
public static final Color INDIGO
public static final Color IVORY
public static final Color KHAKI
public static final Color LAVENDER
public static final Color LAVENDERBLUSH
public static final Color LAWNGREEN
public static final Color LEMONCHIFFON
public static final Color LIGHTBLUE
public static final Color LIGHTCORAL
public static final Color LIGHTCYAN
public static final Color LIGHTGOLDENRODYELLOW
public static final Color LIGHTGRAY
public static final Color LIGHTGREEN
public static final Color LIGHTGREY
public static final Color LIGHTPINK
public static final Color LIGHTSALMON
public static final Color LIGHTSEAGREEN
public static final Color LIGHTSKYBLUE
public static final Color LIGHTSLATEGRAY
public static final Color LIGHTSLATEGREY
public static final Color LIGHTSTEELBLUE
public static final Color LIGHTYELLOW
public static final Color LIME
public static final Color LIMEGREEN
public static final Color LINEN
public static final Color MAGENTA
public static final Color MAROON
public static final Color MEDIUMAQUAMARINE
public static final Color MEDIUMBLUE
public static final Color MEDIUMORCHID
public static final Color MEDIUMPURPLE
public static final Color MEDIUMSEAGREEN
public static final Color MEDIUMSLATEBLUE
public static final Color MEDIUMSPRINGGREEN
public static final Color MEDIUMTURQUOISE
public static final Color MEDIUMVIOLETRED
public static final Color MIDNIGHTBLUE
public static final Color MINTCREAM
public static final Color MISTYROSE
public static final Color MOCCASIN
public static final Color NAVAJOWHITE
public static final Color NAVY
public static final Color OLDLACE
public static final Color OLIVE
public static final Color OLIVEDRAB
public static final Color ORANGE
public static final Color ORANGERED
public static final Color ORCHID
public static final Color PALEGOLDENROD
public static final Color PALEGREEN
public static final Color PALETURQUOISE
public static final Color PALEVIOLETRED
public static final Color PAPAYAWHIP
public static final Color PEACHPUFF
public static final Color PERU
public static final Color PINK
public static final Color PLUM
public static final Color POWDERBLUE
public static final Color PURPLE
public static final Color RED
public static final Color ROSYBROWN
public static final Color ROYALBLUE
public static final Color SADDLEBROWN
public static final Color SALMON
public static final Color SANDYBROWN
public static final Color SEAGREEN
public static final Color SEASHELL
public static final Color SIENNA
public static final Color SILVER
public static final Color SKYBLUE
public static final Color SLATEBLUE
public static final Color SLATEGRAY
public static final Color SLATEGREY
public static final Color SNOW
public static final Color SPRINGGREEN
public static final Color STEELBLUE
public static final Color TAN
public static final Color TEAL
public static final Color THISTLE
public static final Color TOMATO
public static final Color TURQUOISE
public static final Color VIOLET
public static final Color WHEAT
public static final Color WHITE
public static final Color WHITESMOKE
public static final Color YELLOW
public static final Color YELLOWGREEN
public Color(double red, double green, double blue, double opacity)
red
- 範囲0
-1
の赤成分green
- 範囲0
-1
の緑成分blue
- 範囲0
-1
の青成分opacity
- 範囲0
-1
の不透明度public static Color color(double red, double green, double blue, double opacity)
0.0-1.0
で指定された赤、緑、青の値、および指定された不透明度を使用して、sRGB色を作成します。red
- 範囲0.0-1.0
の赤成分green
- 範囲0.0-1.0
の緑成分blue
- 範囲0.0-1.0
の青成分opacity
- 範囲0.0-1.0
の不透明度成分Color
IllegalArgumentException
- いずれかの値が範囲外の場合public static Color color(double red, double green, double blue)
0.0-1.0
で指定された赤、緑、青の値を使用して、不透明なsRGB色を作成します。red
- 範囲0.0-1.0
の赤成分green
- 範囲0.0-1.0
の緑成分blue
- 範囲0.0-1.0
の青成分Color
IllegalArgumentException
- いずれかの値が範囲外の場合public static Color rgb(int red, int green, int blue, double opacity)
0-255
で指定されたRGB値、および指定された不透明度を使用して、sRGB色を作成します。red
- 範囲0-255
の赤成分green
- 範囲0-255
の緑成分blue
- 範囲0-255
の青成分opacity
- 範囲0.0-1.0
の不透明度成分Color
IllegalArgumentException
- いずれかの値が範囲外の場合public static Color rgb(int red, int green, int blue)
0-255
で指定されたRGB値を使用して、不透明なsRGB色を作成します。red
- 範囲0-255
の赤成分green
- 範囲0-255
の緑成分blue
- 範囲0-255
の青成分Color
IllegalArgumentException
- いずれかの値が範囲外の場合public static Color grayRgb(int gray)
rgb(gray, gray, gray)
のショートカットです。public static Color grayRgb(int gray, double opacity)
rgb(gray, gray, gray, opacity)
のショートカットです。public static Color gray(double gray, double opacity)
gray
- 範囲0.0
(黒) - 1.0
(白)のグレースケール色opacity
- 範囲0.0-1.0
の不透明度成分Color
IllegalArgumentException
- いずれかの値が範囲外の場合public static Color gray(double gray)
gray
- 範囲0.0
(黒) - 1.0
(白)のグレースケール色Color
IllegalArgumentException
- いずれかの値が範囲外の場合public static Color hsb(double hue, double saturation, double brightness, double opacity)
Color
を作成します。hue
- 色相(度)saturation
- 彩度(0.0-1.0
)brightness
- 明度(0.0-1.0
)opacity
- 不透明度(0.0-1.0
)Color
IllegalArgumentException
- saturation
、brightness
またはopacity
が範囲外の場合public static Color hsb(double hue, double saturation, double brightness)
Color
を作成します。hue
- 色相(度)saturation
- 彩度(0.0-1.0
)brightness
- 明度(0.0-1.0
)Color
IllegalArgumentException
- saturation
またはbrightness
が範囲外の場合public static Color web(String colorString, double opacity)
このメソッドでは次のフォーマットがサポートされています。
0x
または#
のいずれかを付加し、範囲00
-0xFF
の2桁で指定するか、範囲0
-F
の1桁で指定します。
rgb(r,g,b)
またはrgba(r,g,b,a)
というフォーマット文字列。r
、g
またはb
の各値は、0-255の整数として指定するか、または0.0-100.0の浮動小数点パーセンテージ値としてパーセント(%
)文字付きで指定します。アルファ成分(存在する場合)は0.0-1.0の浮動小数点値です。数字の前後およびパーセンテージ値とパーセント記号(%
)の間には空白文字を入力できます。
hsl(h,s,l)
またはhsla(h,s,l,a)
というフォーマット文字列。h
値は、カラー・ホイールの色相角度(度)を表す0.0-360.0の浮動小数点数です。0.0
または360.0
が赤を表し、120.0
が緑を表し、240.0
が青を表します。s
値は、目的の色の彩度です。彩度は、グレー(0.0
)からフル彩度(100.0
)までの浮動小数点パーセンテージとして表されます。l
値は、目的の色の目的の明度(明るさ)です。明度は、黒(0.0
)からフル明度(100.0
)までの浮動小数点パーセンテージとして表されます。アルファ成分(存在する場合)は0.0-1.0の浮動小数点値です。数字の前後およびパーセンテージ値とパーセント記号(%
)の間には空白文字を入力できます。
アルファ成分のないフォーマットの場合または名前付きカラーの場合、不透明度はopacity
引数に従って設定されます。アルファ成分付きで指定された色の場合、不透明度はアルファ成分の解析とopacity
引数の組合せに基づいて決定されます。そのため、不透明度を指定することによって、透明色はより透明になります。
例:
Webフォーマット文字列 | 同等のコンストラクタまたはファクトリの呼出し |
---|---|
Color.web("orange", 0.5); |
new Color(1.0, 0xA5/255.0, 0.0, 0.5) |
Color.web("0xff66cc33", 0.5); |
new Color(1.0, 0.4, 0.8, 0.1) |
Color.web("0xff66cc", 0.5); |
new Color(1.0, 0.4, 0.8, 0.5) |
Color.web("#ff66cc", 0.5); |
new Color(1.0, 0.4, 0.8, 0.5) |
Color.web("#f68", 0.5); |
new Color(1.0, 0.4, 0.8, 0.5) |
Color.web("rgb(255,102,204)", 0.5); |
new Color(1.0, 0.4, 0.8, 0.5) |
Color.web("rgb(100%,50%,50%)", 0.5); |
new Color(1.0, 0.5, 0.5, 0.5) |
Color.web("rgb(255,50%,50%,0.25)", 0.5); |
new Color(1.0, 0.5, 0.5, 0.125) |
Color.web("hsl(240,100%,100%)", 0.5); |
Color.hsb(240.0, 1.0, 1.0, 0.5) |
Color.web("hsla(120,0%,0%,0.25)", 0.5);
|
Color.hsb(120.0, 0.0, 0.0, 0.125)
|
colorString
- サポートされているフォーマットのいずれかによる、色の名前または数値表現opacity
- 範囲0.0 (透明) - 1.0 (不透明)の不透明度成分NullPointerException
- colorString
がnull
の場合IllegalArgumentException
- colorString
にサポート対象外の色名が指定されているか、無効な数値が含まれている場合public static Color web(String colorString)
このメソッドでは次のフォーマットがサポートされています。
0x
または#
のいずれかを付加し、範囲00
-0xFF
の2桁で指定するか、範囲0
-F
の1桁で指定します。
rgb(r,g,b)
またはrgba(r,g,b,a)
というフォーマット文字列。r
、g
またはb
の各値は、0-255の整数として指定するか、または0.0-100.0の浮動小数点パーセンテージ値としてパーセント(%
)文字付きで指定します。アルファ成分(存在する場合)は0.0-1.0の浮動小数点値です。数字の前後およびパーセンテージ値とパーセント記号(%
)の間には空白文字を入力できます。
hsl(h,s,l)
またはhsla(h,s,l,a)
というフォーマット文字列。h
値は、カラー・ホイールの色相角度(度)を表す0.0-360.0の浮動小数点数です。0.0
または360.0
が赤を表し、120.0
が緑を表し、240.0
が青を表します。s
値は、目的の色の彩度です。彩度は、グレー(0.0
)からフル彩度(100.0
)までの浮動小数点パーセンテージとして表されます。l
値は、目的の色の目的の明度(明るさ)です。明度は、黒(0.0
)からフル明度(100.0
)までの浮動小数点パーセンテージとして表されます。アルファ成分(存在する場合)は0.0-1.0の浮動小数点値です。数字の前後およびパーセンテージ値とパーセント記号(%
)の間には空白文字を入力できます。
例:
Webフォーマット文字列 | 同等のコンストラクタまたはファクトリの呼出し |
---|---|
Color.web("orange"); |
Color.ORANGE |
Color.web("0xff668840"); |
Color.rgb(255, 102, 136, 0.25) |
Color.web("0xff6688"); |
Color.rgb(255, 102, 136, 1.0) |
Color.web("#ff6688"); |
Color.rgb(255, 102, 136, 1.0) |
Color.web("#f68"); |
Color.rgb(255, 102, 136, 1.0) |
Color.web("rgb(255,102,136)"); |
Color.rgb(255, 102, 136, 1.0) |
Color.web("rgb(100%,50%,50%)"); |
Color.rgb(255, 128, 128, 1.0) |
Color.web("rgb(255,50%,50%,0.25)"); |
Color.rgb(255, 128, 128, 0.25) |
Color.web("hsl(240,100%,100%)"); |
Color.hsb(240.0, 1.0, 1.0, 1.0) |
Color.web("hsla(120,0%,0%,0.25)");
|
Color.hsb(120.0, 0.0, 0.0, 0.25)
|
colorString
- サポートされているフォーマットのいずれかによる、色の名前または数値表現NullPointerException
- colorString
がnull
の場合IllegalArgumentException
- colorString
にサポート対象外の色名が指定されているか、無効な数値が含まれている場合public static Color valueOf(String value)
web(String)
の場合と同じです。value
- 変換対象の文字列Color
オブジェクトNullPointerException
- value
がnull
である場合IllegalArgumentException
- value
にサポート対象外の色名または無効な16進値が指定されている場合web(String)
public double getHue()
Color
の色相成分を取得します。0.0-360.0
の色相値。public double getSaturation()
Color
の彩度成分を取得します。0.0-1.0
の彩度値。public double getBrightness()
Color
の明度成分を取得します。0.0-1.0
の明度値。public Color deriveColor(double hueShift, double saturationFactor, double brightnessFactor, double opacityFactor)
Color
をベースに、色相、彩度、明度および不透明度の値を変更して新しいColor
を作成します。色相は、指定された値にシフトされ、その自然範囲に正規化されます。その他の成分の値は、指定された係数を乗算してそれぞれの範囲にクリップされます。ゼロのかわりに非常に小さいソース明度を任意に指定することによって、黒色の明度を上げることができます。public Color brighter()
public Color darker()
public Color saturate()
public Color desaturate()
public Color grayscale()
public Color invert()
public final double getRed()
Color
の赤成分(範囲0.0-1.0
)。public final double getGreen()
Color
の緑成分(範囲0.0-1.0
)。public final double getBlue()
Color
の青成分(範囲0.0-1.0
)。public final double getOpacity()
Color
の不透明度(範囲0.0-1.0
)。public final boolean isOpaque()
Paint
public Color interpolate(Color endValue, double t)
Interpolatable
0.0
から1.0
までの比率t
に沿って補間された値が計算されます。t
= 1.0の場合、endVal
が返されます。interpolate
、インタフェース: Interpolatable<Color>
endValue
- ターゲット値t
- 0.0
から1.0
までの比率public boolean equals(Object obj)
public int hashCode()
Color
オブジェクトのハッシュ・コードを返します。Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.