Namespace EasyXLS.Themes

Class ThemeColor


  • public class ThemeColor
    extends System.Object
    This class stores a theme color. Each theme has a set of colors. A theme is based on a set of 12 colors. Those colors are the basic colors from this class, except for the last two colors. The ThemeColor class stores only the index to the colors. The actual colors are defined in the ExcelColorScheme of the ExcelTheme class. Each basic color is altered darker or lighter. So each basic color generates another 5 altered colors.
    • Constructor Summary

      Constructors 
      Constructor Description
      ThemeColor()
      Defines a theme color.
      ThemeColor​(int basicColor)
      Defines a theme color that is one of the basic colors.
      ThemeColor​(int basicColor, double tint)
      Internal use only.
      ThemeColor​(int basicColor, int alterColorIndex)
      Defines a theme color that is altered from one of the basic colors.
      ThemeColor​(int basicColor, int lumModulation, int lumOffset)
      Internal use only.
    • Method Summary

      Modifier and Type Method Description
      int getBasicColor()
      Returns the index of the basic color.
      System.Drawing.Color getColorForTheme​(ExcelTheme xlsTheme)
      Returns the actual color for the specified theme.
      int getLuminanceModulation()
      Returns the luminance modulation of the color.
      int getLuminanceOffset()
      Returns the luminance offset of the color.
      double getTint()
      Returns the percent of color alteration.
      bool IsEqual​(ThemeColor themeColor)
      Compares two theme colors.
      void setBasicColor​(int basicColor)
      Sets the color of the theme, color that is one of the basic colors.
      void setColor​(int basicColor, int alterColorIndex)
      Sets the color of the theme, color that is altered from one of the basic colors.
    • Constructor Detail

      • ThemeColor

        public ThemeColor()
        Defines a theme color.
      • ThemeColor

        public ThemeColor​(int basicColor)
        Defines a theme color that is one of the basic colors.
        Parameters:
        basicColor - the index of one of the 10 basic colors.
      • ThemeColor

        public ThemeColor​(int basicColor,
                          int alterColorIndex)
        Defines a theme color that is altered from one of the basic colors.
        Parameters:
        basicColor - the index of one of the 10 basic colors.
        alterColorIndex - the index of alteration.
      • ThemeColor

        public ThemeColor​(int basicColor,
                          double tint)
        Internal use only. Defines a theme color that is altered from one of the basic colors.
        Parameters:
        basicColor - the index of one of the 12 basic colors.
        tint - the percent of alteration. It must be a number between -1 and +1.
      • ThemeColor

        public ThemeColor​(int basicColor,
                          int lumModulation,
                          int lumOffset)
        Internal use only. Defines a theme color that is altered from one of the basic colors.
        Parameters:
        lumModulation - Luminance Modulation. This element specifies the input color with its luminance modulated by the given percentage.
        lumOffset - Luminance Offset. This element specifies the input color with its luminance shifted, but with its hue and saturation unchanged
    • Method Detail

      • setColor

        public void setColor​(int basicColor,
                             int alterColorIndex)
        Sets the color of the theme, color that is altered from one of the basic colors.
        Parameters:
        basicColor - the index of one of the 10 basic colors.
        alterColorIndex - the index of alteration.
      • setBasicColor

        public void setBasicColor​(int basicColor)
        Sets the color of the theme, color that is one of the basic colors.
        Parameters:
        basicColor - the index of one of the 10 basic colors.
        See Also:
        getBasicColor(), setColor(int, int)
      • getTint

        public double getTint()
        Returns the percent of color alteration.
        Returns:
        the percent of color alteration
        See Also:
        setColor(int, int)
      • getLuminanceModulation

        public int getLuminanceModulation()
        Returns the luminance modulation of the color.
        Returns:
        the luminance modulation of the color
      • getLuminanceOffset

        public int getLuminanceOffset()
        Returns the luminance offset of the color.
        Returns:
        the luminance offset of the color
      • IsEqual

        public bool IsEqual​(ThemeColor themeColor)
        Compares two theme colors.
        Parameters:
        themeColor - the color that will be compared to
        Returns:
        true if the colors are the same
      • getColorForTheme

        public System.Drawing.Color getColorForTheme​(ExcelTheme xlsTheme)
        Returns the actual color for the specified theme.
        Parameters:
        xlsTheme - the theme for which the theme color is returned
        Returns:
        the color for the specified theme
        See Also:
        setColor(int, int)