forked from KeyofBlueS/kfrgb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kfrgb.sh
1784 lines (1636 loc) · 80.1 KB
/
kfrgb.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
# kfrgb
# Version: 0.5.0
# Author: KeyofBlueS
# Repository: https://github.com/KeyofBlueS/kfrgb
# License: GNU General Public License v3.0, https://opensource.org/licenses/GPL-3.0
function initialize_modes() {
### DO NOT EDIT THE VALUES BELOW UNTIL YOU REALLY KNOW WHAT YOU ARE DOING!!! ###
#rainbow
mode_hex_rainbow='01' # DO NOT EDIT AT ALL!
speeds_hex_rainbow='00 06 0c 12 18 1e 24 2a 30 36 3c' # DO NOT EDIT AT ALL!
speed_default_rainbow='7' # min 1, max 11, default 7
direction_default_rainbow='up' # up or down, default up
#prism
mode_hex_prism='11' # DO NOT EDIT AT ALL!
speeds_hex_prism='00 06 0c 12 18 1e 24 2a 30 36 3c' # DO NOT EDIT AT ALL!
speed_default_prism='4' # min 1, max 11, default 4
delays_hex_prism='02 03 04 05 06' # DO NOT EDIT AT ALL!
delay_default_prism='1' # min 1, max 5, default 1
#spectrum
mode_hex_spectrum='01' # DO NOT EDIT AT ALL!
speeds_hex_spectrum='00 06 0c 12 18 1e 24 2a 30 36 3c' # DO NOT EDIT AT ALL!
speed_default_spectrum='4' # min 1, max 11, default 4
delays_hex_spectrum='02 03 04' # DO NOT EDIT AT ALL!
delay_default_spectrum='3' # min 1, max 3, default 3
direction_default_spectrum='up' # up or down, default up
#slide
mode_hex_slide='05' # DO NOT EDIT AT ALL!
speeds_hex_slide='00 19 33 4c 66 7f 99 b2 cc e5 ff' # DO NOT EDIT AT ALL!
speed_default_slide='10' # min 1, max 11, default 10
delays_hex_slide='01 02 03 04' # DO NOT EDIT AT ALL!
delay_default_slide='3' # min 1, max 4, default 3
lengths_hex_slide='01 02 03 04 05 06 07 08 09 0a 0b 0c' # DO NOT EDIT AT ALL!
length_default_slide='4' # min 1, max 12, default 4
tencolors_default_slide='255 0 0,0 255 0,255 100 0,0 0 255,238 238 0,128 0 128,0 109 119,255 200 0,255 85 255,60 125 255' # 30 comma/space separated values from 0 to 255
backcolor_default_slide='0 0 0' # 3 comma/space separated values from 0 to 255
direction_default_slide='down' # up or down, default down
#wind
mode_hex_wind='05' # DO NOT EDIT AT ALL!
speeds_hex_wind='00 19 33 4c 66 7f 99 b2 cc e5 ff' # DO NOT EDIT AT ALL!
speed_default_wind='10' # min 1, max 11, default 10
delays_hex_wind='00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14' # DO NOT EDIT AT ALL!
delay_default_wind='1' # min 1, max 20, default 1
lengths_hex_wind='01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20' # DO NOT EDIT AT ALL!
length_default_wind='12' # min 1, max 32, default 12
tencolors_default_wind='255 0 0,0 255 0,255 100 0,0 0 255,238 238 0,128 0 128,0 109 119,255 200 0,255 85 255,60 125 255' # 30 comma/space separated values from 0 to 255
backcolor_default_wind='0 0 0' # 3 comma/space separated values from 0 to 255
direction_default_wind='up' # up or down, default up
#static
mode_hex_static='00' # DO NOT EDIT AT ALL!
color_default_static='255 0 0' # 3 comma/space separated values from 0 to 255
#static_byledcolor
mode_hex_static_byledcolor='10' # DO NOT EDIT AT ALL!
byledcolors_default_static_byledcolor='255 0 0,0 255 0,0 0 255,255 0 0,0 255 0,0 0 255,255 0 0,0 255 0,0 0 255,255 0 0,0 255 0,0 0 255' # 36 comma/space separated values from 0 to 255
#lightspeed
mode_hex_lightspeed='06' # DO NOT EDIT AT ALL!
speeds_hex_lightspeed='00 19 33 4c 66 7f 99 b2 cc e5 ff' # DO NOT EDIT AT ALL!
speed_default_lightspeed='9' # min 1, max 11, default 9
delays_hex_lightspeed='00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14' # DO NOT EDIT AT ALL!
delay_default_lightspeed='1' # min 1, max 20, default 1
lengths_hex_lightspeed='01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12' # DO NOT EDIT AT ALL!
length_default_lightspeed='7' # min 1, max 18, default 7
tencolors_default_lightspeed='255 0 0,0 255 0,255 100 0,0 0 255,238 238 0,128 0 128,0 109 119,255 200 0,255 85 255,60 125 255' # 30 comma/space separated values from 0 to 255
direction_default_lightspeed='up' # up or down, default up
#rain
mode_hex_rain='06' # DO NOT EDIT AT ALL!
speeds_hex_rain='13 15 17 19 1b 1d 1f 21 23 25 27' # DO NOT EDIT AT ALL!
speed_default_rain='11' # min 1, max 11, default 11
tencolors_default_rain='255 0 0,0 255 0,255 100 0,0 0 255,238 238 0,128 0 128,0 109 119,255 200 0,255 85 255,60 125 255' # 30 comma/space separated values from 0 to 255
direction_default_rain='down' # up or down, default down
#firework
mode_hex_firework='06' # DO NOT EDIT AT ALL!
speeds_hex_firework='30 35 3a 3f 44 49 4e 53 58 5d 62' # DO NOT EDIT AT ALL!
speed_default_firework='11' # min 1, max 11, default 11
tencolors_default_firework='255 0 0,0 255 0,255 100 0,0 0 255,238 238 0,128 0 128,0 109 119,255 200 0,255 85 255,60 125 255' # 30 comma/space separated values from 0 to 255
direction_default_firework='up' # up or down, default up
#breath
mode_hex_breath='03' # DO NOT EDIT AT ALL!
speeds_hex_breath='' # DO NOT EDIT AT ALL! Need to find actual hex values set by official app.
speed_default_breath='6' # min 1, max 11, default 6
tencolors_default_breath='255 0 0,0 255 0,255 100 0,0 0 255,238 238 0,128 0 128,0 109 119,255 200 0,255 85 255,60 125 255' # 36 comma/space separated values from 0 to 255
#breath_byledcolor
mode_hex_breath_byledcolor='13' # DO NOT EDIT AT ALL!
speeds_hex_breath_byledcolor='' # DO NOT EDIT AT ALL! Need to find actual hex values set by official app.
speed_default_breath_byledcolor='6' # min 1, max 11, default 6
byledcolors_default_breath_byledcolor='255 0 0,0 255 0,0 0 255,255 0 0,0 255 0,0 0 255,255 0 0,0 255 0,0 0 255,255 0 0,0 255 0,0 0 255'
#dynamic
mode_hex_dynamic='04' # DO NOT EDIT AT ALL!
speeds_hex_dynamic='' # DO NOT EDIT AT ALL! Need to find actual hex values set by official app.
speed_default_dynamic='9' # min 1, max 11, default 9
tencolors_default_dynamic='255 0 0,0 255 0,255 100 0,0 0 255,238 238 0,128 0 128,0 109 119,255 200 0,255 85 255,60 125 255' # 30 comma/space separated values from 0 to 255
#twilight
mode_hex_twilight='0a' # DO NOT EDIT AT ALL!
speeds_hex_twilight='30 35 3a 3f 44 49 4e 53 58 5d 62' # DO NOT EDIT AT ALL! This is a guess, need to find actual hex values set by official app.
speed_default_twilight='9' # min 1, max 11, default 9
#teleport
mode_hex_teleport='05' # DO NOT EDIT AT ALL!
speeds_hex_teleport='13 15 17 19 1b 1d 1f 21 23 25 27' # DO NOT EDIT AT ALL! This is a guess, need to find actual hex values set by official app.
speed_default_teleport='10' # min 1, max 11, default 10
lengths_hex_teleport='01 02 03 04 05 06 07 08 09 0a 0b 0c' # DO NOT EDIT AT ALL! This is a guess, need to find actual hex values set by official app.
length_default_teleport='3' # min 1, max 12, default 3
tencolors_default_teleport='255 0 0,0 255 0,255 100 0,0 0 255,238 238 0,128 0 128,0 109 119,255 200 0,255 85 255,60 125 255' # 30 comma/space separated values from 0 to 255
backcolor_default_rhythm='0 0 0' # 3 comma/space separated values from 0 to 255
direction_default_teleport='up' # up or down, default up (NOT AVAILABLE IN THE OFFICIAL APP)
#flame
mode_hex_flame='09' # DO NOT EDIT AT ALL!
speeds_hex_flame='30 35 3a 3f 44 49 4e 53 58 5d 62' # DO NOT EDIT AT ALL! This is a guess, need to find actual hex values set by official app.
speed_default_flame='1' # min 1, max 11, default 1
direction_default_flame='up' # up or down, default up. This is a guess, need to find actual default value in the official app.
#voltage
mode_hex_voltage='07' # DO NOT EDIT AT ALL!
speeds_hex_voltage='30 35 3a 3f 44 49 4e 53 58 5d 62' # DO NOT EDIT AT ALL! This is a guess, need to find actual hex values set by official app.
speed_default_voltage='3' # min 1, max 11, default 3
tencolors_default_voltage='255 0 0,0 255 0,255 100 0,0 0 255,238 238 0,128 0 128,0 109 119,255 200 0,255 85 255,60 125 255' # 30 comma/space separated values from 0 to 255
backcolor_default_rhythm='0 0 0' # 3 comma/space separated values from 0 to 255
#countdown
mode_hex_countdown='08' # DO NOT EDIT AT ALL!
speeds_hex_countdown='13 15 17 19 1b 1d 1f 21 23 25 27' # DO NOT EDIT AT ALL! This is a guess, need to find actual hex values set by official app.
speed_default_countdown='1' # min 1, max 11, default 1
tencolors_default_countdown='255 0 0,0 255 0,255 100 0,0 0 255,238 238 0,128 0 128,0 109 119,255 200 0,255 85 255,60 125 255' # 30 comma/space separated values from 0 to 255
backcolor_default_rhythm='0 0 0' # 3 comma/space separated values from 0 to 255
direction_default_countdown='up' # up or down, default up. This is a guess, need to find actual default value in the official app.
#rhythm
mode_hex_rhythm='02' # DO NOT EDIT AT ALL!
speeds_hex_rhythm='00 06 0c 12 18 1e 24 2a 30 36 3c' # DO NOT EDIT AT ALL! This is a guess, need to find actual hex values set by official app.
speed_default_rhythm='11' # min 1, max 11, default 11
delays_hex_rhythm='01 02 03 04' # DO NOT EDIT AT ALL! This is a guess, need to find actual hex values set by official app.
delay_default_rhythm='2' # min 1, max 4, default 2
tencolors_default_rhythm='255 0 0,0 255 0,255 100 0,0 0 255,238 238 0,128 0 128,0 109 119,255 200 0,255 85 255,60 125 255' # 30 comma/space separated values from 0 to 255
backcolor_default_rhythm='0 0 0' # 3 comma/space separated values from 0 to 255
direction_default_rhythm='down' # up or down, default down (NOT AVAILABLE IN THE OFFICIAL APP)
#slither
mode_hex_slither='' # DO NOT EDIT AT ALL!
#common
brightness_default='80' # DO NOT EDIT AT ALL!
direction_hex_up='01' # DO NOT EDIT AT ALL!
direction_hex_down='02' # DO NOT EDIT AT ALL!
#ramslots
ramslot_one_hex='60' # DO NOT EDIT AT ALL!
ramslot_two_hex='61' # DO NOT EDIT AT ALL!
ramslot_three_hex='62' # DO NOT EDIT AT ALL!
ramslot_four_hex='63' # DO NOT EDIT AT ALL!
ramslot_five_hex='64' # DO NOT EDIT AT ALL!
ramslot_six_hex='65' # DO NOT EDIT AT ALL!
ramslot_seven_hex='66' # DO NOT EDIT AT ALL!
ramslot_eight_hex='67' # DO NOT EDIT AT ALL!
#inizialize mode
inizialize_mode_write='53' # DO NOT EDIT AT ALL!
inizialize_mode_to='08' # DO NOT EDIT AT ALL!
set_mode_to='09' # DO NOT EDIT AT ALL!
#speed
set_speed_to='0e' # DO NOT EDIT AT ALL!
#delay
set_delay_to='0d' # DO NOT EDIT AT ALL!
#length
set_length_to='26' # DO NOT EDIT AT ALL!
#tencolors
set_tencolorsnumber_to='30' # DO NOT EDIT AT ALL!
set_tencolor_1_red_to='31' # DO NOT EDIT AT ALL!
set_tencolor_1_green_to='32' # DO NOT EDIT AT ALL!
set_tencolor_1_blue_to='33' # DO NOT EDIT AT ALL!
set_tencolor_2_red_to='34' # DO NOT EDIT AT ALL!
set_tencolor_2_green_to='35' # DO NOT EDIT AT ALL!
set_tencolor_2_blue_to='36' # DO NOT EDIT AT ALL!
set_tencolor_3_red_to='37' # DO NOT EDIT AT ALL!
set_tencolor_3_green_to='38' # DO NOT EDIT AT ALL!
set_tencolor_3_blue_to='39' # DO NOT EDIT AT ALL!
set_tencolor_4_red_to='3a' # DO NOT EDIT AT ALL!
set_tencolor_4_green_to='3b' # DO NOT EDIT AT ALL!
set_tencolor_4_blue_to='3c' # DO NOT EDIT AT ALL!
set_tencolor_5_red_to='3d' # DO NOT EDIT AT ALL!
set_tencolor_5_green_to='3e' # DO NOT EDIT AT ALL!
set_tencolor_5_blue_to='3f' # DO NOT EDIT AT ALL!
set_tencolor_6_red_to='40' # DO NOT EDIT AT ALL!
set_tencolor_6_green_to='41' # DO NOT EDIT AT ALL!
set_tencolor_6_blue_to='42' # DO NOT EDIT AT ALL!
set_tencolor_7_red_to='43' # DO NOT EDIT AT ALL!
set_tencolor_7_green_to='44' # DO NOT EDIT AT ALL!
set_tencolor_7_blue_to='45' # DO NOT EDIT AT ALL!
set_tencolor_8_red_to='46' # DO NOT EDIT AT ALL!
set_tencolor_8_green_to='47' # DO NOT EDIT AT ALL!
set_tencolor_8_blue_to='48' # DO NOT EDIT AT ALL!
set_tencolor_9_red_to='49' # DO NOT EDIT AT ALL!
set_tencolor_9_green_to='4a' # DO NOT EDIT AT ALL!
set_tencolor_9_blue_to='4b' # DO NOT EDIT AT ALL!
set_tencolor_10_red_to='4c' # DO NOT EDIT AT ALL!
set_tencolor_10_green_to='4d' # DO NOT EDIT AT ALL!
set_tencolor_10_blue_to='4e' # DO NOT EDIT AT ALL!
#backcolor
set_backcolor_red_to='23' # DO NOT EDIT AT ALL!
set_backcolor_green_to='24' # DO NOT EDIT AT ALL!
set_backcolor_blue_to='25' # DO NOT EDIT AT ALL!
#allcolor
set_allcolor_red_to='31' # DO NOT EDIT AT ALL!
set_allcolor_green_to='32' # DO NOT EDIT AT ALL!
set_allcolor_blue_to='33' # DO NOT EDIT AT ALL!
#byledcolor
set_byledcolor_1_red_to='50' # DO NOT EDIT AT ALL!
set_byledcolor_1_green_to='51' # DO NOT EDIT AT ALL!
set_byledcolor_1_blue_to='52' # DO NOT EDIT AT ALL!
set_byledcolor_2_red_to='53' # DO NOT EDIT AT ALL!
set_byledcolor_2_green_to='54' # DO NOT EDIT AT ALL!
set_byledcolor_2_blue_to='55' # DO NOT EDIT AT ALL!
set_byledcolor_3_red_to='56' # DO NOT EDIT AT ALL!
set_byledcolor_3_green_to='57' # DO NOT EDIT AT ALL!
set_byledcolor_3_blue_to='58' # DO NOT EDIT AT ALL!
set_byledcolor_4_red_to='59' # DO NOT EDIT AT ALL!
set_byledcolor_4_green_to='5a' # DO NOT EDIT AT ALL!
set_byledcolor_4_blue_to='5b' # DO NOT EDIT AT ALL!
set_byledcolor_5_red_to='5c' # DO NOT EDIT AT ALL!
set_byledcolor_5_green_to='5d' # DO NOT EDIT AT ALL!
set_byledcolor_5_blue_to='5e' # DO NOT EDIT AT ALL!
set_byledcolor_6_red_to='5f' # DO NOT EDIT AT ALL!
set_byledcolor_6_green_to='60' # DO NOT EDIT AT ALL!
set_byledcolor_6_blue_to='61' # DO NOT EDIT AT ALL!
set_byledcolor_7_red_to='62' # DO NOT EDIT AT ALL!
set_byledcolor_7_green_to='63' # DO NOT EDIT AT ALL!
set_byledcolor_7_blue_to='64' # DO NOT EDIT AT ALL!
set_byledcolor_8_red_to='65' # DO NOT EDIT AT ALL!
set_byledcolor_8_green_to='66' # DO NOT EDIT AT ALL!
set_byledcolor_8_blue_to='67' # DO NOT EDIT AT ALL!
set_byledcolor_9_red_to='68' # DO NOT EDIT AT ALL!
set_byledcolor_9_green_to='69' # DO NOT EDIT AT ALL!
set_byledcolor_9_blue_to='6a' # DO NOT EDIT AT ALL!
set_byledcolor_10_red_to='6b' # DO NOT EDIT AT ALL!
set_byledcolor_10_green_to='6c' # DO NOT EDIT AT ALL!
set_byledcolor_10_blue_to='6d' # DO NOT EDIT AT ALL!
set_byledcolor_11_red_to='6e' # DO NOT EDIT AT ALL!
set_byledcolor_11_green_to='6f' # DO NOT EDIT AT ALL!
set_byledcolor_11_blue_to='70' # DO NOT EDIT AT ALL!
set_byledcolor_12_red_to='71' # DO NOT EDIT AT ALL!
set_byledcolor_12_green_to='72' # DO NOT EDIT AT ALL!
set_byledcolor_12_blue_to='73' # DO NOT EDIT AT ALL!
#direction
set_direction_to='0c' # DO NOT EDIT AT ALL!
#brightness
set_brightness_to='20' # DO NOT EDIT AT ALL!
#finalize mode
finalize_mode_write='44' # DO NOT EDIT AT ALL!
}
function check_hex_values() {
hex_values="${1}"
for hex_value in ${hex_values//,/$' '}; do
if ! [[ "${hex_value}" =~ ^[0-9a-fA-F]{2}$ ]]; then
echo -e "\e[1;31m - ${hex_value} is not a valid octet hex value!\e[0m"
error_hex_values='true'
fi
done
}
function check_ramsticks() {
for ramstick in ${ramsticks//,/$' '}; do
if ! [[ "${ramstick}" =~ ^[[:digit:]]$ ]] || [[ "${ramstick}" -lt '1' ]] || [[ "${ramstick}" -gt '8' ]]; then
echo -e "\e[1;31m- option --ramslots: ${ramstick} not valid!\e[0m"
else
if [[ "${ramstick}" = '1' ]]; then
if [[ "${ramslot_one_go}" = 'true' ]]; then
continue
else
ramstick_hex_conf="${ramslot_one_hex}"
ramslot_one_go='true'
fi
elif [[ "${ramstick}" = '2' ]]; then
if [[ "${ramslot_two_go}" = 'true' ]]; then
continue
else
ramstick_hex_conf="${ramslot_two_hex}"
ramslot_two_go='true'
fi
elif [[ "${ramstick}" = '3' ]]; then
if [[ "${ramslot_three_go}" = 'true' ]]; then
continue
else
ramstick_hex_conf="${ramslot_three_hex}"
ramslot_three_go='true'
fi
elif [[ "${ramstick}" = '4' ]]; then
if [[ "${ramslot_four_go}" = 'true' ]]; then
continue
else
ramstick_hex_conf="${ramslot_four_hex}"
ramslot_four_go='true'
fi
elif [[ "${ramstick}" = '5' ]]; then
if [[ "${ramslot_five_go}" = 'true' ]]; then
continue
else
ramstick_hex_conf="${ramslot_five_hex}"
ramslot_five_go='true'
fi
elif [[ "${ramstick}" = '6' ]]; then
if [[ "${ramslot_six_go}" = 'true' ]]; then
continue
else
ramstick_hex_conf="${ramslot_six_hex}"
ramslot_six_go='true'
fi
elif [[ "${ramstick}" = '7' ]]; then
if [[ "${ramslot_seven_go}" = 'true' ]]; then
continue
else
ramstick_hex_conf="${ramslot_seven_hex}"
ramslot_seven_go='true'
fi
elif [[ "${ramstick}" = '8' ]]; then
if [[ "${ramslot_eight_go}" = 'true' ]]; then
continue
else
ramstick_hex_conf="${ramslot_eight_hex}"
ramslot_eight_go='true'
fi
fi
if [[ -z "${ramsticks_hex_conf}" ]]; then
ramsticks_hex_conf="${ramstick_hex_conf}"
else
ramsticks_hex_conf+=",${ramstick_hex_conf}"
fi
if [[ -z "${ram_slots}" ]]; then
ram_slots="${ramstick}"
else
ram_slots+=" - ${ramstick}"
fi
fi
done
if [[ -z "${ramsticks_hex_conf}" ]]; then
error_ramstick='true'
else
ramsticks_hex="${ramsticks_hex_conf}"
fi
}
function select_i2cbus() {
i2cbuses_numbers="$(echo "${i2cbuses}" | grep "^i2c-" | awk '{print $1}' | awk -F'i2c-' '{print $2}')"
echo -e "\e[1;32m- Please select an i2c bus number:\e[0m"
echo "${i2cbuses}"
while true; do
read -p " choose> " i2cbus_number
if [[ ! "${i2cbus_number}" =~ ^[[:digit:]]+$ ]]; then
echo -e "\e[1;31mInvalid choice!\e[0m"
sleep '1'
else
break
fi
done
}
function list_modes() {
local i=0
echo
echo -e "\e[1;32m- Please select a mode:\e[0m"
echo -e "\e[1;32m 0) exit\e[0m"
for exp_mode in ${supported_modes}; do
i=$((i + 1))
if [ ${i} -le 9 ]; then
sp1=" "
else
sp1=""
fi
echo "${sp1}${i}) ${exp_mode}"
done
while true; do
read -rp " choose> " selected_mode
if [[ ! "${selected_mode}" =~ ^[[:digit:]]+$ ]] || [[ "${selected_mode}" -gt "${i}" ]]; then
echo -e "\e[1;31mInvalid choice!\e[0m"
sleep '1'
else
break
fi
done
if [[ "${selected_mode}" -eq '0' ]]; then
echo -e "\e[1;33mexit\e[0m"
exit 0
else
mode="$(echo "${supported_modes}" | awk "{print $"${selected_mode}"}")"
fi
}
function check_mode() {
current_modes="${@}"
unset mode_check
for current_mode in ${current_modes}; do
if [[ "${current_mode}" = "${mode}" ]]; then
mode_check='true'
break
fi
done
if [[ "${mode_check}" = 'true' ]]; then
return 0
else
return 1
fi
}
function check_parameters() {
while true; do
if [[ "${values_for}" = '--tencolors' ]] || [[ "${values_for}" = '--backcolor' ]] || [[ "${values_for}" = '--color' ]] || [[ "${values_for}" = '--byledcolors' ]]; then
if [[ "${randomcolor}" = 'true' ]]; then
set_random_colors
parameters_check="${selected_colors}"
fi
fi
if [[ -z "${parameters_check}" ]] || [[ "${error_values}" = 'true' ]]; then
if [[ "${ask}" = 'true' ]]; then
if [[ "${values_for}" = '--tencolors' ]] || [[ "${values_for}" = '--backcolor' ]] || [[ "${values_for}" = '--color' ]] || [[ "${values_for}" = '--byledcolors' ]]; then
if [[ "${randomcolor}" != 'true' ]]; then
set_colors
fi
parameters_check="${selected_colors}"
elif [[ "${values_for}" = '--speed' ]] || [[ "${values_for}" = '--delay' ]] || [[ "${values_for}" = '--length' ]] || [[ "${values_for}" = '--tencolorsnumber' ]] || [[ "${values_for}" = '--brightness' ]]; then
set_parameters
parameters_check="${selected_parameter}"
fi
else
parameters_check="${parameters_check_default}"
fi
fi
values="${parameters_check}"
check_values
if [[ "${error_values}" = 'true' ]]; then
if [[ "${parameters_check}" = "${parameters_check_default}" ]]; then
echo -e "\e[1;31m Invalid ${values_for} ${parameters_check_default} default values!\e[0m"
echo -e "\e[1;31m Please check the ${values_for} default values for mode ${mode} inside ${kfrgb_name}\e[0m"
ask='true'
fi
else
ask="${ask_stored}"
break
fi
done
}
function set_colors() {
echo
echo -e "\e[1;32m- Please choose a color for option ${values_for} (leave empty for default ${parameters_check_default}):\e[0m"
while true; do
echo -e "\e[0;32m1) Choose a color\e[0m"
echo -e "\e[0;32m2) Set a random color\e[0m"
read -p " choose> " set_color_answer
if [[ -z "${set_color_answer}" ]]; then
selected_colors="${parameters_check_default}"
break
else
if [[ ! "${set_color_answer}" =~ ^[[:digit:]]+$ ]] || [[ "${set_color_answer}" -gt '2' ]] || [[ "${set_color_answer}" -lt '1' ]]; then
echo -e "\e[1;31mInvalid choice!\e[0m"
echo
sleep '1'
elif [[ "${set_color_answer}" -eq '1' ]]; then
set_yad_colors
break
elif [[ "${set_color_answer}" -eq '2' ]]; then
set_random_colors
break
fi
fi
done
}
function set_yad_colors() {
unset selected_colors
color_number='1'
echo
echo -e "\e[0;32m- Please select color for option ${values_for}:\e[0m"
while true; do
while true; do
color="$(yad --color --gtk-palette --init-color=#ff0000 --title='Color selection' --text="Mode: ${mode}; Please select color ${color_number}/$((${max_values} / 3)) for option ${values_for}:" --button=OK --center)"
if [[ -n "${color}" ]]; then
selected_color="$((16#${color:1:2})),$((16#${color:3:2})),$((16#${color:5:2}))"
break
else
exit 0
fi
done
selected_color_hex="$(printf '%02x' ${selected_color//,/$' '})"
perl -e ' foreach $a(@ARGV){print "[ \e[48:2::".join(":",unpack("C*",pack("H*",$a)))."m \e[49m ]"};print ""' "${selected_color_hex}"
if [[ -z "${selected_colors}" ]]; then
selected_colors="${selected_color}"
else
selected_colors+=",${selected_color}"
fi
if [[ "$(echo ${selected_colors//,/$' '} | wc -w)" -eq "${max_values}" ]]; then
break
elif [[ "$(echo ${selected_colors//,/$' '} | wc -w)" -gt "${max_values}" ]]; then
exit 1
fi
color_number="$(("${color_number}" + 1))"
done
echo
}
function set_random_colors() {
unset random_colors
while true; do
if [[ "$(echo ${random_colors//,/$' '} | wc -w)" -eq "${max_values}" ]]; then
selected_colors="${random_colors}"
break
elif [[ "$(echo ${random_colors//,/$' '} | wc -w)" -gt "${max_values}" ]]; then
exit 1
fi
random_color_count='0'
unset random_color
while true; do
random_value="$(echo $(( $RANDOM % 255)))"
if [[ -z "${random_color}" ]]; then
random_color="${random_value}"
else
random_color+=" ${random_value}"
fi
random_color_count="$(("${random_color_count}" + 1))"
if [[ "${random_color_count}" = '3' ]]; then
if [[ "${random_color}" = '0 0 0' ]] || echo "${random_colors}" | grep -q "${random_color}"; then
random_color_count='0'
unset random_color
fi
else
break
fi
done
if [[ -z "${random_colors}" ]]; then
random_colors="${random_color}"
else
random_colors+=", ${random_color}"
fi
done
}
function set_parameters() {
echo
echo -e "\e[1;32m- Please enter a value between ${min_value} and ${max_value} for option ${values_for} (leave empty for default ${parameters_check_default}):\e[0m"
while true; do
read -rp " enter a value> " selected_parameter
if [[ -z "${selected_parameter}" ]]; then
selected_parameter="${parameters_check_default}"
break
elif [[ ! "${selected_parameter}" =~ ^[[:digit:]]+$ ]] || [[ "${selected_parameter}" -lt "${min_value}" ]] || [[ "${selected_parameter}" -gt "${max_value}" ]]; then
echo -e "\e[1;31mInvalid choice!\e[0m"
sleep '1'
else
break
fi
done
}
function check_modes() {
# check speed
if check_mode "${supported_speed}"; then
values_for='--speed'
min_value='1'
max_value='11'
max_values='1'
parameters_check="${speed}"
parameters_check_default="${speed_default}"
check_parameters
speed="${parameters_check}"
speed_hex="$(echo "${speeds_hex}" | awk '{ for (i=NF; i>1; i--) printf("%s ",$i); print $1; }' | awk "{print $"${speed}"}")"
fi
# check delay
if check_mode "${supported_delay}"; then
values_for='--delay'
min_value='1'
max_value="${delay_max}"
max_values='1'
parameters_check="${delay}"
parameters_check_default="${delay_default}"
check_parameters
delay="${parameters_check}"
delay_hex="$(echo "${delays_hex}" | awk "{print $"${delay}"}")"
fi
# check length
if check_mode "${supported_length}"; then
values_for='--length'
min_value='1'
max_value="${length_max}"
max_values='1'
parameters_check="${length}"
parameters_check_default="${length_default}"
check_parameters
length="${parameters_check}"
length_hex="$(echo "${lengths_hex}" | awk "{print $"${length}"}")"
fi
# check tencolorsnumber
if check_mode "${supported_tencolors}"; then
values_for='--tencolorsnumber'
min_value='1'
max_value='10'
max_values='1'
parameters_check="${tencolorsnumber}"
parameters_check_default="${max_value}"
check_parameters
tencolorsnumber="${parameters_check}"
tencolorsnumber_hex="$(printf '%02x\n' ${tencolorsnumber})"
# check tencolors
values_for='--tencolors'
min_value='0'
max_value='255'
max_values="$(("${tencolorsnumber}" * 3))"
parameters_check="${tencolors}"
current_tencolor_number='0'
for tencolor_default in ${tencolors_default//,/$' '}; do
if [[ -z "${tencolors_default_max_values}" ]]; then
tencolors_default_max_values="${tencolor_default}"
else
tencolors_default_max_values+=" ${tencolor_default}"
fi
current_tencolor_number="$(("${current_tencolor_number}" + 1))"
if [[ "${current_tencolor_number}" = "${max_values}" ]]; then
break
fi
done
tencolors_default="${tencolors_default_max_values}"
parameters_check_default="${tencolors_default}"
check_parameters
tencolors="${parameters_check}"
for tencolor in ${tencolors//,/$' '}; do
if [[ -z "${tencolors_hex}" ]]; then
tencolors_hex="$(printf '%02x\n' ${tencolor})"
else
tencolors_hex+=" $(printf '%02x\n' ${tencolor})"
fi
done
until [[ "$(echo "${tencolors_hex}" | wc -w)" = '30' ]]; do
tencolors_hex+=' 00'
done
tencolor_1_red_hex="$(echo ${tencolors_hex} | awk '{print $1}')"
tencolor_1_green_hex="$(echo ${tencolors_hex} | awk '{print $2}')"
tencolor_1_blue_hex="$(echo ${tencolors_hex} | awk '{print $3}')"
tencolor_2_red_hex="$(echo ${tencolors_hex} | awk '{print $4}')"
tencolor_2_green_hex="$(echo ${tencolors_hex} | awk '{print $5}')"
tencolor_2_blue_hex="$(echo ${tencolors_hex} | awk '{print $6}')"
tencolor_3_red_hex="$(echo ${tencolors_hex} | awk '{print $7}')"
tencolor_3_green_hex="$(echo ${tencolors_hex} | awk '{print $8}')"
tencolor_3_blue_hex="$(echo ${tencolors_hex} | awk '{print $9}')"
tencolor_4_red_hex="$(echo ${tencolors_hex} | awk '{print $10}')"
tencolor_4_green_hex="$(echo ${tencolors_hex} | awk '{print $11}')"
tencolor_4_blue_hex="$(echo ${tencolors_hex} | awk '{print $12}')"
tencolor_5_red_hex="$(echo ${tencolors_hex} | awk '{print $13}')"
tencolor_5_green_hex="$(echo ${tencolors_hex} | awk '{print $14}')"
tencolor_5_blue_hex="$(echo ${tencolors_hex} | awk '{print $15}')"
tencolor_6_red_hex="$(echo ${tencolors_hex} | awk '{print $16}')"
tencolor_6_green_hex="$(echo ${tencolors_hex} | awk '{print $17}')"
tencolor_6_blue_hex="$(echo ${tencolors_hex} | awk '{print $18}')"
tencolor_7_red_hex="$(echo ${tencolors_hex} | awk '{print $19}')"
tencolor_7_green_hex="$(echo ${tencolors_hex} | awk '{print $20}')"
tencolor_7_blue_hex="$(echo ${tencolors_hex} | awk '{print $21}')"
tencolor_8_red_hex="$(echo ${tencolors_hex} | awk '{print $22}')"
tencolor_8_green_hex="$(echo ${tencolors_hex} | awk '{print $23}')"
tencolor_8_blue_hex="$(echo ${tencolors_hex} | awk '{print $24}')"
tencolor_9_red_hex="$(echo ${tencolors_hex} | awk '{print $25}')"
tencolor_9_green_hex="$(echo ${tencolors_hex} | awk '{print $26}')"
tencolor_9_blue_hex="$(echo ${tencolors_hex} | awk '{print $27}')"
tencolor_10_red_hex="$(echo ${tencolors_hex} | awk '{print $28}')"
tencolor_10_green_hex="$(echo ${tencolors_hex} | awk '{print $29}')"
tencolor_10_blue_hex="$(echo ${tencolors_hex} | awk '{print $30}')"
fi
# check backcolor
if check_mode "${supported_backcolor}"; then
values_for='--backcolor'
min_value='0'
max_value='255'
max_values='3'
parameters_check="${backcolor}"
parameters_check_default="${backcolor_default}"
check_parameters
backcolor="${parameters_check}"
for bcolor in ${backcolor//,/$' '}; do
if [[ -z "${backcolor_hex}" ]]; then
backcolor_hex="$(printf '%02x\n' ${bcolor})"
else
backcolor_hex+=" $(printf '%02x\n' ${bcolor})"
fi
done
until [[ "$(echo "${backcolor_hex}" | wc -w)" = '3' ]]; do
backcolor_hex+=' 00'
done
backcolor_red_hex="$(echo ${backcolor_hex} | awk '{print $1}')"
backcolor_green_hex="$(echo ${backcolor_hex} | awk '{print $2}')"
backcolor_blue_hex="$(echo ${backcolor_hex} | awk '{print $3}')"
fi
# check allcolor
if check_mode "${supported_allcolor}"; then
values_for='--color'
min_value='0'
max_value='255'
max_values='3'
parameters_check="${color}"
parameters_check_default="${color_default}"
check_parameters
color="${parameters_check}"
for allcolor in ${color//,/$' '}; do
if [[ -z "${allcolor_hex}" ]]; then
allcolor_hex="$(printf '%02x\n' ${allcolor})"
else
allcolor_hex+=" $(printf '%02x\n' ${allcolor})"
fi
done
until [[ "$(echo "${allcolor_hex}" | wc -w)" = '3' ]]; do
allcolor_hex+=' 00'
done
allcolor_red_hex="$(echo ${allcolor_hex} | awk '{print $1}')"
allcolor_green_hex="$(echo ${allcolor_hex} | awk '{print $2}')"
allcolor_blue_hex="$(echo ${allcolor_hex} | awk '{print $3}')"
fi
# check byledcolors
if check_mode "${supported_byledcolor}"; then
values_for='--byledcolors'
min_value='0'
max_value='255'
max_values='36'
parameters_check="${byledcolors}"
parameters_check_default="${byledcolors_default}"
check_parameters
byledcolors="${parameters_check}"
for byledcolor in ${byledcolors//,/$' '}; do
if [[ -z "${byledcolors_hex}" ]]; then
byledcolors_hex="$(printf '%02x\n' ${byledcolor})"
else
byledcolors_hex+=" $(printf '%02x\n' ${byledcolor})"
fi
done
until [[ "$(echo "${byledcolors_hex}" | wc -w)" = '36' ]]; do
byledcolors_hex+=' 00'
done
byledcolor_1_red_hex="$(echo ${byledcolors_hex} | awk '{print $1}')"
byledcolor_1_green_hex="$(echo ${byledcolors_hex} | awk '{print $2}')"
byledcolor_1_blue_hex="$(echo ${byledcolors_hex} | awk '{print $3}')"
byledcolor_2_red_hex="$(echo ${byledcolors_hex} | awk '{print $4}')"
byledcolor_2_green_hex="$(echo ${byledcolors_hex} | awk '{print $5}')"
byledcolor_2_blue_hex="$(echo ${byledcolors_hex} | awk '{print $6}')"
byledcolor_3_red_hex="$(echo ${byledcolors_hex} | awk '{print $7}')"
byledcolor_3_green_hex="$(echo ${byledcolors_hex} | awk '{print $8}')"
byledcolor_3_blue_hex="$(echo ${byledcolors_hex} | awk '{print $9}')"
byledcolor_4_red_hex="$(echo ${byledcolors_hex} | awk '{print $10}')"
byledcolor_4_green_hex="$(echo ${byledcolors_hex} | awk '{print $11}')"
byledcolor_4_blue_hex="$(echo ${byledcolors_hex} | awk '{print $12}')"
byledcolor_5_red_hex="$(echo ${byledcolors_hex} | awk '{print $13}')"
byledcolor_5_green_hex="$(echo ${byledcolors_hex} | awk '{print $14}')"
byledcolor_5_blue_hex="$(echo ${byledcolors_hex} | awk '{print $15}')"
byledcolor_6_red_hex="$(echo ${byledcolors_hex} | awk '{print $16}')"
byledcolor_6_green_hex="$(echo ${byledcolors_hex} | awk '{print $17}')"
byledcolor_6_blue_hex="$(echo ${byledcolors_hex} | awk '{print $18}')"
byledcolor_7_red_hex="$(echo ${byledcolors_hex} | awk '{print $19}')"
byledcolor_7_green_hex="$(echo ${byledcolors_hex} | awk '{print $20}')"
byledcolor_7_blue_hex="$(echo ${byledcolors_hex} | awk '{print $21}')"
byledcolor_8_red_hex="$(echo ${byledcolors_hex} | awk '{print $22}')"
byledcolor_8_green_hex="$(echo ${byledcolors_hex} | awk '{print $23}')"
byledcolor_8_blue_hex="$(echo ${byledcolors_hex} | awk '{print $24}')"
byledcolor_9_red_hex="$(echo ${byledcolors_hex} | awk '{print $25}')"
byledcolor_9_green_hex="$(echo ${byledcolors_hex} | awk '{print $26}')"
byledcolor_9_blue_hex="$(echo ${byledcolors_hex} | awk '{print $27}')"
byledcolor_10_red_hex="$(echo ${byledcolors_hex} | awk '{print $28}')"
byledcolor_10_green_hex="$(echo ${byledcolors_hex} | awk '{print $29}')"
byledcolor_10_blue_hex="$(echo ${byledcolors_hex} | awk '{print $30}')"
byledcolor_11_red_hex="$(echo ${byledcolors_hex} | awk '{print $31}')"
byledcolor_11_green_hex="$(echo ${byledcolors_hex} | awk '{print $32}')"
byledcolor_11_blue_hex="$(echo ${byledcolors_hex} | awk '{print $33}')"
byledcolor_12_red_hex="$(echo ${byledcolors_hex} | awk '{print $34}')"
byledcolor_12_green_hex="$(echo ${byledcolors_hex} | awk '{print $35}')"
byledcolor_12_blue_hex="$(echo ${byledcolors_hex} | awk '{print $36}')"
fi
# check direction
if check_mode "${supported_direction}"; then
while true; do
if [[ "${direction}" != 'up' ]] && [[ "${direction}" != 'down' ]]; then
if [[ -z "${direction}" ]]; then
true
else
echo
echo -e "\e[1;31m- option --direction: ${direction} not valid!\e[0m"
echo -e "\e[1;31m accepted values are 'up' or 'down'\e[0m"
fi
if [[ "${ask}" = 'true' ]]; then
echo
echo -e "\e[1;32m- Please enter a value between 'up' and 'down' for option --direction (leave empty for default ${direction_default}):\e[0m"
while true; do
read -rp " enter a value> " selected_direction
selected_direction="${selected_direction,,}"
if [[ -z "${selected_direction}" ]]; then
direction="${direction_default}"
break
elif [[ "${selected_direction}" != 'up' ]] && [[ "${selected_direction}" != 'down' ]]; then
echo -e "\e[1;31mInvalid choice!\e[0m"
sleep '1'
else
direction="${selected_direction}"
break
fi
done
else
if [[ "${direction_default}" != 'up' ]] && [[ "${direction_default}" != 'down' ]]; then
echo
echo -e "\e[1;31m Invalid --direction ${direction_default} default values!\e[0m"
echo -e "\e[1;31m Please check the --direction default values for mode ${mode} inside ${kfrgb_name}\e[0m"
ask='true'
else
direction="${direction_default}"
break
fi
fi
else
ask="${ask_stored}"
break
fi
done
if [[ "${direction}" = 'up' ]]; then
direction_hex="${direction_hex_up}"
elif [[ "${direction}" = 'down' ]]; then
direction_hex="${direction_hex_down}"
fi
fi
# check brightness
values_for='--brightness'
min_value='0'
max_value='100'
max_values='1'
parameters_check="${brightness}"
parameters_check_default="${brightness_default}"
check_parameters
brightness="${parameters_check}"
brightness_hex="$(printf '%02x\n' ${brightness})"
}
function config_modes() {
if [[ "${mode}" = 'rainbow' ]]; then
mode_hex="${mode_hex_rainbow}"
speeds_hex="${speeds_hex_rainbow}"
speed_default="${speed_default_rainbow}"
direction_default="${direction_default_rainbow,,}"
elif [[ "${mode}" = 'prism' ]]; then
mode_hex="${mode_hex_prism}"
speeds_hex="${speeds_hex_prism}"
speed_default="${speed_default_prism}"
delays_hex="${delays_hex_prism}"
delay_default="${delay_default_prism}"
elif [[ "${mode}" = 'spectrum' ]]; then
mode_hex="${mode_hex_spectrum}"
speeds_hex="${speeds_hex_spectrum}"
speed_default="${speed_default_spectrum}"
delays_hex="${delays_hex_spectrum}"
delay_default="${delay_default_spectrum}"
direction_default="${direction_default_spectrum,,}"
elif [[ "${mode}" = 'slide' ]]; then
mode_hex="${mode_hex_slide}"
speeds_hex="${speeds_hex_slide}"
speed_default="${speed_default_slide}"
delays_hex="${delays_hex_slide}"
delay_default="${delay_default_slide}"
lengths_hex="${lengths_hex_slide}"
length_default="${length_default_slide}"
tencolors_default="${tencolors_default_slide}"
backcolor_default="${backcolor_default_slide}"
direction_default="${direction_default_slide,,}"
elif [[ "${mode}" = 'wind' ]]; then
mode_hex="${mode_hex_wind}"
speeds_hex="${speeds_hex_wind}"
speed_default="${speed_default_wind}"
delays_hex="${delays_hex_wind}"
delay_default="${delay_default_wind}"
lengths_hex="${lengths_hex_wind}"
length_default="${length_default_wind}"
tencolors_default="${tencolors_default_wind}"
backcolor_default="${backcolor_default_wind}"
direction_default="${direction_default_wind,,}"
elif [[ "${mode}" = 'static' ]]; then
mode_hex="${mode_hex_static}"
color_default="${color_default_static}"
elif [[ "${mode}" = 'static_byledcolor' ]]; then
mode_hex="${mode_hex_static_byledcolor}"
byledcolors_default="${byledcolors_default_static_byledcolor}"
elif [[ "${mode}" = 'lightspeed' ]]; then
mode_hex="${mode_hex_lightspeed}"
speeds_hex="${speeds_hex_lightspeed}"
speed_default="${speed_default_lightspeed}"
delays_hex="${delays_hex_lightspeed}"
delay_default="${delay_default_lightspeed}"
lengths_hex="${lengths_hex_lightspeed}"
length_default="${length_default_lightspeed}"
tencolors_default="${tencolors_default_lightspeed}"
direction_default="${direction_default_lightspeed,,}"
elif [[ "${mode}" = 'rain' ]]; then
mode_hex="${mode_hex_rain}"
speeds_hex="${speeds_hex_rain}"
speed_default="${speed_default_rain}"
tencolors_default="${tencolors_default_rain}"
direction_default="${direction_default_rain,,}"
elif [[ "${mode}" = 'firework' ]]; then
mode_hex="${mode_hex_firework}"
speeds_hex="${speeds_hex_firework}"
speed_default="${speed_default_firework}"
tencolors_default="${tencolors_default_firework}"
direction_default="${direction_default_firework,,}"
elif [[ "${mode}" = 'breath' ]]; then
mode_hex="${mode_hex_breath}"
speeds_hex="${speeds_hex_breath}"
speed_default="${speed_default_breath}"
tencolors_default="${tencolors_default_breath}"
elif [[ "${mode}" = 'breath_byledcolor' ]]; then
mode_hex="${mode_hex_breath_byledcolor}"
speeds_hex="${speeds_hex_breath_byledcolor}"
speed_default="${speed_default_breath_byledcolor}"
byledcolors_default="${byledcolors_default_breath_byledcolor}"
elif [[ "${mode}" = 'dynamic' ]]; then
mode_hex="${mode_hex_dynamic}"
speeds_hex="${speeds_hex_dynamic}"
speed_default="${speed_default_dynamic}"
tencolors_default="${tencolors_default_dynamic}"
elif [[ "${mode}" = 'twilight' ]]; then
mode_hex="${mode_hex_twilight}"
speeds_hex="${speeds_hex_twilight}"
speed_default="${speed_default_twilight}"
elif [[ "${mode}" = 'teleport' ]]; then
mode_hex="${mode_hex_teleport}"
speeds_hex="${speeds_hex_teleport}"
speed_default="${speed_default_teleport}"
delays_hex="${delays_hex_teleport}"
delay_default="${delay_default_teleport}"
lengths_hex="${lengths_hex_teleport}"
length_default="${length_default_teleport}"
tencolors_default="${tencolors_default_teleport}"
backcolor_default="${backcolor_default_teleport}"
direction_default="${direction_default_teleport,,}"
elif [[ "${mode}" = 'flame' ]]; then
mode_hex="${mode_hex_flame}"
speeds_hex="${speeds_hex_flame}"
speed_default="${speed_default_flame}"
direction_default="${direction_default_flame,,}"
elif [[ "${mode}" = 'voltage' ]]; then
mode_hex="${mode_hex_voltage}"
speeds_hex="${speeds_hex_voltage}"
speed_default="${speed_default_voltage}"
tencolors_default="${tencolors_default_voltage}"
backcolor_default="${backcolor_default_voltage}"
elif [[ "${mode}" = 'countdown' ]]; then
mode_hex="${mode_hex_countdown}"
speeds_hex="${speeds_hex_countdown}"
speed_default="${speed_default_countdown}"
tencolors_default="${tencolors_default_countdown}"
backcolor_default="${backcolor_default_countdown}"
direction_default="${direction_default_countdown,,}"
elif [[ "${mode}" = 'rhythm' ]]; then
mode_hex="${mode_hex_rhythm}"
speeds_hex="${speeds_hex_rhythm}"
speed_default="${speed_default_rhythm}"
delays_hex="${delays_hex_rhythm}"
delay_default="${delay_default_rhythm}"
tencolors_default="${tencolors_default_rhythm}"
backcolor_default="${backcolor_default_rhythm}"
direction_default="${direction_default_rhythm,,}"
elif [[ "${mode}" = 'slither' ]]; then
mode_hex="${mode_hex_slither}"
fi
if check_mode "${supported_delay}"; then
delay_max="$(echo "${delays_hex}" | wc -w)"
fi
if check_mode "${supported_length}"; then
length_max="$(echo "${lengths_hex}" | wc -w)"
fi
check_modes
}
function check_values() {