{"id":25271,"date":"2024-02-28T20:35:27","date_gmt":"2024-02-28T19:35:27","guid":{"rendered":"https:\/\/nelkodev.com\/blog\/guia-completa-personaliza-formularios-con-input-color-en-html5\/"},"modified":"2024-06-03T17:40:20","modified_gmt":"2024-06-03T16:40:20","slug":"guia-completa-personaliza-formularios-con-input-color-en-html5","status":"publish","type":"post","link":"https:\/\/nelkodev.com\/en\/blog\/complete-guide-customize-forms-with-input-color-in-html5\/","title":{"rendered":"Complete Guide: Customize Forms with Input Color in HTML5"},"content":{"rendered":"<p>The element <code>input<\/code> HTML5 has revolutionized the way users interact with forms on the web, offering more intuitive and visual options for data entry. Among these innovations, the type <code>color<\/code> provides a simple user interface for selecting colors, opening up a range of possibilities for designers and developers looking to improve the user experience on their sites. Let&#039;s learn how to get the most out of this useful HTML5 tool.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_80 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #ffffff;color:#ffffff\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #ffffff;color:#ffffff\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewbox=\"0 0 24 24\" version=\"1.2\" baseprofile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/nelkodev.com\/en\/blog\/complete-guide-customize-forms-with-input-color-in-html5\/#%C2%BFQue_es_el_Input_de_Color_en_HTML5\" >What is Color Input in HTML5?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/nelkodev.com\/en\/blog\/complete-guide-customize-forms-with-input-color-in-html5\/#Implementacion_Basica_del_Input_Color\" >Basic Implementation of Input Color<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/nelkodev.com\/en\/blog\/complete-guide-customize-forms-with-input-color-in-html5\/#Personalizacion_Avanzada\" >Advanced Customization<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/nelkodev.com\/en\/blog\/complete-guide-customize-forms-with-input-color-in-html5\/#Mejorando_la_Experiencia_del_Usuario_con_JavaScript\" >Improving User Experience with JavaScript<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/nelkodev.com\/en\/blog\/complete-guide-customize-forms-with-input-color-in-html5\/#Integracion_con_Otras_Tecnologias_Web\" >Integration with Other Web Technologies<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/nelkodev.com\/en\/blog\/complete-guide-customize-forms-with-input-color-in-html5\/#Mejores_Practicas\" >Better practices<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/nelkodev.com\/en\/blog\/complete-guide-customize-forms-with-input-color-in-html5\/#Conclusiones_y_Continuidad\" >Conclusions and Continuity<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"%C2%BFQue_es_el_Input_de_Color_en_HTML5\"><\/span>What is Color Input in HTML5?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>He <code>input<\/code> of type <code>color<\/code> is a control that allows users to choose a color from a predefined palette or define a custom one. By integrating it into your forms, you provide a visual and direct way for color selection, ideal for design configurations, product customization, or any functionality that requires a chromatic choice by the user.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Implementacion_Basica_del_Input_Color\"><\/span>Basic Implementation of Input Color<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Including a color selector in your form is as simple as adding a field <code>input<\/code> with the attribute <code>type<\/code> assigned to value <code>color<\/code>. Here I show you a basic example:<\/p>\n<pre><code class=\"&quot;language-html&quot;\"><form><label for=\"favcolor\">Choose your favorite color:<\/label><input type=\"color\" id=\"favcolor\" name=\"favcolor\"><input type=\"submit\"><\/form><\/code><\/pre>\n<p>This code will create a default button that, when pressed, will open the browser&#039;s color picker.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Personalizacion_Avanzada\"><\/span>Advanced Customization<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Now, if you want to take the look of the color picker a step further, you can use CSS to give it a unique style. Imagine you want the button to match the color scheme and overall aesthetic of your page in <a href=\"https:\/\/nelkodev.com\/en\/\">NelkoDev<\/a>. We can do things like change the appearance of the selector button and even hide it to replace it with a completely custom design.<\/p>\n<pre><code class=\"&quot;language-css&quot;\">input[type=&quot;color&quot;] { border: none; background-color: transparent; cursor: pointer; } input[type=&quot;color&quot;]::-webkit-color-swatch-wrapper { padding: 0; } input[type=&quot;color&quot;]::-webkit-color-swatch { border: none; }<\/code><\/pre>\n<p>These styles are specific to WebKit-based browsers like Chrome and Safari. The selectors that include <code>::-webkit<\/code> allow you to customize the visible part of the control <code>input color<\/code>. Remember that each browser has its own pseudo-elements and you may need special settings for each of them.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Mejorando_la_Experiencia_del_Usuario_con_JavaScript\"><\/span>Improving User Experience with JavaScript<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>With JavaScript, you can further enrich user interaction with color input. For example, you can add events to get real-time response to color changes, and update other page elements to reflect the user&#039;s selection. Here&#039;s a snippet showing how you could capture and use the value of the selected color:<\/p>\n<pre><code class=\"&quot;language-javascript&quot;\">document.getElementById(&#039;favcolor&#039;).addEventListener(&#039;change&#039;, function() { var colorValue = this.value; document.body.style.backgroundColor = colorValue; });<\/code><\/pre>\n<p>This code will change the background color of the document body to the color the user selects in the input.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Integracion_con_Otras_Tecnologias_Web\"><\/span>Integration with Other Web Technologies<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The beauty of <code>input color<\/code> It also lies in its versatility to work together with other web technologies such as Canvas, WebGL and third-party libraries. Imagine creating an interactive canvas where users can draw with the selected color, or a web application that allows you to customize a 3D model in real time. The possibilities are fascinating and limited only by your creativity.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Mejores_Practicas\"><\/span>Better practices<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Don&#039;t forget to always follow best practices for proper web accessibility, including:<\/p>\n<ul>\n<li>Tags <code>labels<\/code> correctly associated for each <code>input<\/code>.<\/li>\n<li>Checking color contrasts to facilitate visibility.<\/li>\n<li>Testing on different browsers and devices to ensure compatibility and a consistent experience.<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Conclusiones_y_Continuidad\"><\/span>Conclusions and Continuity<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The addition of a <code>input color<\/code> on your forms is a fantastic way to improve interactivity and personalization on your website. It&#039;s a simple yet powerful HTML5 resource that, when combined with CSS and JavaScript, opens up a new world of possibilities for the user experience.<\/p>\n<p>Remember that this is just the beginning. There are many more aspects and techniques that might interest you when it comes to forms and UI\/UX design in <a href=\"https:\/\/nelkodev.com\/en\/\">NelkoDev<\/a>. For more information or if you have any questions about how to implement these techniques in your project, do not hesitate to contact <a href=\"https:\/\/nelkodev.com\/en\/contact\/\">NelkoDev contact<\/a>. Continue exploring and experimenting to take your forms to the next level. The sky is the limit!<\/p>","protected":false},"excerpt":{"rendered":"<p>El elemento input de HTML5 ha revolucionado la manera en que los usuarios interact\u00faan con los formularios en la web, ofreciendo opciones m\u00e1s intuitivas y visuales para la entrada de datos. Entre estas innovaciones, el tipo color proporciona una interfaz de usuario sencilla para seleccionar colores, abriendo un abanico de posibilidades para dise\u00f1adores y desarrolladores [&hellip;]<\/p>","protected":false},"author":1,"featured_media":25272,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[420],"tags":[205,747,500,90,492,358,782,688,788],"class_list":["post-25271","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-blog","tag-color","tag-completa","tag-con","tag-formularios","tag-guia","tag-html5","tag-input","tag-personaliza"],"_links":{"self":[{"href":"https:\/\/nelkodev.com\/en\/wp-json\/wp\/v2\/posts\/25271","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nelkodev.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nelkodev.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nelkodev.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nelkodev.com\/en\/wp-json\/wp\/v2\/comments?post=25271"}],"version-history":[{"count":0,"href":"https:\/\/nelkodev.com\/en\/wp-json\/wp\/v2\/posts\/25271\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nelkodev.com\/en\/wp-json\/wp\/v2\/media\/25272"}],"wp:attachment":[{"href":"https:\/\/nelkodev.com\/en\/wp-json\/wp\/v2\/media?parent=25271"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nelkodev.com\/en\/wp-json\/wp\/v2\/categories?post=25271"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nelkodev.com\/en\/wp-json\/wp\/v2\/tags?post=25271"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}