Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / HTML

alpha — transparency in a color control

`alpha` is a boolean attribute of `input type="color"` that, in the standard, allows selecting a color’s transparency component.

Version: HTML Living Standard

Syntax

<input type="color" alpha value="#ff000080">

In a supporting implementation, present alpha lets the control preserve and edit the alpha channel; without it the color is opaque. This is not CSS opacity. Separate colorspace chooses the serialized color space. alpha="false" does not disable a boolean attribute.

Do not infer support from the attribute merely surviving in the DOM. Tested Chromium 145 does not expose HTMLInputElement.alpha; an eight-digit color value does not provide a transparent color control there. We do not claim support throughout versions up to 152 or in every WebView.

The example checks the prototype API and reports the unsupported case honestly. A practical fallback is a separate opacity slider whose value is stored explicitly. Even in a supporting browser, check the picker and serialization; the selected output branch depends on the environment.

Examples

<!doctype html><meta charset="utf-8">
<label>Color <input id="color" type="color" alpha value="#ff000080"></label>
<output id="result"></output>
<script>
const input = document.querySelector('#color');
const supported = 'alpha' in HTMLInputElement.prototype;
document.querySelector('#result').textContent = supported
  ? 'alpha API available; value=' + input.value
  : 'alpha API unavailable; provide a separate opacity control';
</script>

Result

alpha API unavailable; provide a separate opacity control

The exact output is for Chromium 145. This example verifies the capability fallback, not an implemented alpha picker.

Sources