MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / fromString

Method fromString

javascript/selenium-webdriver/lib/color.js:43–60  ·  view source on GitHub ↗

* Guesses the input color format and returns a Color instance. * @param {string} value * @returns {Color}

(value)

Source from the content-addressed store, hash-verified

41 * @returns {Color}
42 */
43 static fromString(value) {
44 const v = String(value)
45 for (const conv of [
46 Color.#fromRgb,
47 Color.#fromRgbPct,
48 Color.#fromRgba,
49 Color.#fromRgbaPct,
50 Color.#fromHex6,
51 Color.#fromHex3,
52 Color.#fromHsl,
53 Color.#fromHsla,
54 Color.#fromNamed,
55 ]) {
56 const c = conv(v)
57 if (c) return c
58 }
59 throw new Error(`Did not know how to convert ${value} into color`)
60 }
61
62 /**
63 * Sets opacity (alpha channel).

Callers 1

color_test.jsFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected