src/colorfunc.js
function colorCoordValue(channel, pos) {
  const color = {};
  pos.x = Math.round(pos.x);
  pos.y = Math.round(pos.y);

  switch (channel) {
    case 'r':
      color.b = pos.x;
      color.g = 255 - pos.y;
      break;
    case 'g':
      color.b = pos.x;
      color.r = 255 - pos.y;
      break;
    case 'b':
      color.r = pos.x;
      color.g = 255 - pos.y;
      break;
    case 'h':
      color.s = pos.x;
      color.l = 100 - pos.y;
      break;
    case 's':
      color.h = pos.x;
      color.l = 100 - pos.y;
      break;
    case 'l':
      color.h = pos.x;
      color.s = 100 - pos.y;
      break;
  }

  return color;
}
function colorCoordValue(channel, pos) {
  const color = {};
  pos.x = Math.round(pos.x);
  pos.y = Math.round(pos.y);

  switch (channel) {
    case 'r':
      color.b = pos.x;
      color.g = 255 - pos.y;
      break;
    case 'g':
      color.b = pos.x;
      color.r = 255 - pos.y;
      break;
    case 'b':
      color.r = pos.x;
      color.g = 255 - pos.y;
      break;
    case 'h':
      color.s = pos.x;
      color.l = 100 - pos.y;
      break;
    case 's':
      color.h = pos.x;
      color.l = 100 - pos.y;
      break;
    case 'l':
      color.h = pos.x;
      color.s = 100 - pos.y;
      break;
  }

  return color;
}
function colorCoordValue ( channel , pos ) { const color = { } ; pos . x = Math . round ( pos . x ) ; pos . y = Math . round ( pos . y ) ; switch ( channel ) { case 'r' : color . b = pos . x ; color . g = 255 - pos . y ; break ; case 'g' : color . b = pos . x ; color . r = 255 - pos . y ; break ; case 'b' : color . r = pos . x ; color . g = 255 - pos . y ; break ; case 'h' : color . s = pos . x ; color . l = 100 - pos . y ; break ; case 's' : color . h = pos . x ; color . l = 100 - pos . y ; break ; case 'l' : color . h = pos . x ; color . s = 100 - pos . y ; break ; } return color ; }
Takes a channel and returns its sibling values based on x,y positions

R: x = b, y = g
G: x = b, y = r
B: x = r, y = g

H: x = s, y = l
S: x = h, y = l
L: x = h, y = s

@param {string} channel one of `r`, `g`, `b`, `h`, `s`, or `l`
@param {Object} pos x, y coordinates
@return {Object} Changed sibling values
Takes a channel and returns its sibling values based on x y positions