(format: ColorFormat)
| 526 | } |
| 527 | |
| 528 | toFormat(format: ColorFormat): IColor { |
| 529 | switch (format) { |
| 530 | case 'hsb': |
| 531 | case 'hsba': |
| 532 | return this; |
| 533 | case 'hsl': |
| 534 | case 'hsla': |
| 535 | return this.toHSL(); |
| 536 | case 'rgb': |
| 537 | case 'rgba': |
| 538 | return this.toRGB(); |
| 539 | default: |
| 540 | throw new Error('Unsupported color conversion: hsb -> ' + format); |
| 541 | } |
| 542 | } |
| 543 | |
| 544 | /** |
| 545 | * Converts a HSB color to HSL. |