Class HexColorValue

    • Constructor Detail

      • HexColorValue

        public HexColorValue​(int line,
                             int column,
                             String color)
        Constructs a new instance of a HexColorValue.

        If dynamically creating a new instance then use HexColorValue(String) instead.

        Parameters:
        line - The line number.
        column - The column number.
        color - The hex color (do not include the #). Automatically lower-cased.
      • HexColorValue

        public HexColorValue​(String color)
        Constructs a new instance of a HexColorValue (used for dynamically created Syntax units).
        Parameters:
        color - The hex color (do not include the #).
      • HexColorValue

        public HexColorValue​(String color,
                             boolean lowerCaseAndNoHex)
        Constructs a new instance of a HexColorValue (used for dynamically created Syntax units). Only use this when you already know the string is lower-cased and doesn't start with a '#'.
        Parameters:
        color - The hex color (do not include the #).
        lowerCaseAndNoHex - Specifies whether the string is already lower-cased and doesn't start with a '#'.
    • Method Detail

      • color

        public HexColorValue color​(String color)
        Sets the value of the color (will be converted to lower-case).
        Parameters:
        color - The hex color (do not include the #). Automatically lower-cased.
        Returns:
        this, for chaining.
      • color

        public String color()
        Gets the color value (does not include the #).
        Returns:
        The color value.
      • isShorthand

        public boolean isShorthand()
        Gets whether this hex color is shorthand (has a length of three).
        Returns:
        True if the length of this color is 3.
      • textualValue

        public String textualValue()
        Gets the color value (does not include the #). Prefer to use color(), which is identical to this method.
        Returns:
        The color value.
      • of

        public static HexColorValue of​(String color)
        Creates a new HexColorValue instance using the given color (do not include the #).

        Example:

          HexColorValue.of("fffeee")
         
        Parameters:
        color - The color value. Automatically lower-cased.
        Returns:
        The new HexColorValue instance.