Class HSSFExtendedColor

  • All Implemented Interfaces:
    Color

    public class HSSFExtendedColor
    extends ExtendedColor
    The HSSF file format normally stores Color information in the Palette (see PaletteRecord), but for a few cases (eg Conditional Formatting, Sheet Extensions), this XSSF-style color record can be used.
    • Constructor Detail

      • HSSFExtendedColor

        public HSSFExtendedColor​(ExtendedColor color)
    • Method Detail

      • isAuto

        public boolean isAuto()
        Specified by:
        isAuto in class ExtendedColor
        Returns:
        true if the color is automatic
      • isIndexed

        public boolean isIndexed()
        Specified by:
        isIndexed in class ExtendedColor
        Returns:
        true if the color is indexed
      • isRGB

        public boolean isRGB()
        Specified by:
        isRGB in class ExtendedColor
        Returns:
        true if the color is RGB / ARGB
      • isThemed

        public boolean isThemed()
        Specified by:
        isThemed in class ExtendedColor
        Returns:
        true if the color is from a Theme
      • getRGB

        public byte[] getRGB()
        Specified by:
        getRGB in class ExtendedColor
        Returns:
        Standard Red Green Blue ctColor value (RGB) bytes. If there was an A (Alpha) value, it will be stripped.
      • getARGB

        public byte[] getARGB()
        Specified by:
        getARGB in class ExtendedColor
        Returns:
        Standard Alpha Red Green Blue ctColor value (ARGB) bytes.
      • setRGB

        public void setRGB​(byte[] rgb)
        Description copied from class: ExtendedColor
        Sets the Red Green Blue or Alpha Red Green Blue
        Specified by:
        setRGB in class ExtendedColor
        Parameters:
        rgb - bytes
      • getTint

        public double getTint()
        Description copied from class: ExtendedColor
        Specifies the tint value applied to the ctColor.

        If tint is supplied, then it is applied to the RGB value of the ctColor to determine the final ctColor applied.

        The tint value is stored as a double from -1.0 .. 1.0, where -1.0 means 100% darken and 1.0 means 100% lighten. Also, 0.0 means no change.

        In loading the RGB value, it is converted to HLS where HLS values are (0..HLSMAX), where HLSMAX is currently 255.

        Here are some examples of how to apply tint to ctColor:
         If (tint < 0)
         Lum' = Lum * (1.0 + tint)
        
         For example: Lum = 200; tint = -0.5; Darken 50%
         Lum' = 200 * (0.5) => 100
         For example: Lum = 200; tint = -1.0; Darken 100% (make black)
         Lum' = 200 * (1.0-1.0) => 0
         If (tint > 0)
         Lum' = Lum * (1.0-tint) + (HLSMAX - HLSMAX * (1.0-tint))
         For example: Lum = 100; tint = 0.75; Lighten 75%
        
         Lum' = 100 * (1-.75) + (HLSMAX - HLSMAX*(1-.75))
         = 100 * .25 + (255 - 255 * .25)
         = 25 + (255 - 63) = 25 + 192 = 217
         For example: Lum = 100; tint = 1.0; Lighten 100% (make white)
         Lum' = 100 * (1-1) + (HLSMAX - HLSMAX*(1-1))
         = 100 * 0 + (255 - 255 * 0)
         = 0 + (255 - 0) = 255
         
        Specified by:
        getTint in class ExtendedColor
        Returns:
        the tint value
      • setTint

        public void setTint​(double tint)
        Description copied from class: ExtendedColor
        Specifies the tint value applied to the ctColor.

        If tint is supplied, then it is applied to the RGB value of the ctColor to determine the final ctColor applied.

        The tint value is stored as a double from -1.0 .. 1.0, where -1.0 means 100% darken and 1.0 means 100% lighten. Also, 0.0 means no change.

        In loading the RGB value, it is converted to HLS where HLS values are (0..HLSMAX), where HLSMAX is currently 255.

        Here are some examples of how to apply tint to ctColor:
         If (tint < 0)
         Lum' = Lum * (1.0 + tint)
        
         For example: Lum = 200; tint = -0.5; Darken 50%
         Lum' = 200 * (0.5) => 100
         For example: Lum = 200; tint = -1.0; Darken 100% (make black)
         Lum' = 200 * (1.0-1.0) => 0
         If (tint > 0)
         Lum' = Lum * (1.0-tint) + (HLSMAX - HLSMAX * (1.0-tint))
         For example: Lum = 100; tint = 0.75; Lighten 75%
        
         Lum' = 100 * (1-.75) + (HLSMAX - HLSMAX*(1-.75))
         = 100 * .25 + (255 - 255 * .25)
         = 25 + (255 - 63) = 25 + 192 = 217
         For example: Lum = 100; tint = 1.0; Lighten 100% (make white)
         Lum' = 100 * (1-1) + (HLSMAX - HLSMAX*(1-1))
         = 100 * 0 + (255 - 255 * 0)
         = 0 + (255 - 0) = 255
         
        Specified by:
        setTint in class ExtendedColor
        Parameters:
        tint - the tint value