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

Method toFormat

packages/react-stately/src/color/Color.ts:685–699  ·  view source on GitHub ↗
(format: ColorFormat)

Source from the content-addressed store, hash-verified

683 }
684 }
685 toFormat(format: ColorFormat): IColor {
686 switch (format) {
687 case 'hsl':
688 case 'hsla':
689 return this;
690 case 'hsb':
691 case 'hsba':
692 return this.toHSB();
693 case 'rgb':
694 case 'rgba':
695 return this.toRGB();
696 default:
697 throw new Error('Unsupported color conversion: hsl -> ' + format);
698 }
699 }
700
701 /**
702 * Converts a HSL color to HSB.

Callers 1

toStringMethod · 0.95

Calls 2

toHSBMethod · 0.95
toRGBMethod · 0.95

Tested by

no test coverage detected