Skip to content

[🚀 Feature]: JavaScript bindings: Add Color utility similar to Java Color class #16845

Description

@BckupMuthu

Description

Problem

Selenium Java provides a org.openqa.selenium.support.Color utility that helps
parse and normalize CSS color values (rgb, rgba, hex, named colors).

The JavaScript bindings currently return raw CSS values (e.g. rgba(255, 0, 0, 1))
from getCssValue, but do not provide an equivalent color utility for parsing or
conversion. This creates an inconsistency across language bindings and forces
users to rely on custom parsing or third-party libraries.

Why this is useful

  • UI / visual style assertions are common in Selenium tests
  • Normalizing CSS colors improves cross-browser consistency
  • Parity with Java bindings improves developer experience

Proposed direction (high level)

Introduce a small, public Color utility in the JavaScript bindings that focuses on:

  • Parsing CSS color strings
  • Converting between formats (hex, rgb, rgba)

No advanced color operations are proposed at this stage.

Reference

Java implementation:
org.openqa.selenium.support.Color

Have you considered any alternatives or workarounds?

Yes. In JavaScript, users typically either:

  • Manually parse CSS color strings returned by getCssValue(), or
  • Rely on third-party libraries (e.g. small color parsing utilities) to normalize colors.

While these approaches work, they add extra dependencies or duplicated logic in test
code. Providing a minimal built-in utility would improve consistency and bring the
JavaScript bindings closer to feature parity with Selenium’s Java bindings.

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions