« get me outta code hell

Easter egg??? :) - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2019-05-28 21:40:56 -0300
committerFlorrie <towerofnix@gmail.com>2019-05-28 21:40:56 -0300
commit565c984e563be3bc37c9ab5674ee088f2ea718c0 (patch)
tree68c661c2ba3e7db5f14b0e6b75abc9392a9d6fba
parentdd32eb4fa279e4417cd4136d23e9646fb967a1e5 (diff)
Easter egg??? :)
-rw-r--r--todo.txt2
-rw-r--r--ui.js14
2 files changed, 15 insertions, 1 deletions
diff --git a/todo.txt b/todo.txt
index 6894ae2..d234853 100644
--- a/todo.txt
+++ b/todo.txt
@@ -254,3 +254,5 @@ TODO: Don't close the menubar menus when an option is chosen!
       Instead, reload that menu to reflect the changes. Handy so that you can
       easily press a specific action (e.g. "play later") several times in
       succession.
+
+TODO: Color theme picker!! Make sure to save the choice in ~/.mtui, of course!
diff --git a/ui.js b/ui.js
index 3d2bbee..e1eb528 100644
--- a/ui.js
+++ b/ui.js
@@ -2763,6 +2763,8 @@ class Menubar extends ListScrollForm {
     super('horizontal')
 
     this.contextMenu = contextMenu
+    this.color = 4 // blue
+    this.attribute = 2 // dim
   }
 
   select() {
@@ -2791,6 +2793,16 @@ class Menubar extends ListScrollForm {
     if (telc.isSpace(keyBuf)) {
       return false
     }
+
+    // For fun :)
+    if (telc.isCaselessLetter(keyBuf, 'c')) {
+      this.color = (this.color % 8) + 1
+      return false
+    }
+    if (telc.isCaselessLetter(keyBuf, 'a')) {
+      this.attribute = (this.attribute % 3) + 1
+      return false
+    }
   }
 
   restoreSelection() {
@@ -2832,7 +2844,7 @@ class Menubar extends ListScrollForm {
 
   drawTo(writable) {
     writable.write(ansi.moveCursor(this.absTop, this.absLeft))
-    writable.write(ansi.setAttributes([ansi.C_BLUE, ansi.A_DIM, ansi.A_INVERT, ansi.C_WHITE + 10]))
+    writable.write(ansi.setAttributes([this.attribute, 30 + this.color, ansi.A_INVERT, ansi.C_WHITE + 10]))
     writable.write(' '.repeat(this.w))
     writable.write(ansi.resetAttributes())
   }