function rgbToHsb(rgb, maxSB = 100) {
  let r = rgb[0];
  let g = rgb[1];
  let b = rgb[2];
  r /= 255;
  g /= 255;
  b /= 255;
  const v = Math.max(r, g, b);
  const n = v - Math.min(r, g, b);
  // eslint-disable-next-line no-nested-ternary
  const h = n === 0 ? 0 : n && v === r ? (g - b) / n : v === g ? 2 + (b - r) / n : 4 + (r - g) / n;
  return [Math.round(60 * (h < 0 ? h + 6 : h)), Math.round(v && (n / v) * maxSB), Math.round(v * maxSB)];
}
@description Convert rgb to hsb.
@param {Array} rgb - Rgb color.
@param {number} maxSB - Max saturation and brightness.
@returns {Array} [ h, s, b] object.
@example  const [h, s, b] = rgbToHsb([1, 2, 3]);