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