HTML attribute: colorspace

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

The colorspace attribute, valid only on the type="color" <input> element, specifies which color space the element uses.

These attributes are enumerated, and have the following possible values:

  • "limited-srgb": The color is in the sRGB color space. This includes rgb(), hsl(), hwb(), and <hex-color> values. The color value is limited to 8-bits per r, g, and b component. This is the default.
  • "display-p3": The Display P3 color space, e.g., color(display-p3 1.84 -0.19 0.72 / 0.6)

Try it

<label for="rgb">Color input using RGB:</label>

<input
  type="color"
  id="rgb"
  name="rgb"
  colorspace="limited-srgb"
  value="#ff0000" />

<label for="p3">Color input using p3:</label>

<input
  type="color"
  id="p3"
  name="p3"
  colorspace="display-p3"
  value="oklab(50% 0.1 0.1 / 0.5)" />
label {
  display: block;
  margin-top: 1rem;
}

input {
  margin-bottom: 1rem;
}

Specifications

Specification
HTML
# attr-input-colorspace

Browser compatibility

See also