-
Notifications
You must be signed in to change notification settings - Fork 22.9k
Document <input type=color> serialization w/ colorspace & alpha #40260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2d031a2
Document <input type=color> serialization w/ colorspace & alpha
Elchi3 0e323d6
Apply suggestions from code review
Elchi3 e6ffe9f
Merge branch 'main' into input-color
Elchi3 3b00a93
Apply suggestions from code review
Elchi3 0f2e61c
more tweaks
Elchi3 480d1d0
Update files/en-us/web/api/htmlinputelement/colorspace/index.md
Elchi3 4294dc4
Merge branch 'main' into input-color
Josh-Cena 986eba4
Minor fixes
Josh-Cena e3e84a0
Add experimental
Josh-Cena File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
| <input id="color-picker" type="color" alpha /> | ||
| ``` | ||
|
|
||
| ```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 | ||
|
|
||
| - [`<input type="color">`](/en-US/docs/Web/HTML/Reference/Elements/input/color) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
| <input id="color-picker" type="color" colorspace="display-p3" alpha /> | ||
| ``` | ||
|
|
||
| ```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 | ||
|
|
||
| - [`<input type="color">`](/en-US/docs/Web/HTML/Reference/Elements/input/color) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.