« get me outta code hell

mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
path: root/ui.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui.js')
-rw-r--r--ui.js14
1 files changed, 13 insertions, 1 deletions
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())
   }