code: @SuppressWarnings("squid:S1244")
      public HSL getHSL() {
          // Convert the RGB values to the range 0-1
          double red = r / 255.0;
          double green = g / 255.0;
          double blue = b / 255.0;
  
          // Find the minimum and maximum values of R, G and B.
          double min = Math.min(red, Math.min(green, blue));
          double max = Math.max(red, Math.max(green, blue));
          double delta = max - min;
  
          // Now calculate the luminace value by adding the max and min values and divide by 2.
          double l = (min + max) / 2;
  
          // The next step is to find the Saturation.
          double s = 0;
  
          // If the min and max value are the same, it means that there is no saturation.
          // If all RGB values are equal you have a shade of grey.
          if (Math.abs(delta) > EPSILON) {
              // Now we know that there is Saturation we need to do check the level of the Luminance
              // in order to select the correct formula.
              if (l < 0.5) {
                  s = delta / (max + min);
              } else {
                  s = delta / (2.0 - max - min);
              }
          }
  
          // The Hue formula is depending on what RGB color channel is the max value.
          double h = 0;
          if (delta > 0) {
              if (red == max) {
                  h = (green - blue) / delta;
              } else if (green == max) {
                  h = ((blue - red) / delta) + 2.0;
              } else {
                  h = ((red - green) / delta) + 4.0;
              }
          }
  
          // The Hue value you get needs to be multiplied by 60 to convert it to degrees on the color circle
          // If Hue becomes negative you need to add 360 to, because a circle has 360 degrees.
          h = h * 60;
  
          return new HSL((int) Math.round(h), s, l);
      }
docs: Computes the HSL value form the stored RGB values.
  
  @return a triple containing the hue, saturation and lightness