diff --git a/globals.js b/globals.js index 3eef67f..f9bf036 100644 --- a/globals.js +++ b/globals.js @@ -126,4 +126,19 @@ function controllerChange(number, value) { cc67now = value; } +} + +function toggleRainbowMode(cb) { + rainbowMode = cb.checked; + if (rainbowMode) + select('#colorpicker').attribute('disabled', true) + else + select('#colorpicker').removeAttribute('disabled') +} + +function changeColor() { + keyOnColor = pedaledColor = color(select('#colorpicker').value()); + darkenedColor = keyOnColor.levels.map(x => floor(x * .7)); + pedaledColor = color(`rgb(${darkenedColor[0]}, ${darkenedColor[1]}, ${darkenedColor[2]})`) + console.log(pedaledColor.levels); } \ No newline at end of file diff --git a/index.html b/index.html index 3d16abc..06517f1 100644 --- a/index.html +++ b/index.html @@ -17,9 +17,26 @@

鋼琴鍵盤顯示器 by NiceChord

-
選擇 MIDI 裝置
- -
Select Input:
+
+
+
選擇 MIDI 裝置
+ +
Select Input:
+
+
+
+ + +
+
+ 彩虹模式 + + +
+
+

diff --git a/style.css b/style.css index 7f6bcdf..d6a410b 100644 --- a/style.css +++ b/style.css @@ -544,4 +544,46 @@ template { [hidden] { display: none; +} + +input[type=checkbox] { + height: 0; + width: 0; + visibility: hidden; +} + +label[for=rainbow-mode-checkbox] { + cursor: pointer; + width: 50px; + height: 25px; + background: grey; + display: inline-block; + border-radius: 25px; + position: relative; + transition: .3s; +} + +label[for=rainbow-mode-checkbox]:after { + content: ''; + position: absolute; + top: 1.25px; + left: 1.25px; + width: 22.5px; + height: 22.5px; + background: #fff; + border-radius: 22.5px; + transition: .3s; +} + +input:checked + label[for=rainbow-mode-checkbox] { + background: #6f42c1; +} + +label[for=rainbow-mode-checkbox]:active:after { + width: 32.5px; +} + +input:checked + label[for=rainbow-mode-checkbox]:after { + left: calc(100% - 1.25px); + transform: translateX(-100%); } \ No newline at end of file