com.spun.util.Colors Maven / Gradle / Ivy
package com.spun.util;
import java.awt.Color;
import java.util.Random;
/**
* Every color under the
* r
a
i
n
b
o
w
,
* and different ways to get them.
*/
public class Colors
{
public static class Blues
{
/**
* The color Navy
**/
public static final Color Navy = Color.decode("#000080");
/**
* The color DarkBlue
**/
public static final Color DarkBlue = Color.decode("#00008B");
/**
* The color MidnightBlue
**/
public static final Color MidnightBlue = Color.decode("#191970");
/**
* The color MediumBlue
**/
public static final Color MediumBlue = Color.decode("#0000CD");
/**
* The color Blue
**/
public static final Color Blue = Color.decode("#0000FF");
/**
* The color Teal
**/
public static final Color Teal = Color.decode("#008080");
/**
* The color DarkSlateBlue
**/
public static final Color DarkSlateBlue = Color.decode("#483D8B");
/**
* The color DarkCyan
**/
public static final Color DarkCyan = Color.decode("#008B8B");
/**
* The color SteelBlue
**/
public static final Color SteelBlue = Color.decode("#4682B4");
/**
* The color RoyalBlue
**/
public static final Color RoyalBlue = Color.decode("#4169E1");
/**
* The color SlateBlue
**/
public static final Color SlateBlue = Color.decode("#6A5ACD");
/**
* The color CadetBlue
**/
public static final Color CadetBlue = Color.decode("#5F9EA0");
/**
* The color DarkTurquoise
**/
public static final Color DarkTurquoise = Color.decode("#00CED1");
/**
* The color DodgerBlue
**/
public static final Color DodgerBlue = Color.decode("#1E90FF");
/**
* The color DeepSkyBlue
**/
public static final Color DeepSkyBlue = Color.decode("#00BFFF");
/**
* The color MediumSlateBlue
**/
public static final Color MediumSlateBlue = Color.decode("#7B68EE");
/**
* The color MediumTurquoise
**/
public static final Color MediumTurquoise = Color.decode("#48D1CC");
/**
* The color CornflowerBlue
**/
public static final Color CornflowerBlue = Color.decode("#6495ED");
/**
* The color Turquoise
**/
public static final Color Turquoise = Color.decode("#40E0D0");
/**
* The color Aqua
**/
public static final Color Aqua = Color.decode("#00FFFF");
/**
* The color Cyan
**/
public static final Color Cyan = Color.decode("#00FFFF");
/**
* The color SkyBlue
**/
public static final Color SkyBlue = Color.decode("#87CEEB");
/**
* The color LightSkyBlue
**/
public static final Color LightSkyBlue = Color.decode("#87CEFA");
/**
* The color Aquamarine
**/
public static final Color Aquamarine = Color.decode("#7FFFD4");
/**
* The color LightSteelBlue
**/
public static final Color LightSteelBlue = Color.decode("#B0C4DE");
/**
* The color LightBlue
**/
public static final Color LightBlue = Color.decode("#ADD8E6");
/**
* The color PowderBlue
**/
public static final Color PowderBlue = Color.decode("#B0E0E6");
/**
* The color PaleTurquoise
**/
public static final Color PaleTurquoise = Color.decode("#AFEEEE");
/**
* The color LightCyan
**/
public static final Color LightCyan = Color.decode("#E0FFFF");
/**
* The color AliceBlue
**/
public static final Color AliceBlue = Color.decode("#F0F8FF");
/**
* The color Azure
**/
public static final Color Azure = Color.decode("#F0FFFF");
}
public static class Browns
{
/**
* The color Maroon
**/
public static final Color Maroon = Color.decode("#800000");
/**
* The color SaddleBrown
**/
public static final Color SaddleBrown = Color.decode("#8B4513");
/**
* The color Brown
**/
public static final Color Brown = Color.decode("#A52A2A");
/**
* The color Sienna
**/
public static final Color Sienna = Color.decode("#A0522D");
/**
* The color DarkGoldenrod
**/
public static final Color DarkGoldenrod = Color.decode("#B8860B");
/**
* The color Chocolate
**/
public static final Color Chocolate = Color.decode("#D2691E");
/**
* The color Peru
**/
public static final Color Peru = Color.decode("#CD853F");
/**
* The color Goldenrod
**/
public static final Color Goldenrod = Color.decode("#DAA520");
/**
* The color RosyBrown
**/
public static final Color RosyBrown = Color.decode("#BC8F8F");
/**
* The color SandyBrown
**/
public static final Color SandyBrown = Color.decode("#F4A460");
/**
* The color Tan
**/
public static final Color Tan = Color.decode("#D2B48C");
/**
* The color BurlyWood
**/
public static final Color BurlyWood = Color.decode("#DEB887");
/**
* The color Wheat
**/
public static final Color Wheat = Color.decode("#F5DEB3");
/**
* The color NavajoWhite
**/
public static final Color NavajoWhite = Color.decode("#FFDEAD");
/**
* The color Bisque
**/
public static final Color Bisque = Color.decode("#FFE4C4");
/**
* The color BlanchedAlmond
**/
public static final Color BlanchedAlmond = Color.decode("#FFEBCD");
/**
* The color Cornsilk
**/
public static final Color Cornsilk = Color.decode("#FFF8DC");
}
public static class Grays
{
/**
* The color Black
**/
public static final Color Black = Color.decode("#000000");
/**
* The color DarkSlateGray
**/
public static final Color DarkSlateGray = Color.decode("#2F4F4F");
/**
* The color DimGray
**/
public static final Color DimGray = Color.decode("#696969");
/**
* The color Gray
**/
public static final Color Gray = Color.decode("#808080");
/**
* The color SlateGray
**/
public static final Color SlateGray = Color.decode("#708090");
/**
* The color LightSlateGray
**/
public static final Color LightSlateGray = Color.decode("#778899");
/**
* The color DarkGray
**/
public static final Color DarkGray = Color.decode("#A9A9A9");
/**
* The color Silver
**/
public static final Color Silver = Color.decode("#C0C0C0");
/**
* The color LightGray
**/
public static final Color LightGray = Color.decode("#D3D3D3");
/**
* The color Gainsboro
**/
public static final Color Gainsboro = Color.decode("#DCDCDC");
}
public static class Greens
{
/**
* The color DarkGreen
**/
public static final Color DarkGreen = Color.decode("#006400");
/**
* The color Green
**/
public static final Color Green = Color.decode("#008000");
/**
* The color ForestGreen
**/
public static final Color ForestGreen = Color.decode("#228B22");
/**
* The color DarkOliveGreen
**/
public static final Color DarkOliveGreen = Color.decode("#556B2F");
/**
* The color Lime
**/
public static final Color Lime = Color.decode("#00FF00");
/**
* The color Olive
**/
public static final Color Olive = Color.decode("#808000");
/**
* The color Teal
**/
public static final Color Teal = Color.decode("#008080");
/**
* The color SeaGreen
**/
public static final Color SeaGreen = Color.decode("#2E8B57");
/**
* The color DarkCyan
**/
public static final Color DarkCyan = Color.decode("#008B8B");
/**
* The color OliveDrab
**/
public static final Color OliveDrab = Color.decode("#6B8E23");
/**
* The color LimeGreen
**/
public static final Color LimeGreen = Color.decode("#32CD32");
/**
* The color MediumSeaGreen
**/
public static final Color MediumSeaGreen = Color.decode("#3CB371");
/**
* The color LawnGreen
**/
public static final Color LawnGreen = Color.decode("#7CFC00");
/**
* The color LightSeaGreen
**/
public static final Color LightSeaGreen = Color.decode("#20B2AA");
/**
* The color Chartreuse
**/
public static final Color Chartreuse = Color.decode("#7FFF00");
/**
* The color SpringGreen
**/
public static final Color SpringGreen = Color.decode("#00FF7F");
/**
* The color MediumSpringGreen
**/
public static final Color MediumSpringGreen = Color.decode("#00FA9A");
/**
* The color YellowGreen
**/
public static final Color YellowGreen = Color.decode("#9ACD32");
/**
* The color DarkTurquoise
**/
public static final Color DarkTurquoise = Color.decode("#00CED1");
/**
* The color DarkSeaGreen
**/
public static final Color DarkSeaGreen = Color.decode("#8FBC8F");
/**
* The color GreenYellow
**/
public static final Color GreenYellow = Color.decode("#ADFF2F");
/**
* The color MediumAquamarine
**/
public static final Color MediumAquamarine = Color.decode("#66CDAA");
/**
* The color MediumTurquoise
**/
public static final Color MediumTurquoise = Color.decode("#48D1CC");
/**
* The color Turquoise
**/
public static final Color Turquoise = Color.decode("#40E0D0");
/**
* The color LightGreen
**/
public static final Color LightGreen = Color.decode("#90EE90");
/**
* The color PaleGreen
**/
public static final Color PaleGreen = Color.decode("#98FB98");
/**
* The color Aquamarine
**/
public static final Color Aquamarine = Color.decode("#7FFFD4");
/**
* The color PaleTurquoise
**/
public static final Color PaleTurquoise = Color.decode("#AFEEEE");
}
public static class Oranges
{
/**
* The color OrangeRed
**/
public static final Color OrangeRed = Color.decode("#FF4500");
/**
* The color DarkOrange
**/
public static final Color DarkOrange = Color.decode("#FF8C00");
/**
* The color Orange
**/
public static final Color Orange = Color.decode("#FFA500");
/**
* The color Tomato
**/
public static final Color Tomato = Color.decode("#FF6347");
/**
* The color Coral
**/
public static final Color Coral = Color.decode("#FF7F50");
/**
* The color LightSalmon
**/
public static final Color LightSalmon = Color.decode("#FFA07A");
}
public static class Pinks
{
/**
* The color MediumVioletRed
**/
public static final Color MediumVioletRed = Color.decode("#C71585");
/**
* The color DeepPink
**/
public static final Color DeepPink = Color.decode("#FF1493");
/**
* The color PaleVioletRed
**/
public static final Color PaleVioletRed = Color.decode("#DB7093");
/**
* The color Fuchsia
**/
public static final Color Fuchsia = Color.decode("#FF00FF");
/**
* The color HotPink
**/
public static final Color HotPink = Color.decode("#FF69B4");
/**
* The color LightPink
**/
public static final Color LightPink = Color.decode("#FFB6C1");
/**
* The color Pink
**/
public static final Color Pink = Color.decode("#FFC0CB");
}
public static class Purples
{
/**
* The color Indigo
**/
public static final Color Indigo = Color.decode("#4B0082");
/**
* The color Purple
**/
public static final Color Purple = Color.decode("#800080");
/**
* The color DarkSlateBlue
**/
public static final Color DarkSlateBlue = Color.decode("#483D8B");
/**
* The color DarkMagenta
**/
public static final Color DarkMagenta = Color.decode("#8B008B");
/**
* The color MediumVioletRed
**/
public static final Color MediumVioletRed = Color.decode("#C71585");
/**
* The color DarkViolet
**/
public static final Color DarkViolet = Color.decode("#9400D3");
/**
* The color SlateBlue
**/
public static final Color SlateBlue = Color.decode("#6A5ACD");
/**
* The color BlueViolet
**/
public static final Color BlueViolet = Color.decode("#8A2BE2");
/**
* The color DarkOrchid
**/
public static final Color DarkOrchid = Color.decode("#9932CC");
/**
* The color MediumSlateBlue
**/
public static final Color MediumSlateBlue = Color.decode("#7B68EE");
/**
* The color RosyBrown
**/
public static final Color RosyBrown = Color.decode("#BC8F8F");
/**
* The color MediumPurple
**/
public static final Color MediumPurple = Color.decode("#9370DB");
/**
* The color PaleVioletRed
**/
public static final Color PaleVioletRed = Color.decode("#DB7093");
/**
* The color MediumOrchid
**/
public static final Color MediumOrchid = Color.decode("#BA55D3");
/**
* The color Fuchsia
**/
public static final Color Fuchsia = Color.decode("#FF00FF");
/**
* The color Magenta
**/
public static final Color Magenta = Color.decode("#FF00FF");
/**
* The color Orchid
**/
public static final Color Orchid = Color.decode("#DA70D6");
/**
* The color Plum
**/
public static final Color Plum = Color.decode("#DDA0DD");
/**
* The color Violet
**/
public static final Color Violet = Color.decode("#EE82EE");
/**
* The color Thistle
**/
public static final Color Thistle = Color.decode("#D8BFD8");
/**
* The color Lavender
**/
public static final Color Lavender = Color.decode("#E6E6FA");
}
public static class Reds
{
/**
* The color DarkRed
**/
public static final Color DarkRed = Color.decode("#8B0000");
/**
* The color FireBrick
**/
public static final Color FireBrick = Color.decode("#B22222");
/**
* The color Red
**/
public static final Color Red = Color.decode("#FF0000");
/**
* The color Crimson
**/
public static final Color Crimson = Color.decode("#DC143C");
/**
* The color OrangeRed
**/
public static final Color OrangeRed = Color.decode("#FF4500");
/**
* The color MediumVioletRed
**/
public static final Color MediumVioletRed = Color.decode("#C71585");
/**
* The color IndianRed
**/
public static final Color IndianRed = Color.decode("#CD5C5C");
/**
* The color Tomato
**/
public static final Color Tomato = Color.decode("#FF6347");
/**
* The color PaleVioletRed
**/
public static final Color PaleVioletRed = Color.decode("#DB7093");
/**
* The color Salmon
**/
public static final Color Salmon = Color.decode("#FA8072");
/**
* The color LightCoral
**/
public static final Color LightCoral = Color.decode("#F08080");
/**
* The color DarkSalmon
**/
public static final Color DarkSalmon = Color.decode("#E9967A");
/**
* The color LightSalmon
**/
public static final Color LightSalmon = Color.decode("#FFA07A");
}
public static class Whites
{
/**
* The color AntiqueWhite
**/
public static final Color AntiqueWhite = Color.decode("#FAEBD7");
/**
* The color MistyRose
**/
public static final Color MistyRose = Color.decode("#FFE4E1");
/**
* The color Beige
**/
public static final Color Beige = Color.decode("#F5F5DC");
/**
* The color Linen
**/
public static final Color Linen = Color.decode("#FAF0E6");
/**
* The color OldLace
**/
public static final Color OldLace = Color.decode("#FDF5E6");
/**
* The color Honeydew
**/
public static final Color Honeydew = Color.decode("#F0FFF0");
/**
* The color WhiteSmoke
**/
public static final Color WhiteSmoke = Color.decode("#F5F5F5");
/**
* The color Seashell
**/
public static final Color Seashell = Color.decode("#FFF5EE");
/**
* The color LavenderBlush
**/
public static final Color LavenderBlush = Color.decode("#FFF0F5");
/**
* The color AliceBlue
**/
public static final Color AliceBlue = Color.decode("#F0F8FF");
/**
* The color FloralWhite
**/
public static final Color FloralWhite = Color.decode("#FFFAF0");
/**
* The color MintCream
**/
public static final Color MintCream = Color.decode("#F5FFFA");
/**
* The color Azure
**/
public static final Color Azure = Color.decode("#F0FFFF");
/**
* The color Ivory
**/
public static final Color Ivory = Color.decode("#FFFFF0");
/**
* The color GhostWhite
**/
public static final Color GhostWhite = Color.decode("#F8F8FF");
/**
* The color Snow
**/
public static final Color Snow = Color.decode("#FFFAFA");
/**
* The color White
**/
public static final Color White = Color.decode("#FFFFFF");
}
public static class Yellows
{
/**
* The color DarkGoldenrod
**/
public static final Color DarkGoldenrod = Color.decode("#B8860B");
/**
* The color Goldenrod
**/
public static final Color Goldenrod = Color.decode("#DAA520");
/**
* The color Gold
**/
public static final Color Gold = Color.decode("#FFD700");
/**
* The color DarkKhaki
**/
public static final Color DarkKhaki = Color.decode("#BDB76B");
/**
* The color Yellow
**/
public static final Color Yellow = Color.decode("#FFFF00");
/**
* The color Khaki
**/
public static final Color Khaki = Color.decode("#F0E68C");
/**
* The color PaleGoldenrod
**/
public static final Color PaleGoldenrod = Color.decode("#EEE8AA");
/**
* The color PeachPuff
**/
public static final Color PeachPuff = Color.decode("#FFDAB9");
/**
* The color Moccasin
**/
public static final Color Moccasin = Color.decode("#FFE4B5");
/**
* The color PapayaWhip
**/
public static final Color PapayaWhip = Color.decode("#FFEFD5");
/**
* The color LemonChiffon
**/
public static final Color LemonChiffon = Color.decode("#FFFACD");
/**
* The color LightGoldenrodYellow
**/
public static final Color LightGoldenrodYellow = Color.decode("#FAFAD2");
/**
* The color LightYellow
**/
public static final Color LightYellow = Color.decode("#FFFFE0");
}
private static Random RANDOM = new Random();
public static Color darken(Color color)
{
int red = decrease(color.getRed(), 10);
int green = decrease(color.getGreen(), 10);
int blue = decrease(color.getBlue(), 10);
return new Color(red, green, blue);
}
private static int decrease(int amount, int decreaseBy)
{
return Math.max(0, amount - decreaseBy);
}
public static Color lighten(Color color)
{
int red = increase(color.getRed(), 10);
int green = increase(color.getGreen(), 10);
int blue = increase(color.getBlue(), 10);
return new Color(red, green, blue);
}
private static int increase(int amount, int increaseBy)
{
return Math.min(255, amount + increaseBy);
}
public static Color getRandomColor()
{
return new Color(RANDOM.nextInt(255), RANDOM.nextInt(255), RANDOM.nextInt(255));
}
public static void mockRandom()
{
RANDOM.setSeed(5);
}
public static int calculateTransparency(int percentTransparent)
{
int opacity = (percentTransparent * 255) / 100;
return (255 - opacity);
}
public static Color getTransparentVersion(Color color, int percentTransparency)
{
return new Color(color.getRed(), color.getGreen(), color.getBlue(),
calculateTransparency(percentTransparency));
}
}