Class GssFunctions.AddHsbToCssColor
java.lang.Object
com.google.common.css.compiler.gssfunctions.GssFunctions.AddHsbToCssColor
- All Implemented Interfaces:
GssFunction
- Enclosing class:
- GssFunctions
Implementation of the addHsbToCssColor GSS function.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddHsbToCssColor(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.protected StringaddHsbToCssColor(String baseColorString, String hueToAdd, String saturationToAdd, String brightnessToAdd) 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.getCallResultNodes(List<CssValueNode> args, ErrorManager errorManager) 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.getCallResultString(List<String> args) Processes a list of strings as function arguments and returns a string result.Returns the number of parsed arguments that this function takes, ornullif the number of arguments may vary.
-
Constructor Details
-
AddHsbToCssColor
public AddHsbToCssColor()
-
-
Method Details
-
getNumExpectedArguments
Description copied from interface:GssFunctionReturns the number of parsed arguments that this function takes, ornullif the number of arguments may vary.- Specified by:
getNumExpectedArgumentsin interfaceGssFunction
-
getCallResultNodes
public List<CssValueNode> getCallResultNodes(List<CssValueNode> args, ErrorManager errorManager) throws GssFunctionException Description copied from interface:GssFunctionProcesses 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:
getCallResultNodesin interfaceGssFunction- Throws:
GssFunctionException
-
getCallResultString
Description copied from interface:GssFunctionProcesses a list of strings as function arguments and returns a string result. Errors are reported by throwingGssFunctionException.- Specified by:
getCallResultStringin interfaceGssFunction- 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 changehueToAdd- 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 modifyhueToAdd- The amount of hue to addsaturationToAdd- The amount of saturation to addbrightnessToAdd- The amount of brightness to add- Returns:
- The modified color
-