This is my first Kaleidoscope plugin that automatically assigns colors to your keys in groups based on their function. When the function layer is active, the LEDs will change to indicate the functions of the keys on that layer.
This should make it pretty easy for anyone to color their keys in such a way that it not only looks the way you want it to, but makes it easy to remember the functionality of each key, particularly useful when you’re reconfiguring your function layer and experimenting with different layouts.
You can download it here:
I am a total noob at both C++ programming and Arduino development, so be warned that I barely know what I’m doing… but so far it seems to work as intended. If anyone can have a look at my code and offer some tips for how I could optimize my plugin to be more efficient, use less memory/cpu, or otherwise work better, I’d be appreciative.
If you use this but want support for keys that I didn’t include (ie for letters in languages other than English), let me know and I’ll try to add them.
The backstory here is that I found it extremely frustrating and difficult to configure per-key colors on the Model 01, and there seemed to be no default means of helping a noobie user do this. I felt like Kaleidoscope could use a few helper functions to make it easier to tweak and easily set key colors.
Since I couldn’t find what I wanted, I wrote my own. Yay for open source!
If you want a fairly simple color scheme with a few keys highlighted, this plugin should help. If you want almost every single key to be a different color based on its function, but most “normal” alphanumeric keys in groups, this makes it easy to create a scheme like that.
To use the plugin, include the header, declare an effect using the
LEDFunctionalColor
class, and tell the firmware to use the new effect.
Configure your own colors for groups of keys inside setup():
// Automatically sets key LEDs on active layer based on the function of the key
#include <Kaleidoscope-LEDEffect-FunctionalColor.h>
// You can make multiple variations of the theme.
// Warning: having several versions consumes a lot of memory!
kaleidoscope::LEDFunctionalColor FunColor;
kaleidoscope::LEDFunctionalColor FunColorMedium;
kaleidoscope::LEDFunctionalColor FunColorLow;
void setup() {
Kaleidoscope.use(&FunColor, &FunColorMedium, &FunColorLow);
Kaleidoscope.setup(
// Optionally Make things more human readable by naming your colors
cRGB antiquewhite = CRGB(250, 235, 215);
cRGB blue = CRGB(0, 0, 255);
cRGB cyan = CRGB(0, 255, 255);
cRGB green = CRGB(0, 128, 0);
cRGB lightskyblue = CRGB(135, 206, 250);
cRGB lime = CRGB(0, 255, 0);
cRGB mintcream = CRGB(245, 255, 250);
cRGB orange = CRGB(255, 165, 0);
cRGB orangered = CRGB(255, 100, 0);
cRGB palegreen = CRGB(152, 251, 152);
cRGB pink = CRGB(255, 192, 203);
cRGB red = CRGB(255, 0, 0);
cRGB skyblue = CRGB(135, 206, 235);
cRGB slateblue = CRGB(106, 90, 205);
cRGB violet = CRGB(238, 130, 238);
cRGB white = CRGB(255, 255, 255);
cRGB yellow = CRGB(255, 255, 0);
cRGB yellowgreen = CRGB(154, 205, 50);
// If your FUNCTION layer is not the default, you must set it here
FunColor.functionLayer = FUNCTION;
// Here we can set custom colors for your FunctionalColor instance.
// You can optionally specify a brightness value, 0-255 to dim your lights.
// Set this first to provide a "default" color for all keys, then override with the other settings.
FunColor.all(CRGB(250, 235, 215));
// Set this second to change all modifiers (non-alphabet/numeric/punctuation keys)
FunColor.allModifiers(CRGB(250, 235, 215));
// Set this before individual mouse settings to change all mouse-related keys
FunColor.allMouse(CRGB(0, 200, 200));
//Set individual groups of colors. You may delete any lines you don't need.
FunColor.escape(red, 170);
FunColor.numbers(white, 160);
FunColor.letters(antiquewhite, 100);
FunColor.punctuation(antiquewhite, 170);
FunColor.brackets(antiquewhite, 200);
FunColor.backslash(antiquewhite, 170);
FunColor.pipe(antiquewhite, 170);
FunColor.tab(white, 170);
FunColor.backspace(red, 170);
FunColor.del(red, 170);
FunColor.enter(white, 170);
FunColor.arrows(white, 170);
FunColor.nav(yellow, 170);
FunColor.insert(yellow, 170);
FunColor.shift(palegreen, 170);
FunColor.ctrl(skyblue, 170);
FunColor.alt(green, 170);
FunColor.cmd(CRGB(250, 235, 215));
FunColor.app(CRGB(250, 235, 215));
FunColor.printscreen(CRGB(250, 235, 215));
FunColor.pause(CRGB(250, 235, 215));
FunColor.scrolllock(CRGB(250, 235, 215));
FunColor.capslock(CRGB(250, 235, 215));
FunColor.fkeys(red, 170);
FunColor.fn(CRGB(250, 235, 215));
FunColor.media(CRGB(250, 235, 215));
FunColor.led(blue, 190);
FunColor.mousemove(cyan, 170);
FunColor.mousebuttons(lightskyblue, 170);
FunColor.mousewarp(cyan, 100);
FunColor.mousescroll(lightskyblue, 100);
//Copy new settings to the dimmed versions
FunColorMedium = FunColor;
FunColorLow = FunColor;
// You could make adjustments to your other versions' groups here, if desired.
// Adjust the brightness of dimmed versions here from 0-255
FunColorMedium.brightness(210);
FunColorLow.brightness(170);
);
}
Simple Easy Config for Noobies
If you are not an experienced programmer and/or don’t know your way around Kaleidoscope, here is a very pared down example of a configuration that you can just paste wholesale over the default firmware to get you started.
// -*- mode: c++ -*-
#include "Kaleidoscope.h"
#include "Kaleidoscope-MouseKeys.h"
#include "Kaleidoscope-LEDControl.h"
#include "Kaleidoscope-NumPad.h"
// Automatically sets key LEDs on active layer based on the function of the key
#include "Kaleidoscope-LEDEffect-FunctionalColor.h"
// You can make multiple variations of the theme.
// Warning: having several versions consumes a lot of memory!
kaleidoscope::LEDFunctionalColor FunColor;
kaleidoscope::LEDFunctionalColor FunColorMedium;
kaleidoscope::LEDFunctionalColor FunColorLow;
enum { QWERTY, NUMPAD, FUNCTION }; // layers
const Key keymaps[][ROWS][COLS] PROGMEM = {
[QWERTY] = KEYMAP_STACKED
(___, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext,
Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab,
Key_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G,
Key_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape,
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift,
ShiftToLayer(FUNCTION),
___, Key_6, Key_7, Key_8, Key_9, Key_0, LockLayer(NUMPAD),
Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Equals,
Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote,
Key_RightAlt, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus,
Key_RightShift, Key_LeftAlt, Key_Spacebar, Key_RightControl,
ShiftToLayer(FUNCTION)),
[NUMPAD] = KEYMAP_STACKED
(___, ___, ___, ___, ___, ___, ___,
___, ___, ___, ___, ___, ___, ___,
___, ___, ___, ___, ___, ___,
___, ___, ___, ___, ___, ___, ___,
___, ___, ___, ___,
___,
___, ___, Key_Keypad7, Key_Keypad8, Key_Keypad9, Key_KeypadSubtract, ___,
___, ___, Key_Keypad4, Key_Keypad5, Key_Keypad6, Key_KeypadAdd, ___,
___, Key_Keypad1, Key_Keypad2, Key_Keypad3, Key_Equals, Key_Quote,
___, ___, Key_Keypad0, Key_KeypadDot, Key_KeypadMultiply, Key_KeypadDivide, Key_Enter,
___, ___, ___, ___,
___),
[FUNCTION] = KEYMAP_STACKED
(___, Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, XXX,
Key_Tab, ___, Key_mouseUp, ___, Key_mouseBtnR, Key_mouseWarpEnd, Key_mouseWarpNE,
Key_Home, Key_mouseL, Key_mouseDn, Key_mouseR, Key_mouseBtnL, Key_mouseWarpNW,
Key_End, Key_PrintScreen, Key_Insert, ___, Key_mouseBtnM, Key_mouseWarpSW, Key_mouseWarpSE,
___, Key_Delete, ___, ___,
___,
Consumer_ScanPreviousTrack, Key_F6, Key_F7, Key_F8, Key_F9, Key_F10, Key_F11,
Consumer_PlaySlashPause, Consumer_ScanNextTrack, Key_LeftCurlyBracket, Key_RightCurlyBracket, Key_LeftBracket, Key_RightBracket, Key_F12,
Key_LeftArrow, Key_DownArrow, Key_UpArrow, Key_RightArrow, ___, ___,
Key_PcApplication, Consumer_Mute, Consumer_VolumeDecrement, Consumer_VolumeIncrement, ___, Key_Backslash, Key_Pipe,
___, ___, Key_Enter, ___,
___)
};
/** The 'setup' function is one of the two standard Arduino sketch functions.
* It's called when your keyboard first powers up. This is where you set up
* Kaleidoscope and any plugins.
*/
void setup() {
// First, call Kaleidoscope's internal setup function
Kaleidoscope.setup();
// Next, tell Kaleidoscope which plugins you want to use.
// The order can be important. For example, LED effects are
// added in the order they're listed here.
Kaleidoscope.use(
// The MouseKeys plugin lets you add keys to your keymap which move the mouse.
&MouseKeys,
&FunColor,&FunColorMedium,&FunColorLow
);
// While we hope to improve this in the future, the NumPad plugin
// needs to be explicitly told which keymap layer is your numpad layer
NumPad.numPadLayer = NUMPAD;
// Optionally Make things more human readable by naming your colors
cRGB antiquewhite = CRGB(250, 235, 215);
cRGB blue = CRGB(0, 0, 255);
cRGB cyan = CRGB(0, 255, 255);
cRGB green = CRGB(0, 128, 0);
cRGB lightskyblue = CRGB(135, 206, 250);
cRGB lime = CRGB(0, 255, 0);
cRGB mintcream = CRGB(245, 255, 250);
cRGB orange = CRGB(255, 165, 0);
cRGB orangered = CRGB(255, 100, 0);
cRGB palegreen = CRGB(152, 251, 152);
cRGB pink = CRGB(255, 192, 203);
cRGB red = CRGB(255, 0, 0);
cRGB skyblue = CRGB(135, 206, 235);
cRGB slateblue = CRGB(106, 90, 205);
cRGB violet = CRGB(238, 130, 238);
cRGB white = CRGB(255, 255, 255);
cRGB yellow = CRGB(255, 255, 0);
cRGB yellowgreen = CRGB(154, 205, 50);
// If your FUNCTION layer is not the default, you must set it here
FunColor.functionLayer = FUNCTION;
// Here we can set custom colors for your FunctionalColor instance.
// You can optionally specify a brightness value, 0-255 to dim your lights.
// Set this first to provide a "default" color for all keys, then override with the other settings.
FunColor.all(CRGB(250, 235, 215));
// Set this second to change all modifiers (non-alphabet/numeric/punctuation keys)
FunColor.allModifiers(CRGB(250, 235, 215));
// Set this before individual mouse settings to change all mouse-related keys
FunColor.allMouse(CRGB(0, 200, 200));
//Set individual groups of colors. You may delete any lines you don't need.
FunColor.escape(red, 170);
FunColor.numbers(white, 160);
FunColor.letters(antiquewhite, 100);
FunColor.punctuation(antiquewhite, 170);
FunColor.brackets(antiquewhite, 200);
FunColor.backslash(antiquewhite, 170);
FunColor.pipe(antiquewhite, 170);
FunColor.tab(white, 170);
FunColor.backspace(red, 170);
FunColor.del(red, 170);
FunColor.enter(white, 170);
FunColor.arrows(white, 170);
FunColor.nav(yellow, 170);
FunColor.insert(yellow, 170);
FunColor.shift(palegreen, 170);
FunColor.ctrl(skyblue, 170);
FunColor.alt(green, 170);
FunColor.cmd(CRGB(250, 235, 215));
FunColor.app(CRGB(250, 235, 215));
FunColor.printscreen(CRGB(250, 235, 215));
FunColor.pause(CRGB(250, 235, 215));
FunColor.scrolllock(CRGB(250, 235, 215));
FunColor.capslock(CRGB(250, 235, 215));
FunColor.fkeys(red, 170);
FunColor.fn(CRGB(250, 235, 215));
FunColor.media(CRGB(250, 235, 215));
FunColor.led(blue, 190);
FunColor.mousemove(cyan, 170);
FunColor.mousebuttons(lightskyblue, 170);
FunColor.mousewarp(cyan, 100);
FunColor.mousescroll(lightskyblue, 100);
//Copy new settings to the dimmed versions
FunColorMedium = FunColor;
FunColorLow = FunColor;
// You could make adjustments to your other versions' groups here, if desired.
// Adjust the brightness of dimmed versions here from 0-255
FunColorMedium.brightness(210);
FunColorLow.brightness(170);
} //end setup - all FunctionalColor object methods must be called before this point
void loop() {
Kaleidoscope.loop();
}