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

Method toString

src/utils/color/rgb.js:19–26  ·  view source on GitHub ↗

* Get the color as a string * @param {boolean} alpha Whether to include alpha channel * @returns

(alpha)

Source from the content-addressed store, hash-verified

17 * @returns
18 */
19 toString(alpha) {
20 const rgb = () => `rgb(${this.r}, ${this.g}, ${this.b})`;
21 const rgba = () => `rgba(${this.r}, ${this.g}, ${this.b}, ${this.a})`;
22 if (alpha === undefined) {
23 return this.a === 1 ? rgb() : rgba();
24 }
25 return alpha ? rgba() : rgb();
26 }
27}

Callers

nothing calls this directly

Calls 2

rgbFunction · 0.85
rgbaFunction · 0.85

Tested by

no test coverage detected