Class GssFunctions.AdjustBrightness
java.lang.Object
com.google.common.css.compiler.gssfunctions.GssFunctions.AdjustBrightness
- All Implemented Interfaces:
GssFunction
- Enclosing class:
- GssFunctions
Implementation of the adjustBrightness GSS function. This generates
a slightly differentiated color suitable for hover styling. Takes the
color to modify as the first argument, and the requested brightness
difference as a second argument (between 0 and 100). This function will
always ensure that the returned color is different from the input, e.g.
attempting to "brighten" white will return a light grey instead of white,
but if it isn't possible to find a color that matches the request
difference (e.g. asking to brighten by 100 from a medium bright color),
the returned value will be a color with a difference from the input color
as close as possible to what is being requested. See the unit test for
some examples.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringadjustBrightness(String originalColorStr, String brightnessStr) getCallResultNodes(List<CssValueNode> args, ErrorManager errorManager) Returns the hover color corresponding to the argument documented inGssFunctions.AdjustBrightness.getCallResultString(List<String> args) Processes a list of strings as function arguments and returns a string result.Returns the number of expected arguments of this GSS function.
-
Constructor Details
-
AdjustBrightness
public AdjustBrightness()
-
-
Method Details
-
getNumExpectedArguments
Returns the number of expected arguments of this GSS function.- Specified by:
getNumExpectedArgumentsin interfaceGssFunction- Returns:
- Number of expected arguments
-
getCallResultNodes
Returns the hover color corresponding to the argument documented inGssFunctions.AdjustBrightness.- Specified by:
getCallResultNodesin interfaceGssFunction- Parameters:
args- The list of arguments.- Returns:
- The generated hover color.
-
adjustBrightness
-
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
-