Hint

Refer to QMK’s documentation for details on how to use community modules

indicators

Declaratively define RGB indicators.

Your configuration would look like:

#include "elpekenin/indicators.h"

const indicator_t PROGMEM indicators[] = {
    LAYER_INDICATOR(UTILS, RGB_COLOR(RGB_OFF)),
    KEYCODE_IN_LAYER_INDICATOR(QK_BOOT, UTILS, HSV_COLOR(HSV_RED)),
    CAPS_LOCK_INDICATOR(HUE(HUE_BLUE)),
};
Since indicators are checked (and applied) in the same order that you define them, this config is:
  • On the layer UTILS, all LEDs will be off except for QK_BOOT which will be red

  • On every layer, if caps is locked, keys assigned to KC_CAPS will be blue (following current saturation and brightness settings)

  • Every other LED/state of the keyboard won’t cause the module to draw, thus preserving QMK’s running animation

Hint

In general, you will use the convenience macros. However, you might need to manually instantiate these data structures to define custom conditions.

struct indicator_args_t
[source]

State about the LED being checked.

Used to tell whether the indicator’s color should be applied.

uint8_t led_index
[source]

Index of the LED.

uint8_t layer
[source]

Highest active layer.

uint16_t keycode
[source]

Keycode currently mapped to the key where LED belongs.

uint8_t mods
[source]

Active modifiers (bitmask).

uint8_t host_leds
[source]

Active host leds.

struct indicator_checks_t
[source]

Different conditions to be checked

bool layer
[source]

Highest active layer is <X>.

bool keycode
[source]

Keycode is exactly <X>.

bool mods
[source]

Modifiers <X> are active (not an exact match, others can be active too).

bool kc_gt_than
[source]

Keycode is greater than <X>.

bool host_leds
[source]

Host leds <x> are active (not an exact match, others can be active too).

struct indicator_t
[source]

An indicator’s specification:

color_t color
[source]

Color to be applied if conditions are fulfilled.

indicator_checks_t checks
[source]

Which conditions have to be checked.

indicator_args_t args
[source]

Values used to check (the <X>s above).

KEYCODE_INDICATOR(_keycode, _color)
[source]

Indicator on any key mapped to the given keycode.

Parameters:
  • _keycode – Value of the keycode.

  • _color – Color to be applied.

LAYER_INDICATOR(_layer, _color)
[source]

Indicator for all LEDs in the given layer.

Parameters:
  • _layer – Where the indicator should fire.

  • _color – Color to be applied.

KEYCODE_IN_LAYER_INDICATOR(_keycode, _layer, _color)
[source]

Indicator on any key mapped to the given keycode in the given layer.

Parameters:
  • _keycode – Value of the keycode.

  • _layer – Where the indicator should fire.

  • _color – Color to be applied.

ASSIGNED_KEYCODE_IN_LAYER_INDICATOR(_layer, _color)
[source]

Indicator on any key that has been mapped in the given layer (ie: is not KC_NO nor KC_TRNS) .

Parameters:
  • _layer – Where the indicator should fire.

  • _color – Color to be applied.

KEYCODE_WITH_MOD_INDICATOR(_keycode, mod_mask, _color)
[source]

Indicator on any key mapped to the given keycode while mods are active.

Parameters:
  • _keycode – Value of the keycode.

  • mod_mask – Bitmask of the modifiers that must be active.

  • _color – Color to be applied.

CUSTOM_KEYCODE_IN_LAYER_INDICATOR(_layer, _color)
[source]

Indicator on any key mapped to a custom keycode in the given layer.

Parameters:
  • _layer – Where the indicator should fire.

  • _color – Color to be applied.

KEYCODE_WITH_HOST_LED_INDICATOR(_keycode, host_mask, _color)
[source]

Indicator on any key mapped to the given keycode while host LEDs are active.

Parameters:
  • _keycode – Value of the keycode.

  • host_mask – Bitmask of the host LEDs that must be active.

  • _color – Color to be applied.

CAPS_LOCK_INDICATOR(_color)
[source]

Indicator for KC_CAPS key(s) while caps lock is active.

Parameters:
  • _color – Color to be applied.

NUM_LOCK_INDICATOR(_color)
[source]

Indicator for KC_NUM key(s) while num lock is active.

Parameters:
  • _color – Color to be applied.