code: public static Color[] terrain(int n, float alpha) {
          int k = n / 2;
          float[] H = {4 / 12f, 2 / 12f, 0 / 12f};
          float[] S = {1f, 1f, 0f};
          float[] V = {0.65f, 0.9f, 0.95f};
  
          Color[] palette = new Color[n];
  
          float h = H[0];
          float hw = (H[1] - H[0]) / (k - 1);
  
          float s = S[0];
          float sw = (S[1] - S[0]) / (k - 1);
  
          float v = V[0];
          float vw = (V[1] - V[0]) / (k - 1);
  
          for (int i = 0; i <
                  k; i++) {
              palette[i] = hsv(h, s, v, alpha);
              h +=
                      hw;
              s +=
                      sw;
              v +=
                      vw;
          }
  
          h = H[1];
          hw = (H[2] - H[1]) / (n - k);
  
          s = S[1];
          sw = (S[2] - S[1]) / (n - k);
  
          v = V[1];
          vw = (V[2] - V[1]) / (n - k);
  
          for (int i = k; i < n; i++) {
              h += hw;
              s += sw;
              v += vw;
              palette[i] = hsv(h, s, v, alpha);
          }
  
          return palette;
      }
docs: Generate terrain color palette.
  @param n the number of colors in the palette.
  @param alpha the parameter in [0,1] for transparency.