{"id":5981,"date":"2025-05-23T09:34:34","date_gmt":"2025-05-23T14:34:34","guid":{"rendered":"https:\/\/frontendmasters.com\/blog\/?p=5981"},"modified":"2025-05-23T09:35:16","modified_gmt":"2025-05-23T14:35:16","slug":"p3-in-color-inputs","status":"publish","type":"post","link":"https:\/\/frontendmasters.com\/blog\/p3-in-color-inputs\/","title":{"rendered":"P3 in Color Inputs"},"content":{"rendered":"\n<p><a href=\"https:\/\/frontendmasters.com\/blog\/a-color-input-that-also-shows-the-value\/#:~:text=It%20would%20be%20extremely%20cool%20if%20OS%20color%20pickers%20supported%20formats%20other%20than%20HEX%20as%20well%20as%20P3%2Dand%2Dbeyond%20color%20spaces\">I just complained<\/a> that color inputs couldn&#8217;t deal in P3 colors. Looks like <a href=\"https:\/\/webkit.org\/blog\/16900\/p3-and-alpha-color-pickers\/\">Safari is the first-mover<\/a> on supporting that, as well as alpha:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">input<\/span> \n  <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\">\"color\"<\/span> \n  <span class=\"hljs-attr\">value<\/span>=<span class=\"hljs-string\">\"oklab(59% 0.1 0.1 \/ 0.5)\"<\/span> \n  <span class=\"hljs-attr\">colorspace<\/span>=<span class=\"hljs-string\">\"display-p3\"<\/span> \n  <span class=\"hljs-attr\">alpha<\/span>\n&gt;<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>I was able to <a href=\"https:\/\/codepen.io\/chriscoyier\/pen\/wBBVLrY\">make a quick demo<\/a> and see it on iOS:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"542\" height=\"1024\" src=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/05\/Screenshot-2025-05-22-at-8.05.13%E2%80%AFAM.png?resize=542%2C1024&#038;ssl=1\" alt=\"\" class=\"wp-image-5982\" style=\"width:258px;height:auto\" srcset=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/05\/Screenshot-2025-05-22-at-8.05.13%E2%80%AFAM.png?resize=542%2C1024&amp;ssl=1 542w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/05\/Screenshot-2025-05-22-at-8.05.13%E2%80%AFAM.png?resize=159%2C300&amp;ssl=1 159w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/05\/Screenshot-2025-05-22-at-8.05.13%E2%80%AFAM.png?resize=768%2C1452&amp;ssl=1 768w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/05\/Screenshot-2025-05-22-at-8.05.13%E2%80%AFAM.png?resize=813%2C1536&amp;ssl=1 813w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/05\/Screenshot-2025-05-22-at-8.05.13%E2%80%AFAM.png?resize=1083%2C2048&amp;ssl=1 1083w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/05\/Screenshot-2025-05-22-at-8.05.13%E2%80%AFAM.png?w=1130&amp;ssl=1 1130w\" sizes=\"auto, (max-width: 542px) 100vw, 542px\" \/><\/figure>\n\n\n\n<p>Under the <strong>Sliders<\/strong> tab, it&#8217;s still just R G &amp; B, but it seems to me you can produce colors still in the P3 space. And if you&#8217;ve set the color space, it gives you a P3 hex code there (which I didn&#8217;t even know was a thing honestly). The actual <code>value<\/code> that you get is like:&nbsp;<code>color(display-p3 0.921957 0.31855 0.969179)<\/code>. Which I guess is fine? Just don&#8217;t expect to get out a color in the same format you put in. <\/p>\n\n\n\n<!--more-->\n\n\n\n<p>Safari also displays the alpha transparency in the preview color chip, which is great to see. This might be tricky to actually use right away, depending on what you&#8217;re doing, as non-supporting browsers will see the value as invalid and display\/return black\/#000000<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"978\" src=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/05\/CleanShot-2025-05-23-at-07.32.58%402x.png?resize=1024%2C978&#038;ssl=1\" alt=\"\" class=\"wp-image-5984\" srcset=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/05\/CleanShot-2025-05-23-at-07.32.58%402x.png?resize=1024%2C978&amp;ssl=1 1024w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/05\/CleanShot-2025-05-23-at-07.32.58%402x.png?resize=300%2C286&amp;ssl=1 300w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/05\/CleanShot-2025-05-23-at-07.32.58%402x.png?resize=768%2C733&amp;ssl=1 768w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/05\/CleanShot-2025-05-23-at-07.32.58%402x.png?resize=1536%2C1466&amp;ssl=1 1536w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/05\/CleanShot-2025-05-23-at-07.32.58%402x.png?w=1938&amp;ssl=1 1938w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>I just complained that color inputs couldn&#8217;t deal in P3 colors. Looks like Safari is the first-mover on supporting that, as well as alpha: I was able to make a quick demo and see it on iOS: Under the Sliders tab, it&#8217;s still just R G &amp; B, but it seems to me you can [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5984,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[29],"tags":[81,154,264],"class_list":["post-5981","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-the-beat","tag-color","tag-display-p3","tag-inputs"],"acf":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/05\/CleanShot-2025-05-23-at-07.32.58%402x.png?fit=1938%2C1850&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/5981","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/comments?post=5981"}],"version-history":[{"count":3,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/5981\/revisions"}],"predecessor-version":[{"id":5986,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/5981\/revisions\/5986"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media\/5984"}],"wp:attachment":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media?parent=5981"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/categories?post=5981"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/tags?post=5981"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}