docs: function registerModel(name, model) {
          var proto = object(color);
          var fields = []; // used for cloning and generating accessors
  
          var to_meth = 'to' + capitalise(name);
  
          function convertAndApply(meth) {
              return function() {
                  return meth.apply(this[to_meth](), arguments);
              };
          }
  
          for (var key in model)
              if (model.hasOwnProperty(key)) {
                  proto[key] = model[key];
                  var prop = proto[key];
  
                  if (key.slice(0, 1) == '_') {
                      continue;
                  }
                  if (!(key in color) && "function" == typeof prop) {
                      // the method found on this object is a) public and b) not
                      // currently supported by the color object. Create an impl that
                      // calls the toModel function and passes that new object
                      // onto the correct method with the args.
                      color[key] = convertAndApply(prop);
                  } else if ("function" != typeof prop) {
                      // we have found a public property. create accessor methods
                      // and bind them up correctly
                      fields.push(key);
                      var getter = 'get' + capitalise(key);
                      var setter = 'set' + capitalise(key);
  
                      color[getter] = convertAndApply(
                          proto[getter] = (function(key) {
                              return function() {
                                  return this[key];
                              };
                          })(key)
                      );
  
                      color[setter] = convertAndApply(
                          proto[setter] = (function(key) {
                              return function(val) {
                                  var cloned = this.clone();
                                  cloned[key] = val;
                                  return cloned;
                              };
                          })(key)
                      );
                  }
              } // end of for over model
  
              // a method to create a new object - largely so prototype chains dont
              // get insane. This uses an unrolled 'object' so that F is cached
              // for later use. this is approx a 25% speed improvement
  
          function F() {}
          F.prototype = proto;
  
          function factory() {
              return new F();
          }
          factories[name] = factory;
  
          proto.clone = function() {
              var cloned = factory();
              for (var i = 0, j = fields.length; i < j; i++) {
                  var key = fields[i];
                  cloned[key] = this[key];
              }
              return cloned;
          };
  
          color[to_meth] = function() {
              return factory();
          };
  
          registered_models.push(proto);
  
          return proto;
      }