* Create a color from a string * @param {string} color
(color)
| 19 | * @param {string} color |
| 20 | */ |
| 21 | constructor(color) { |
| 22 | const { canvas } = ctx; |
| 23 | ctx.clearRect(0, 0, canvas.width, canvas.height); |
| 24 | ctx.fillStyle = color; |
| 25 | ctx.fillRect(0, 0, 1, 1); |
| 26 | const [r, g, b, a] = ctx.getImageData(0, 0, 1, 1).data; |
| 27 | this.rgb = new Rgb(r, g, b, a / 255); |
| 28 | } |
| 29 | |
| 30 | darken(ratio) { |
| 31 | const hsl = Hsl.fromRgb(this.rgb); |
nothing calls this directly
no outgoing calls
no test coverage detected