diff --git a/files/en-us/web/api/htmlinputelement/alpha/index.md b/files/en-us/web/api/htmlinputelement/alpha/index.md new file mode 100644 index 000000000000000..814fa45c490ec81 --- /dev/null +++ b/files/en-us/web/api/htmlinputelement/alpha/index.md @@ -0,0 +1,45 @@ +--- +title: "HTMLInputElement: alpha property" +short-title: alpha +slug: Web/API/HTMLInputElement/alpha +page-type: web-api-instance-property +status: + - experimental +browser-compat: api.HTMLInputElement.alpha +--- + +{{APIRef("HTML DOM")}}{{SeeCompatTable}} + +The **`alpha`** property of the {{domxref("HTMLInputElement")}} interface reflects the {{htmlelement("input")}} element's [`alpha`](/en-US/docs/Web/HTML/Reference/Elements/input/color#alpha) attribute, which indicates whether the CSS color's alpha component can be manipulated by the end user and does not have to be fully opaque. It is only relevant to [color](/en-US/docs/Web/HTML/Reference/Elements/input/color) controls. + +## Value + +A boolean value. + +## Examples + +```html + +``` + +```js +const colorInput = document.getElementById("color-picker"); + +if (colorInput.alpha) { + // Color values contain an alpha component +} else { + // We have fully opaque color values +} +``` + +## Specifications + +{{Specifications}} + +## Browser compatibility + +{{Compat}} + +## See also + +- [``](/en-US/docs/Web/HTML/Reference/Elements/input/color) diff --git a/files/en-us/web/api/htmlinputelement/colorspace/index.md b/files/en-us/web/api/htmlinputelement/colorspace/index.md new file mode 100644 index 000000000000000..19f4c2382ff9384 --- /dev/null +++ b/files/en-us/web/api/htmlinputelement/colorspace/index.md @@ -0,0 +1,43 @@ +--- +title: "HTMLInputElement: colorSpace property" +short-title: colorSpace +slug: Web/API/HTMLInputElement/colorSpace +page-type: web-api-instance-property +status: + - experimental +browser-compat: api.HTMLInputElement.colorSpace +--- + +{{APIRef("HTML DOM")}}{{SeeCompatTable}} + +The **`colorSpace`** property of the {{domxref("HTMLInputElement")}} interface reflects the {{HTMLElement("input")}} element's [`colorspace`](/en-US/docs/Web/HTML/Reference/Elements/input/color#colorspace) attribute, which indicates whether the {{glossary("color space")}} of the serialized CSS color is `sRGB` (the default) or `display-p3`. It is only relevant to [color](/en-US/docs/Web/HTML/Reference/Elements/input/color) controls. + +## Value + +A string containing the value of the [`colorspace`](/en-US/docs/Web/HTML/Reference/Elements/input/color#colorspace) attribute. + +## Examples + +### Getting and setting color spaces + +```html + +``` + +```js +const colorInput = document.getElementById("color-picker"); +console.log(colorInput.colorSpace); // "display-p3" +colorInput.colorSpace = "limited-srgb"; // convert to srgb +``` + +## Specifications + +{{Specifications}} + +## Browser compatibility + +{{Compat}} + +## See also + +- [``](/en-US/docs/Web/HTML/Reference/Elements/input/color) diff --git a/files/en-us/web/api/htmlinputelement/index.md b/files/en-us/web/api/htmlinputelement/index.md index 15a9519648af2c7..7b04fd9436fcc28 100644 --- a/files/en-us/web/api/htmlinputelement/index.md +++ b/files/en-us/web/api/htmlinputelement/index.md @@ -20,6 +20,12 @@ Some properties only apply to input element types that support the corresponding - {{domxref("HTMLInputElement.align", "align")}} {{Deprecated_Inline}} - : A string that represents the alignment of the element. _Use CSS instead._ +- {{domxref("HTMLInputElement.alpha", "alpha")}} {{experimental_inline}} + - : A boolean that represents the element's [`alpha`](/en-US/docs/Web/HTML/Reference/Elements/input/color#alpha) attribute, indicating whether the color's alpha component can be manipulated by the end user and does not have to be fully opaque. + +- {{domxref("HTMLInputElement.colorSpace", "colorSpace")}} {{experimental_inline}} + - : A string that represents the element's [`colorspace`](/en-US/docs/Web/HTML/Reference/Elements/input/color#colorspace) attribute, indicating the {{glossary("color space")}} of the serialized CSS color (sRGB or display-p3). + - {{domxref("HTMLInputElement.defaultValue", "defaultValue")}} - : A string that represents the default value as originally specified in the HTML that created this object. diff --git a/files/en-us/web/html/reference/elements/input/color/index.md b/files/en-us/web/html/reference/elements/input/color/index.md index 2e4cc0b736eb931..ec7a1124c156b8f 100644 --- a/files/en-us/web/html/reference/elements/input/color/index.md +++ b/files/en-us/web/html/reference/elements/input/color/index.md @@ -6,25 +6,29 @@ browser-compat: html.elements.input.type_color sidebar: htmlsidebar --- -{{HTMLElement("input")}} elements of type **`color`** provide a user interface element that lets a user specify a color, either by using a visual color picker interface or by entering the color into a text field in `#rrggbb` hexadecimal format. - -Only basic hexadecimal colors (without alpha channel) are allowed though CSS colors has more formats, e.g., color names, functional notations and a hexadecimal format with an alpha channel. +{{HTMLElement("input")}} elements of type **`color`** provide a user interface element that lets a user specify a color, either by using a visual color picker interface or by entering the color into a text field in a [CSS color value](/en-US/docs/Web/CSS/color_value) format. The element's presentation may vary substantially from one browser and/or platform to another—it might be a basic textual input that automatically validates to ensure that the color information is entered in the proper format, or a platform-standard color picker, or some kind of custom color picker window. {{InteractiveExample("HTML Demo: <input type="color">", "tabbed-standard")}} ```html interactive-example -
Choose your monster's colors:
+Choose your colors:
list and valuealpha,
+        colorSpace,
+        list, and
+        value
+