css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <div class="container">
  <div  class="row top"><div class="col-md-12"><h1> Bulk Hex Color Converter</h1></div></div>
  <div class="row">
    <div class="col-md-6">
      <p>Paste 6 digit hex values separated by commas to convert.<br>You can include or exclude the #.<br>Saved values and tables are stored in localStorage for your next visit.</p>
      <input class="form-control" id="hexArr" value="#f44336,#E91E63,#9C27B0">
      <button class="btn btn-sm btn-success" id="button">Add to Current Table</button>
      <button class="btn btn-sm btn-danger" id="clear">Clear Current Table</button><br>
      <button class="btn btn-sm btn-success" id="save">Save Input Values</button>
      <button class="btn btn-sm btn-primary" id="retrieve">Retrieve Saved Input Values</button>
      <button class="btn btn-sm btn-danger" id="clearSave">Clear Input Memory</button><br>
      <button class="btn btn-sm btn-success" id="saveTable">Save Table</button>
      <button class="btn btn-sm btn-primary" id="retrieveTable">Retrieve Saved  Table</button>

      <button class="btn btn-sm btn-danger" id="clearSaveTable">Clear Table Memory</button>
    <div class="col-md-6">
      <p class="alert"></p>
      <div class="table-responsive">
      <table class="table" id="father">
  <div class="row foot"><div class="col-md-4 col-md-offset-4 text-center"><p>Created by <a href="http://rmcd.io">Robert McDonald</a></p>
@media screen and (max-width:992px){

.btn {
  margin:5px 0;
  margin-top: 5vh;
.foot a{
              /* global $ */
var hexValues;
  //Thank you to http://www.niwa.nu/2013/05/math-behind-colorspace-conversions-rgb-hsl/  for the detailed explanation of how to convert rgb to hsl, which I based this code off of.
 function HSL(a,b,c){
    a = a/255;
    b = b/255;
    c = c/255;
    var max = Math.max(a,b,c);
    var min = Math.min(a,b,c);
    var lum = (((max + min)/2)*100).toFixed(1);
    var hue,sat;
    if (min == max){
    else if(lum<50){
      sat = (((max-min)/(max+min)*100)).toFixed(1);
    else {
      sat = (((max-min)/(2-max-min)*100)).toFixed(1);
    if (hue !== 0 && a == Math.max(a,b,c)){
      hue = Math.round((b-c)/(max-min)*60);
    else if (hue !== 0 && b == Math.max(a,b,c)){
      hue = Math.round(2+((c-a)/(max-min))*60);
    else if (hue !== 0){
      hue = Math.round((4 + ((a-b)/(max-min)))*60);    
   if (hue<0){hue+=360;}
    return '<td>hsl('+hue+','+sat+'&#37,'+lum+'&#37;)</td>';
  function convert(){
    hexValues = $('#hexArr').val();
    hexValues = hexValues.replace(/\#|\s+/g, '');
    var hexArr = hexValues.split(',');
    for (i=0;i<hexArr.length;i++){
      var R = parseInt(hexArr[i].slice(0,2),16);
      var G = parseInt(hexArr[i].slice(2,4),16);
      var B = parseInt(hexArr[i].slice(4,6),16);
      $('#father').append($('<tr class="'+hexArr[i]+'"><td>#' + hexArr[i] + '</td><td> rgba('+R+','+G+','+B+',1)</td>'+ HSL(R,G,B)+'<td class="box" style="background-color:rgba(' + R+','+G+','+B+',1)">&nbsp</td>'+'</tr>').hide().fadeIn());    
   $('#father tr').slice(1).fadeOut();
   localStorage.userHex = $('#hexArr').val();
   alert('Values saved to localStorage.userHex .');
   localStorage.userTable = $('#father').html();
   alert('Table saved to localStorage.userTable .');
    alert('localStorage.userHex cleared.');
  if (localStorage.userHex) {
 else {alert('No stored values found!')}})
  if (localStorage.userTable) {
 else {alert('No stored table found!')}})
    alert('localStorage.userTable cleared.');

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................