summaryrefslogtreecommitdiffstats
path: root/keyboards/keebio/iris/keymaps/khang/colors.h
blob: 245e76a8c21f22fb4cf35838f63d223f2aec9b9c (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
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
/* Copyright 2021 Nguyen Vu Khang <brew4k@gmail.com>
  * 
  * This program is free software: you can redistribute it and/or modify 
  * it under the terms of the GNU General Public License as published by 
  * the Free Software Foundation, either version 2 of the License, or 
  * (at your option) any later version. 
  * 
  * This program is distributed in the hope that it will be useful, 
  * but WITHOUT ANY WARRANTY; without even the implied warranty of 
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
  * GNU General Public License for more details. 
  * 
  * You should have received a copy of the GNU General Public License 
  * along with this program.  If not, see <http://www.gnu.org/licenses/>. 
  */ 

#pragma once

#define MINIMAL_BASEx(hue,sat) \
    rgblight_sethsv_range(hue, sat, 0, 0, 12); \
    rgblight_sethsv_range(hue, sat, 100, 5, 7)

#define MINIMAL_BASE(hue, sat) \
    {0, 12, hue, sat, 0}, \
    {5, 2, hue, sat, 100}

#define MINIMAL(hue, sat) \
    {0, 12, hue, sat, 0}, \
    {3, 1, hue, sat, 100}, \
    {8, 1, hue, sat, 100}

const int yellow = 30;
const int green = 99;
const int red = 252;
const int base_sat = 120;

const rgblight_segment_t PROGMEM _BL_rgblayer[] = RGBLIGHT_LAYER_SEGMENTS(
    MINIMAL_BASE(yellow,250)
);
const rgblight_segment_t PROGMEM _FN_rgblayer[] = RGBLIGHT_LAYER_SEGMENTS(
    MINIMAL(green,255)
);
const rgblight_segment_t PROGMEM _SL_rgblayer[] = RGBLIGHT_LAYER_SEGMENTS(
    MINIMAL(red,255)
);

const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(
    _BL_rgblayer,
    _FN_rgblayer,
    _SL_rgblayer
);

void keyboard_post_init_user(void) {
    MINIMAL_BASEx(yellow,200);
    rgblight_layers = my_rgb_layers;
}

layer_state_t default_layer_state_set_user(layer_state_t state) {
    rgblight_set_layer_state(0, layer_state_cmp(state, _BL));
    return state;
}

layer_state_t layer_state_set_user(layer_state_t state) {
    rgblight_set_layer_state(1, layer_state_cmp(state, _FN));
    rgblight_set_layer_state(2, layer_state_cmp(state, _SL));
    return state;
}