From ba456522412bd8af1424bf5d97ae8d0819089577 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sun, 10 Feb 2019 17:24:40 +0000 Subject: move color themes to their own file --- Model01-Firmware.ino | 55 ++-------------------------------------------------- color-themes.h | 50 +++++++++++++++++++++++++++++++++++++++++++++++ key-classes.h | 12 ++++++++++++ keymaps.h | 2 ++ 4 files changed, 66 insertions(+), 53 deletions(-) create mode 100644 color-themes.h create mode 100644 key-classes.h diff --git a/Model01-Firmware.ino b/Model01-Firmware.ino index 5045e3e..e91c1cc 100644 --- a/Model01-Firmware.ino +++ b/Model01-Firmware.ino @@ -134,60 +134,9 @@ enum { PRIMARY, NUMPAD, FUNCTION, FVWM }; // layers #define PRIMARY_KEYMAP_QWERTY // #define PRIMARY_KEYMAP_DVORAK -typedef enum { - Off, - Base, - Lnch, Wind, View, - Ms, MsB, MsW, - Func, - Num, - NumBreathe, - COLOR_COUNT, -} color_index; - #include "keymap-wrapper.h" -#include "DakkarColor.h" - -const cRGB num_breathe() { return breath_compute(170); } - -#define D_C(r,g,b) ((DakkarColor::colorSrc){ \ - .value_or_function = DakkarColor::colorSrc::VALUE, \ - .vf = { .value = CRGB(r,g,b) } \ -}) -#define D_F(f) ((DakkarColor::colorSrc){ \ - .value_or_function = DakkarColor::colorSrc::FUNCTION, \ - .vf = { .function = f } \ -}) - -static constexpr DakkarColor::colorSrc dark_colors[COLOR_COUNT] = - { - [Off] = D_C(0,0,0), - [Base] = D_C(0,0,0), - [Lnch] = D_C(0,0,150), - [Wind] = D_C(150,0,0), - [View] = D_C(0,150,0), - [Ms] = D_C(100,100,0), - [MsB] = D_C(50,0,50), - [MsW] = D_C(0,50,50), - [Func] = D_C(100,100,150), - [Num] = D_C(150,0,0), - [NumBreathe] = D_F(num_breathe), - }; - -static constexpr DakkarColor::colorSrc bright_colors[COLOR_COUNT] = - { - [Off] = D_C(0,0,0), - [Base] = D_C(50,50,50), - [Lnch] = D_C(0,0,100), - [Wind] = D_C(100,0,0), - [View] = D_C(0,100,0), - [Ms] = D_C(50,50,0), - [MsB] = D_C(30,0,30), - [MsW] = D_C(0,30,30), - [Func] = D_C(50,50,80), - [Num] = D_C(100,0,0), - [NumBreathe] = D_F(num_breathe), - }; + +#include "color-themes.h" static DakkarColor DakkarColorDark(color_keymaps,dark_colors); static DakkarColor DakkarColorBright(color_keymaps,bright_colors); diff --git a/color-themes.h b/color-themes.h new file mode 100644 index 0000000..267c064 --- /dev/null +++ b/color-themes.h @@ -0,0 +1,50 @@ +#pragma once + +#include "DakkarColor.h" + +const cRGB num_breathe() { return breath_compute(170); } + +#define D_C(r,g,b) ((DakkarColor::colorSrc){ \ + .value_or_function = DakkarColor::colorSrc::VALUE, \ + .vf = { .value = CRGB(r,g,b) } \ +}) +#define D_Cn(color) ((DakkarColor::colorSrc){ \ + .value_or_function = DakkarColor::colorSrc::VALUE, \ + .vf = { .value = color } \ +}) +#define D_F(f) ((DakkarColor::colorSrc){ \ + .value_or_function = DakkarColor::colorSrc::FUNCTION, \ + .vf = { .function = f } \ +}) + +// themes could be adapted from https://github.com/jdlien/Kaleidoscope-LEDEffect-FunctionalColor/blob/master/src/Kaleidoscope-LEDEffect-FunctionalColor.h + +static constexpr DakkarColor::colorSrc dark_colors[COLOR_COUNT] = + { + [Off] = D_C(0,0,0), + [Base] = D_C(0,0,0), + [Lnch] = D_C(0,0,150), + [Wind] = D_C(150,0,0), + [View] = D_C(0,150,0), + [Ms] = D_C(100,100,0), + [MsB] = D_C(50,0,50), + [MsW] = D_C(0,50,50), + [Func] = D_C(100,100,150), + [Num] = D_C(150,0,0), + [NumBreathe] = D_F(num_breathe), + }; + +static constexpr DakkarColor::colorSrc bright_colors[COLOR_COUNT] = + { + [Off] = D_C(0,0,0), + [Base] = D_C(50,50,50), + [Lnch] = D_C(0,0,100), + [Wind] = D_C(100,0,0), + [View] = D_C(0,100,0), + [Ms] = D_C(50,50,0), + [MsB] = D_C(30,0,30), + [MsW] = D_C(0,30,30), + [Func] = D_C(50,50,80), + [Num] = D_C(100,0,0), + [NumBreathe] = D_F(num_breathe), + }; diff --git a/key-classes.h b/key-classes.h new file mode 100644 index 0000000..5411474 --- /dev/null +++ b/key-classes.h @@ -0,0 +1,12 @@ +#pragma once + +typedef enum { + Off, + Base, + Lnch, Wind, View, + Ms, MsB, MsW, + Func, + Num, + NumBreathe, + COLOR_COUNT, +} color_index; diff --git a/keymaps.h b/keymaps.h index 781b560..cab7c3c 100644 --- a/keymaps.h +++ b/keymaps.h @@ -1,3 +1,5 @@ +#include "key-classes.h" + ColorKeymaps( #if defined (PRIMARY_KEYMAP_QWERTY) -- cgit v1.2.3