Class GssFunctions.AdjustBrightness

  • All Implemented Interfaces:
    GssFunction
    Enclosing class:
    GssFunctions

    public static class GssFunctions.AdjustBrightness
    extends java.lang.Object
    implements GssFunction
    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 Detail

      • AdjustBrightness

        public AdjustBrightness()
    • Method Detail

      • getNumExpectedArguments

        public java.lang.Integer getNumExpectedArguments()
        Returns the number of expected arguments of this GSS function.
        Specified by:
        getNumExpectedArguments in interface GssFunction
        Returns:
        Number of expected arguments
      • adjustBrightness

        protected java.lang.String adjustBrightness​(java.lang.String originalColorStr,
                                                    java.lang.String brightnessStr)
      • getCallResultString

        public java.lang.String getCallResultString​(java.util.List<java.lang.String> args)
        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