Class GssFunctions
- java.lang.Object
-
- com.google.common.css.compiler.gssfunctions.GssFunctions
-
public class GssFunctions extends java.lang.ObjectContainer for common GSS functions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGssFunctions.AddHsbToCssColorImplementation of the addHsbToCssColor GSS function.static classGssFunctions.AddToNumericValueThe "add()" function adds a list of numeric values.static classGssFunctions.AdjustBrightnessImplementation of the adjustBrightness GSS function.static classGssFunctions.BaseBlendColorsBase implementation of the color blending GSS function.static classGssFunctions.BaseHslColorManipulationAbstract base class providing HSL color space manipulation functions.static classGssFunctions.BlendColorsHsbImplementation of the blendColorsHsb GSS function.static classGssFunctions.BlendColorsRgbImplementation of the blendColorsRgb GSS function.static classGssFunctions.ConcatImplementation of the concat(…) GssFunction.static classGssFunctions.DarkenDecrease the lightness of a color.static classGssFunctions.DesaturateColorDecrease the saturation of the specified color.static classGssFunctions.DivAGssFunctionthat returns the quotient of its arguments.static classGssFunctions.GreyscaleConvert the color to a grayscale (desaturation with amount of 100).static classGssFunctions.LightenIncrease the lightness of a color.static classGssFunctions.MakeContrastingColorThe "makeContrastingColor" function generates a contrasting color with the same hue as the input color.static classGssFunctions.MakeMutedColorImplementation of the makeMutedColor GSS function.static classGssFunctions.MakeTranslucentTakes an input color and sets its alpha component without affecting the RGB components.static classGssFunctions.MaxValueAGssFunctionthat returns the max value from its list of arguments.static classGssFunctions.MinValueAGssFunctionthat returns the min value from its list of arguments.static classGssFunctions.MultAGssFunctionthat returns the product of its arguments.static classGssFunctions.SaturateColorIncrease the saturation of the specified color.static classGssFunctions.SelectFromAllows the equivalent of the ternary operator in GSS, using three@defstatements as inputs.static classGssFunctions.SpinIncrease or decrease the hue of a color.static classGssFunctions.SubtractFromNumericValueThe "sub()" function subtracts a list of numeric values.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringMUST_BE_NUMERICstatic java.lang.StringTRANSPARENT
-
Constructor Summary
Constructors Constructor Description GssFunctions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidassertArgumentLooksLikeAColor(int argOrdinal, CssValueNode argValue, ErrorManager errorManager)Verify a function argument looks like a color node.static java.lang.StringcreateUrl(java.lang.String url)Helper method for implementors of GssFunction to allow the creation of a url string in the GSS.static CssFunctionNodecreateUrlNode(java.lang.String imageUrl, SourceCodeLocation location)Helper method for implementors of GssFunction to allow the creation of a url entry node in a GSS file.static GssFunctionExceptionerror(CssValueNode node, java.lang.String errorMessage, ErrorManager errorManager)static java.util.Map<java.lang.String,GssFunction>getFunctionMap()static booleanparseBoolean(java.lang.String numericPart)Helper method to convert a numeric value of "0" or "1" into a boolean.
-
-
-
Field Detail
-
TRANSPARENT
public static final java.lang.String TRANSPARENT
- See Also:
- Constant Field Values
-
MUST_BE_NUMERIC
public static final java.lang.String MUST_BE_NUMERIC
- See Also:
- Constant Field Values
-
-
Method Detail
-
getFunctionMap
public static java.util.Map<java.lang.String,GssFunction> getFunctionMap()
- Returns:
- a map from each GSS function name to the function
-
parseBoolean
public static boolean parseBoolean(java.lang.String numericPart)
Helper method to convert a numeric value of "0" or "1" into a boolean.- Parameters:
numericPart- The string containing the value- Returns:
- The corresponding boolean value
-
createUrlNode
public static CssFunctionNode createUrlNode(java.lang.String imageUrl, SourceCodeLocation location)
Helper method for implementors of GssFunction to allow the creation of a url entry node in a GSS file.- Parameters:
imageUrl- The url of the image to add.location- The location in the GSS file to place the node.- Returns:
- The node containing the url entry.
-
assertArgumentLooksLikeAColor
public static void assertArgumentLooksLikeAColor(int argOrdinal, CssValueNode argValue, ErrorManager errorManager) throws GssFunctionExceptionVerify a function argument looks like a color node.- Throws:
GssFunctionException
-
error
public static GssFunctionException error(CssValueNode node, java.lang.String errorMessage, ErrorManager errorManager)
-
createUrl
public static java.lang.String createUrl(java.lang.String url)
Helper method for implementors of GssFunction to allow the creation of a url string in the GSS.- Parameters:
url- The url of the image to add.- Returns:
- The proper GSS url string.
-
-