MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / constructor

Method constructor

src/utils/color/index.js:21–28  ·  view source on GitHub ↗

* Create a color from a string * @param {string} color

(color)

Source from the content-addressed store, hash-verified

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);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected