MCPcopy Create free account
hub / github.com/adobe/react-spectrum / formatChannelValue

Method formatChannelValue

packages/react-stately/src/color/Color.ts:772–779  ·  view source on GitHub ↗
(channel: ColorChannel, locale: string)

Source from the content-addressed store, hash-verified

770 }
771
772 formatChannelValue(channel: ColorChannel, locale: string) {
773 let options = this.getChannelFormatOptions(channel);
774 let value = this.getChannelValue(channel);
775 if (channel === 'saturation' || channel === 'lightness') {
776 value /= 100;
777 }
778 return new NumberFormatter(locale, options).format(value);
779 }
780
781 getColorSpace(): ColorSpace {
782 return 'hsl';

Callers

nothing calls this directly

Calls 3

getChannelValueMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected