Java 2D Graphics Color

Java examples for 2D Graphics:Color


Click the following links for the tutorial for 2D Graphics and Color.

  1. Changing drawing colors.
  2. Drawing with Color
  3. Get Transparency Mode Of Color
  4. Set Graphics Color
  5. Drawing with a cyclic and non-cyclic Gradient Color
  6. get OpenGL Color
  7. calculate Color from primary and secondary color and ratio
  8. get Grey Color

  9. distance between two color
  10. get Color in Shape
  11. get Css Color
  12. returns a r g b a float array that openGL likes
  13. Gets a color composed of the specified channels.
  14. Returns the green channel of the color
  15. get Appointment Color
  16. Take the integer part of a number and put it in [0, 255] That is to say if integer<0, return 0.

  17. mix Colors
  18. random Color
  19. Color from AARRGGBB
  20. random Color and return Color value
  21. seeded Color
  22. towards Gray Color
  23. Return the "distance" between two colors.
  24. get Nice Colors
  25. add one color to another color
  26. Fills given rectangle using top-down gradient fill of specified colors
  27. get Color Hue
  28. distance between two Color value
  29. add Colors
  30. scale Color
  31. get Random Color Code
  32. Returns a Color for an object that is determined by the object's hash code.
  33. get Mixed Color
  34. blur Color
  35. Converts the colour to an integer value.
  36. get Background Color Random
  37. get Saturation
  38. adjust Color By
  39. adjust Color Components Towards
  40. adjust Color Towards by amount
  41. average Color Difference
  42. Get random color using Golden Ratio
  43. Computes an appropriate foreground color (either white or black) for the given background color.
  44. Returns a new color equal to the old one, except the saturation is set to the new value.
  45. Converts the given FX color to awt color.
  46. set Saturation
  47. merge Colors
  48. Creates a color that corresponds to the specified values.
  49. Extracts the green component from color .
  50. get Fraction Color
  51. convert To Binary Colors
  52. Gets the "distance" between two colors, returning between 0 and 255.
  53. Checks if two colors are within a tolerance.
  54. get Contrast Color
  55. parse Color
  56. distance of two color
  57. get Random Color
  58. are Colors Within Tolerance
  59. find All Color Within Tolerance
  60. find Color Within Tolerance
  61. Gets the "distance" between two colors, their components assumed to be points in 3D space ranging from 0.0 to 1.0.
  62. Converts a float value between 0f and 1f to an int value between 0 and 255
  63. get Random Color by base color
  64. average Color
  65. Bounds a color parameter to between 0 and 255 (both inclusive).
  66. format Color
  67. Computes the luminance difference of two colors (a value in range 0-255).
  68. Computes the luminance value of a color (a value in range 0-255).
  69. Tests whether the given colors are contrasting colors, according to the test described in the W3C accessibility evaluation working draft
  70. Color to Byte
  71. Finds the closest hue possible to given color.
  72. inverse Color
  73. Gets the java color corresponding to the given CSS color name.
  74. Mixes two colour by the provided percentages
  75. Shades a colour by the given amount (0-1).
  76. convert Color To Gray
  77. Computes cosine for some angle represented in degrees [0, 360].
  78. Calculates the hue component based on R,G,B
  79. get Randomized Maximum Contrast Color List
  80. different Color
  81. get Green from int color
  82. get Color Difference
  83. Multiplies each of component of colour with amount and divides the result by 256.
  84. Returns white or black text depending on the background.
  85. paint Gradient
  86. get Gradient Color
  87. get Opaque Mask
  88. brighter Color
  89. darker Color
  90. draw Gradient
  91. get Red Green Gradient
  92. get Red Green Gradient Html
  93. Converts a colour to it's RGB hex code
  94. set Alpha Value
  95. saturate Color
  96. Create a new ColorModel with it's alpha pre multiplied state
  97. Adds a Color argument to the drawChars method of java.awt.Graphics.
  98. Calls g.drawString(s, x, y) after setting the color to c.
  99. translucent Color
  100. Converts a string into a Color object.
  101. get String To Color Map
  102. Change Color Transparency
  103. random Bright Color
  104. make Transparent Color
  105. Blends two colors and returns the result
  106. Converts the color into a Hex representation suitable for HTML color attributes.
  107. Creates a copy of the given color with the specified transparency
  108. Checks whether the two colors are similar for a given tolerance (in the sense of a distance between the RGB values).
  109. Lighten up a color.
  110. Darken a color.
  111. Converts a color into a String like #RRGGBB.
  112. Converts a color into a String like "255,0,0,255" (red,green,blue,alpha).
  113. Converts a color into a String like 255,0,0.
  114. Compares the given color to the 12 main colors and returns the name (e.g.
  115. This is a weaker version of Color#brighter() Uses a factor closer to 1.
  116. Fades the color by multiplying the saturation value by 0.5 and the brightness by 1.3.
  117. Parses a hex color string (e.g. #FF0000 or FF0000)
  118. invert Color
  119. Attempts to convert the given string to a color.
  120. Creates a new brighter version of a color by blending it with white.
  121. Creates a new darker version of a color by blending it with black.
  122. get Color Steppers
  123. set Color Alpha
  124. Compute a color in between the two given colors
  125. Returns a mixed color from color c1 and c2.
  126. Paints border glow over the given clip Shape with the given glow high and low colors and the given glowWidth.
  127. Gets a color that "highlights" a given color.
  128. argb to Color
  129. Creates a new Color that is a brighter version of this Color.
  130. Creates a new color with the hue taken from color c, but adjusted in brightness to match the desired perceived brightness.
  131. Creates a new Color that is a darker version of this Color.
  132. Color To Integer
  133. Integer To Color
  134. Creates an array of color values.
  135. Creates a color object.
  136. Creates a color that is the darker version of the color parameter c.
  137. Returns a value between 0 and 255 which represents the gray value of the color parameter.
  138. Returns a color value which is the media between the colors c1 and c1
  139. Returns a gray version of the color parameter c, which means all parts (r,g,b) do have the same value.
  140. Snaps the color value within the byte range (0-255)
  141. Gets a related color, based on a factor amount.
  142. Computes several visually distinct colors such that they are equally spaced apart in the HSB color space.
  143. Based on the differences of hue and perceived brightness of foreground color foreground and background color bg, this method checks and possibly adjusts the given foreground color such that its hue stays unchanged, but its brightness is adapted to make it better perceivable on the background.
  144. This is a color's perceived brightness by the human eye
  145. This method can be used to retrieve a rectangular image filled with a continuous colour variation.
  146. Get the lightness associated to the given Color .
  147. Creates a new color definition based on hue (0-360), saturation (0-100), and relative value (0-100; usually 75-100).
  148. Helper to simplify creation of translucent colors