Class Color

java.lang.Object
com.github.miachm.sods.Color
All Implemented Interfaces:
Cloneable

public final class Color extends Object implements Cloneable
Color is a inmutable class for represent colors.
  • Constructor Details

    • Color

      public Color(int red, int green, int blue)
      It creates a color object from a RGB format (red, green, blue).
      Parameters:
      red - the red color intensity. It must be in a 0-255 range
      green - the green color intensity. It must be in a 0-255 range
      blue - the blue color intensity. It must be in a 0-255 range
    • Color

      public Color(String hexform)
      It creates a color object from a String representation (CSS Style). The first character is the hashtag '#' The next two characters are the red intensity in hex (ex: A4) The next two characters are the green intensity in hex (ex: 3B) The next two characters are the blue intensity in hex (ex: 53)
      Parameters:
      hexform - The string representation of the color. For example: "#A24C21"
      Throws:
      IllegalArgumentException - if the string hasn't 7 characters or is ill-formed
  • Method Details