(int)(b * invertedValue + other.b * value)
);
}
+
+ @Override
+ public String toString() {
+ return "Color{r=" + r + ", g=" + g + ", b=" + b + "}";
+ }
}
cakelight.turnOff();
System.out.println("stopping cakelight");
break;
+ } else if (input.matches("(c|col|color)(\\s+[0-9]+){3}")) {
+ String[] split = input.split("\\s+");
+ Color c = Color.rgb(
+ Integer.parseInt(split[1]),
+ Integer.parseInt(split[2]),
+ Integer.parseInt(split[3])
+ );
+ cakelight.setMode(new SingleColorMode(c));
+ System.out.println("setting color to " + c);
}
} catch (IOException e) {
System.out.println("Error reading from command line");
--- /dev/null
+package kaka.cakelight;
+
+public class SingleColorMode extends Mode {
+ private Color color;
+
+ public SingleColorMode(Color c) {
+ color = c;
+ }
+
+ @Override
+ public void enter(Configuration config) {
+ LedFrame frame = LedFrame.from(config);
+ frame.fillColor(color);
+ updateWithFrame(frame);
+ }
+
+ @Override
+ public void exit() {
+ }
+}