11<template >
22 <div >
3- <div class =" flex items-center gap-4 mb-2" >
4- <label >RGB Pin</label >
5- <input
6- type =" text"
7- class =" input input-bordered input-sm"
8- v-model =" rgbPin"
9- placeholder =" board.GP3"
10- @change =" savePin"
11- />
12- </div >
13- <div class =" flex items-center gap-4" >
14- <label >RGB Number of LEDS</label >
15- <input
16- type =" text"
17- class =" input input-bordered input-sm"
18- v-model =" rgbNumLeds"
19- placeholder =" 14"
20- @change =" saveNumLeds"
21- />
22- </div >
3+ <label class =" flex gap-4" >
4+ <input class =" checkbox" type =" checkbox" v-model =" rgbEnabled" @change =" toggleRgbEnabled" >
5+ <p >Enable RGB</p >
6+ </label >
7+ <p class =" p-4 my-4 rounded bg-base-300" >info: to enable rgb you also will need a neopixel.mpy file in the lib folder on your circuit python drive. you
8+ can download that here:
9+ <a href =" https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel/releases" >Adafruit GitHub</a ></p >
10+ <div class =" flex items-center gap-4 mb-2" >
11+ <label >RGB Pin</label >
12+ <input
13+ type =" text"
14+ class =" input input-bordered input-sm"
15+ v-model =" rgbPin"
16+ placeholder =" board.GP3"
17+ @change =" savePin"
18+ />
19+ </div >
20+ <div class =" flex items-center gap-4" >
21+ <label >RGB Number of LEDS</label >
22+ <input
23+ type =" text"
24+ class =" input input-bordered input-sm"
25+ v-model =" rgbNumLeds"
26+ placeholder =" 14"
27+ @change =" saveNumLeds"
28+ />
29+ </div >
2330 </div >
2431</template >
2532
@@ -29,10 +36,12 @@ import {onMounted, ref} from "vue";
2936
3037const rgbPin = ref (' ' )
3138const rgbNumLeds = ref (' ' )
39+ const rgbEnabled = ref (false )
3240
3341onMounted (() => {
3442 rgbPin .value = keyboardStore .rgbPin
3543 rgbNumLeds .value = String (keyboardStore .rgbNumLeds )
44+ rgbEnabled .value = keyboardStore .kbFeatures .some ((feature ) => feature .toLowerCase () === ' rgb' )
3645})
3746
3847const savePin = () => {
@@ -43,6 +52,15 @@ const saveNumLeds = () => {
4352 keyboardStore .rgbNumLeds = Number (rgbNumLeds .value )
4453}
4554
55+ const toggleRgbEnabled = () => {
56+ if (keyboardStore .kbFeatures .some ((feature ) => feature .toLowerCase () === ' rgb' )) {
57+ keyboardStore .kbFeatures = keyboardStore .kbFeatures .filter (
58+ (feature ) => feature .toLowerCase () !== ' rgb'
59+ )
60+ } else {
61+ keyboardStore .kbFeatures .push (' rgb' )
62+ }
63+ }
4664 </script >
4765
4866<style lang="scss" scoped></style >
0 commit comments