Add single color mode
[kaka/cakelight.git] / src / kaka / cakelight / Console.java
index 7d864d8..caae09b 100644 (file)
@@ -38,6 +38,15 @@ public class Console extends Thread {
                    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");