aboutsummaryrefslogtreecommitdiff
path: root/color-picker.h
blob: 9aa9f1f0fc141ce4ea620be76028e09c9dd7f6c0 (plain)
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
// -*- mode: c++ -*- 
#pragma once
 
#include <Kaleidoscope-LEDControl.h>
 
class ColorPicker : public kaleidoscope::plugin::LEDMode {
public:
  ColorPicker(void) : current_index(0), colors{}, map{} { }
 
  kaleidoscope::EventHandlerResult onKeyswitchEvent(Key &mapped_key, byte row, byte col, uint8_t key_state) {
    if (!Kaleidoscope.has_leds || !is_active())
      return kaleidoscope::EventHandlerResult::OK;
 
    return kaleidoscope::EventHandlerResult::EVENT_CONSUMED;
  }
 
private:
  uint8_t current_index;
  cRGB colors[16];
  uint8_t map[ROWS][COLS];
 
  bool is_active() {
    return LEDControl.get_mode() == this;
  }
};
 
ColorPicker theColorPicker;