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 java.lang.Object implements GssFunction
Implementation of the addHsbToCssColor GSS function.
-
-
Constructor Summary
Constructors Constructor Description AddHsbToCssColor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringaddHsbToCssColor(java.lang.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 java.lang.StringaddHsbToCssColor(java.lang.String baseColorString, java.lang.String hueToAdd, java.lang.String saturationToAdd, java.lang.String brightnessToAdd)java.awt.ColoraddValuesToHsbComponents(java.awt.Color baseColor, int hueToAdd, int saturationToAdd, int brightnessToAdd)Adds the specified amount to the specified HSB (Hue, Saturation, Brightness) parameter of the given color.java.util.List<CssValueNode>getCallResultNodes(java.util.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.java.lang.StringgetCallResultString(java.util.List<java.lang.String> args)Processes a list of strings as function arguments and returns a string result.java.lang.IntegergetNumExpectedArguments()Returns the number of parsed arguments that this function takes, ornullif the number of arguments may vary.
-
-
-
Method Detail
-
getNumExpectedArguments
public java.lang.Integer 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 java.util.List<CssValueNode> getCallResultNodes(java.util.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
public java.lang.String getCallResultString(java.util.List<java.lang.String> args) throws GssFunctionExceptionDescription 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 java.lang.String addHsbToCssColor(java.lang.String baseColorString, java.lang.String hueToAdd, java.lang.String saturationToAdd, java.lang.String brightnessToAdd) throws GssFunctionException- Throws:
GssFunctionException
-
addHsbToCssColor
public java.lang.String addHsbToCssColor(java.lang.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 java.awt.Color addValuesToHsbComponents(java.awt.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
-
-