     ((color.green / BRIGHTNESS_DIVISOR) * 255) * scale, 
     ((color.blue / BRIGHTNESS_DIVISOR) *255) * scale
   };
+}
+
+rgb_color unscale_color(rgb_color color, float scale){
+  return (rgb_color){
+    ((color.red / scale) / 255) * BRIGHTNESS_DIVISOR,
+    ((color.green / scale) / 255) * BRIGHTNESS_DIVISOR,
+    ((color.blue / scale) / 255) * BRIGHTNESS_DIVISOR,
+  };
+}
+
+rgb_color getRGB(int hue, int sat, int val) {
+  // hue: 0-359, sat: 0-255, val (lightness): 0-255
+  int r, g, b, base;
+
+  if (sat == 0) { // Achromatic color (gray).
+    r = val;
+    g = val;
+    b = val;
+  } else  {
+    base = ((255 - sat) * val)>>8;
+    switch(hue/60) {
+      case 0:
+        r = val;
+        g = (((val-base)*hue)/60)+base;
+        b = base;
+        break;
+      case 1:
+        r = (((val-base)*(60-(hue%60)))/60)+base;
+        g = val;
+        b = base;
+        break;
+      case 2:
+        r = base;
+        g = val;
+        b = (((val-base)*(hue%60))/60)+base;
+        break;
+      case 3:
+        r = base;
+        g = (((val-base)*(60-(hue%60)))/60)+base;
+        b = val;
+        break;
+      case 4:
+        r = (((val-base)*(hue%60))/60)+base;
+        g = base;
+        b = val;
+        break;
+      case 5:
+        r = val;
+        g = base;
+        b = (((val-base)*(60-(hue%60)))/60)+base;
+        break;
+    }
+  }
+  return (rgb_color){r, g, b};
 }
 
 void set_brightness(int brightness_percent = DEFAULT_BRIGHTNESS_PERCENT){

#define FADE_TIMES 40

// Standard colors
rgb_color black = {0, 0, 0};
rgb_color gray = {10, 10, 10};
rgb_color white = {20, 20, 20};

  }
}

bool pausing = false;
bool paused = false;

void flush(){
