(format: ColorFormat)
| 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. |