Computes statistical values about the specified factor(s) from the passedin collection.
The properties from each returned factor object are:
against - The color being used for comparison. Required for the distance and contrast factors.
If relativeMean is false, other factors that take the comparison color token as an overload (contrast | distance) will have this property's value as null.
colorspace - The colorspace in which the factors were computed in. It has no effect on the contrast or distance factors (for now).
extremums - An array of the minimum and the maximum value (respectively) of the factor.
colors - An array of color tokens that have the minimum and maximum extremum values respectively.
mean - The average value for the factor.
The mean property can be overloaded by the relativeMean option:
If relativeMean is true, the against option will be used as a subtrahend for calculating the distance between each extremum.
For example, it will mean "Get the largest/smallest distance between factor as compared against this color token otherwise just get the smallest/largest factor from the passed in collection."
These properties are available at the topmost level of the resultant object:
achromatic - The amount of colors which are gray out of the total colors in the collection as a value in the range [0,1].
colorspace - The colorspace in which the values were computed from, expected to be hue based.
Defaults to lch if an invalid mode like rgb is used.
The factor is expected to be an array of strings with each element being a valid factor. Every key is a factor, with the stats of that factor as the value in the result object.
To get all the factors in the result object pass undefined to factor.
Computes statistical values about the specified
factor(s)from the passedin collection.The properties from each returned
factorobject are:against- The color being used for comparison. Required for thedistanceandcontrastfactors. IfrelativeMeanisfalse, other factors that take the comparison color token as an overload (contrast | distance) will have this property's value asnull.colorspace- The colorspace in which thefactorswere computed in. It has no effect on thecontrastordistancefactors (for now).extremums- An array of the minimum and the maximum value (respectively) of thefactor.colors- An array of color tokens that have the minimum and maximumextremumvalues respectively.mean- The average value for thefactor.The
meanproperty can be overloaded by therelativeMeanoption:relativeMeanistrue, theagainstoption will be used as a subtrahend for calculating the distance between eachextremum. For example, it will mean "Get the largest/smallest distance betweenfactoras comparedagainstthis color token otherwise just get the smallest/largestfactorfrom the passed in collection."These properties are available at the topmost level of the resultant object:
achromatic- The amount of colors which are gray out of the total colors in the collection as a value in the range [0,1].colorspace- The colorspace in which the values were computed from, expected to be hue based. Defaults tolchif an invalid mode likergbis used.The
factoris expected to be an array of strings with each element being a validfactor. Every key is afactor, with the stats of thatfactoras the value in the result object.To get all the factors in the result object pass
undefinedtofactor.