MCPcopy
hub / github.com/adobe/react-spectrum / toFormat

Method toFormat

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

Source from the content-addressed store, hash-verified

679 }
680 }
681 toFormat(format: ColorFormat): IColor {
682 switch (format) {
683 case 'hsl':
684 case 'hsla':
685 return this;
686 case 'hsb':
687 case 'hsba':
688 return this.toHSB();
689 case 'rgb':
690 case 'rgba':
691 return this.toRGB();
692 default:
693 throw new Error('Unsupported color conversion: hsl -> ' + format);
694 }
695 }
696
697 /**
698 * 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