docs: public static float[] getJSONColorGl(final JSONObject json, String elementName) throws JSONException {
          final float r;
          final float g;
          final float b;
          final float a;
  
          Object raw = json.get(elementName);
          if (raw instanceof String) {
              final String s = (String) raw;
              Matcher m = sColorStringPattern.matcher(s);
              if (!m.find()) {
                  throw new JSONException("String format of color element '"
                          + elementName + "' not valid: " + s);
              }
              final String cstr = m.group(1);
              raw = Integer.parseInt(cstr, 16);
              Log.d(Log.SUBSYSTEM.JSON, TAG, "getJSONColor(): string matching '%s' (%s): 0x%x", s, cstr, raw);
          }
  
          if (raw instanceof Integer) {
              int c = (Integer) raw;
              if (c > 0xFFFFFF) {
                  a = Color.alpha(c);
              } else {
                  a = 0;
              }
              r = Colors.byteToGl(Color.red(c));
              g = Colors.byteToGl(Color.green(c));
              b = Colors.byteToGl(Color.blue(c));
          } else if (raw instanceof JSONArray) {
              final JSONArray jsonArray = (JSONArray) raw;
              r = (float) jsonArray.getDouble(0);
              g = (float) jsonArray.getDouble(1);
              b = (float) jsonArray.getDouble(2);
              if (jsonArray.length() > 3) {
                  a = (float) jsonArray.getDouble(3);
              } else {
                  a = 0;
              }
          } else if (raw instanceof JSONObject) {
              final JSONObject jsonObject = (JSONObject) raw;
              r = (float) jsonObject.getDouble("r");
              g = (float) jsonObject.getDouble("g");
              b = (float) jsonObject.getDouble("b");
              a = (float) jsonObject.optDouble("a", 0);
          } else {
              throw new JSONException("Format of color element '" + elementName
                      + "' not valid!");
          }
  
          Log.d(Log.SUBSYSTEM.JSON, TAG, "getJSONColorGl(): r: %.2f, g: %.2f, b: %.2f, a: %.2f", r, g, b, a);
          return new float[] { r, g, b, a };
      }