Made saturation configuration
[kaka/cakelight.git] / src / kaka / cakelight / VideoFrame.java
index 6435242..931237d 100644 (file)
@@ -104,7 +104,10 @@ public class VideoFrame {
     private Color wrappedGetLedColor(ListPosition listPosition, int xy) {
         Color c = getLedColor(listPosition, xy);
         double[] hsv = c.toHSV();
-        return Color.hsv(hsv[0], 1, 1);
+        double saturation = config.video.saturation >= 0.5
+                ? hsv[1] + (config.video.saturation - 0.5) * 2 * (1 - hsv[1])
+                : hsv[1] - (1 - config.video.saturation * 2) * hsv[1];
+        return Color.hsv(hsv[0], saturation, hsv[2]);
     }
 
     private Color getLedColor(ListPosition listPosition, int xy) {