Color Picker Design with HTML CSS and JavaScript

In this tutorial we will see how to create Color Picker Design with HTML CSS and JavaScript. Pure CSS and JavaScript is used for this purpose, complete code is given.


Take a look at the HTML code given below.

<div class="color-picker" id="color-picker">
    <h1 class="title" id="title">Color Picker</h1>

CSS Code

CSS code is given below.

    box-sizing: border-box;
    font-family: 'Fira Sans Extra Condensed', sans-serif;
    background-color: #ECF0F3;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    position: relative;
    width: 100%;
    max-width: 800px;
    height: 200px;
    background-color: #fff;
    box-shadow: 0px 0px 4px 0px #333;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    width: 5%;
    height: 50px;
    box-shadow: inset 0px 0px 3px 0px #333;
    transition: 0.5s;
    cursor: pointer;
    float: left;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    transform: translateY(-70px);
    height: 120px;

JavaScript Code

Take a look at the JavaScript Code given below.

const colorsArray = ['#d92114','#e91e63','#9c27b0','#673ab7','#3f51b5','#2196f3','#03a9f4','#00bcd4','#009688','#4caf50', '#8bc34a','#cddc39','#ffeb3b','#ffc107','#ff9800','#ff5722','#704535','#857a7a','#607d8b','#13252e'];

var colorPicker = document.getElementById('color-picker');

for(var i=0; i<20; i++)
var colorElement = "
"; colorPicker.innerHTML+=colorElement; } function changeColor(e) { var elements = document.getElementsByClassName('colors'); for(var j=0; j < elements.length; j++) { elements[j].classList.remove('color-move'); } e.classList.add('color-move');[]; document.getElementById('title').style.color='#fff'; } </script>


Video Tutorial

Watch our video tutorial on Color Picker Design with HTML CSS and JavaScript.

Pure CSS Custom Radio Buttons Custom Emoji Radio Buttons with CSS Custom Radio Buttons with CSS Engraved HTML Buttons With CSS Neumorphic Buttons Design with CSS Cool Profile Card Design with HTML CSS Neumorphic Search Bar Design with HTML and CSS Simple Login Form with Placeholder Animation Pure CSS Button with Folded Corner Background Color Change Slider with HTML CSS and JavaScript 404 Page Not Found Template Design with HTML and CSS Movies Blog Card Design with HTML and CSS Simple CSS Border Animation with before and after Selector Custom Social Select Dropdown Menu with CSS and JavaScript Facebook Offline and Online Notification with CSS and JS New Year 2022 Text Animation with CSS and JS Change Placeholder Color using CSS Custom Select Tag DropDown with CSS and JavaScript Profile Card With Hover Effect using HTML and CSS Simple Price Range Slider With HTML CSS and JavaScript Circle With Two Colors using CSS Card With Ribbon using HTML and CSS Simple Loading Screen using HTML and CSS Disable Textarea Resizable Property using CSS Button like Links using CSS Simple Dropdown Menu Using HTML and CSS Background Color Transition using CSS Highlight Required Input Fields using CSS Disable HTML Link using CSS Difference Between Descendant Selector and Child Selector How To Change Color and Size of Hr Tag Using CSS How To Center Align HTML Table Convert Checkbox To Toggle Button Using CSS Drawing Stars using HTML and CSS Button Bounce Effect using CSS Image as Text Background using CSS background-clip Property Vertically Rotate HTML Element using CSS Vertical Align Middle using CSS Text Over Image Hover Effect - Css Hover Simple CSS Button Hover Effect using Before Selector
Get Heading Text using JavaScript Current Date in mm/dd/yyyy Format JavaScript Current Date in dd/mm/yyyy Format in JavaScript JavaScript Current Date in yyyy-mm-dd Format JavaScript Get Date Difference in Hours JavaScript Get Date Difference in Minutes JavaScript Get Date Difference in Seconds Get Last Character of String with JavaScript Trigger Button Click On Page Load JavaScript Get id Of Child Element JavaScript Get Id Of Parent Element in JavaScript Get Table Row Index onclick in JavaScript Remove specific option from Select Tag with JavaScript Change Selected Option of Select Tag with JavaScript Get Length of Text In Textarea with JavaScript Change Text Color of Select Tag Option using JavaScript Change Heading Text in JavaScript Get Input Value Length in JavaScript Toggle Button Text with JavaScript Change Background Color of Dropdown with Dropdown using JavaScript Emoji Mood Slider with HTML CSS and JavaScript Hide and Show Div with Radio Button using JavaScript Count Options In Select Tag with JavaScript Get Select Tag Text OnChange with JavaScript Change Background Color OnClick using Input Field