ui/src/main/java/ucar/nc2/ui/grid/ColorScale.java
public void setNumColors(int n) {
    if (n != ncolors) {
      colors = new Color[n];
      int prevn = Math.min(ncolors, n);
      System.arraycopy(useColors, 0, colors, 0, prevn);
      for (int i = ncolors; i < n; i++)
        colors[i] = Color.white;

      useColors = colors;
      ncolors = n;
      edge = new double[ ncolors];
      hist = new int[ ncolors + 1];
    }
  }
public void setNumColors(int n) {
    if (n != ncolors) {
      colors = new Color[n];
      int prevn = Math.min(ncolors, n);
      System.arraycopy(useColors, 0, colors, 0, prevn);
      for (int i = ncolors; i < n; i++)
        colors[i] = Color.white;

      useColors = colors;
      ncolors = n;
      edge = new double[ ncolors];
      hist = new int[ ncolors + 1];
    }
  }
Set the number of colors in the colorscale.