Class GssFunctions.AddHsbToCssColor

java.lang.Object
com.google.common.css.compiler.gssfunctions.GssFunctions.AddHsbToCssColor
All Implemented Interfaces:
GssFunction
Enclosing class:
GssFunctions

public static class GssFunctions.AddHsbToCssColor extends Object implements GssFunction
Implementation of the addHsbToCssColor GSS function.
  • Constructor Details

    • AddHsbToCssColor

      public AddHsbToCssColor()
  • Method Details

    • getNumExpectedArguments

      public Integer getNumExpectedArguments()
      Description copied from interface: GssFunction
      Returns the number of parsed arguments that this function takes, or null if the number of arguments may vary.
      Specified by:
      getNumExpectedArguments in interface GssFunction
    • getCallResultNodes

      public List<CssValueNode> getCallResultNodes(List<CssValueNode> args, ErrorManager errorManager) throws GssFunctionException
      Description copied from interface: GssFunction
      Processes a list of function call arguments and returns a list of CssNodes representing this call's output, which replace the input nodes in the AST. Errors will be reported to the ErrorManager.
      Specified by:
      getCallResultNodes in interface GssFunction
      Throws:
      GssFunctionException
    • getCallResultString

      public String getCallResultString(List<String> args) throws GssFunctionException
      Description copied from interface: GssFunction
      Processes a list of strings as function arguments and returns a string result. Errors are reported by throwing GssFunctionException.
      Specified by:
      getCallResultString in interface GssFunction
      Throws:
      GssFunctionException
    • addHsbToCssColor

      protected String addHsbToCssColor(String baseColorString, String hueToAdd, String saturationToAdd, String brightnessToAdd) throws GssFunctionException
      Throws:
      GssFunctionException
    • addHsbToCssColor

      public String addHsbToCssColor(String baseColorString, int hueToAdd, int saturationToAdd, int brightnessToAdd)
      Takes a CSS color string, and adds the specified amount of hue, saturation and brightness to it.
      Parameters:
      baseColorString - The string representing the color to change
      hueToAdd - The amount of hue to add (can be negative)
      saturationToAdd - The amount of saturation to add (can be negative)
      brightnessToAdd - The amount of brightness to add (can be negative)
      Returns:
      A CSS String representing the new color
    • addValuesToHsbComponents

      public Color addValuesToHsbComponents(Color baseColor, int hueToAdd, int saturationToAdd, int brightnessToAdd)
      Adds the specified amount to the specified HSB (Hue, Saturation, Brightness) parameter of the given color. The amount can be negative.
      Parameters:
      baseColor - The color to modify
      hueToAdd - The amount of hue to add
      saturationToAdd - The amount of saturation to add
      brightnessToAdd - The amount of brightness to add
      Returns:
      The modified color