/* Draws a square HSB (hue, saturation, brightness) chart.  */
void hsbchartRender(uint16_t x, uint16_t y, uint16_t size, uint16_t baseColor, theme_t theme)
/* Draws a square HSB (hue, saturation, brightness) chart.  */
void hsbchartRender(uint16_t x, uint16_t y, uint16_t size, uint16_t baseColor, theme_t theme)
{
  uint32_t delta;
  uint16_t colorS;
  uint16_t color;
  uint32_t b;
  uint32_t s;
  drawRectangle(x, y, x+size, y+size, theme.colorBorderDarker);
  if (size > 2)
  {
    delta = 10000/(size-2);
    for (b = 0; b<size-1; b++)
    {
      colorS = colorsAlphaBlend(COLOR_WHITE, baseColor, 100 - (b*delta) / 100);
      for (s = 0; s<size-1; s++)
      {
        color = colorsAlphaBlend(colorS, COLOR_BLACK, 100 - (s*delta) / 100);
        drawPixel(x+b+1, y+s+1, color);
      }
    }
  }
}