(format: ColorFormat | 'css' = 'css')
| 509 | } |
| 510 | |
| 511 | toString(format: ColorFormat | 'css' = 'css') { |
| 512 | switch (format) { |
| 513 | case 'css': |
| 514 | return this.toHSL().toString('css'); |
| 515 | case 'hex': |
| 516 | return this.toRGB().toString('hex'); |
| 517 | case 'hexa': |
| 518 | return this.toRGB().toString('hexa'); |
| 519 | case 'hsb': |
| 520 | return `hsb(${this.hue}, ${toFixedNumber(this.saturation, 2)}%, ${toFixedNumber(this.brightness, 2)}%)`; |
| 521 | case 'hsba': |
| 522 | return `hsba(${this.hue}, ${toFixedNumber(this.saturation, 2)}%, ${toFixedNumber(this.brightness, 2)}%, ${this.alpha})`; |
| 523 | default: |
| 524 | return this.toFormat(format).toString(format); |
| 525 | } |
| 526 | } |
| 527 | |
| 528 | toFormat(format: ColorFormat): IColor { |
| 529 | switch (format) { |
nothing calls this directly
no test coverage detected