docs: public static final Color getColorForValue(double val) {
      // Color positions
      double[] pos = new double[] { 0.0, 0.6, 0.8, 1.0 };
      // Colors at these positions
      Color[] cols = new Color[] { new Color(0.0f, 0.0f, 0.0f, 0.6f), new Color(0.0f, 0.0f, 1.0f, 0.8f), new Color(1.0f, 0.0f, 0.0f, 0.9f), new Color(1.0f, 1.0f, 0.0f, 1.0f) };
      assert (pos.length == cols.length);
      if(val < pos[0]) {
        val = pos[0];
      }
      // Linear interpolation:
      for(int i = 1; i < pos.length; i++) {
        if(val <= pos[i]) {
          Color prev = cols[i - 1];
          Color next = cols[i];
          final double mix = (val - pos[i - 1]) / (pos[i] - pos[i - 1]);
          final int r = (int) ((1 - mix) * prev.getRed() + mix * next.getRed());
          final int g = (int) ((1 - mix) * prev.getGreen() + mix * next.getGreen());
          final int b = (int) ((1 - mix) * prev.getBlue() + mix * next.getBlue());
          final int a = (int) ((1 - mix) * prev.getAlpha() + mix * next.getAlpha());
          Color col = new Color(r, g, b, a);
          return col;
        }
      }
      return cols[cols.length - 1];
    }