code: function(value) {
          if(value.length != 6)
              throw new Error("Hexa color: bad length");
          value = value.toLowerCase();
          for(i in value) {
              var c = value.charCodeAt(i);
              console.log(c);
              if( !((c>=49 && c<=57) || (c>=97 && c<=102)) )
                  throw new Error("Hexa color: out of range for " + value + " at position " + i);
          }
      }
docs: Check a hexa color (without #)