You can use something like this instead to make this easier:
const uint8_t modifierIndex = key.raw - Key_LeftControl.raw;
return Keyboard.lastKeyReport.modifiers & (1 << modifierIndex);
The order of modifiers is set in stone, from bit 0 to 8, it is Left Control, Left Shift, Left Alt, Left Gui, Right Control, Right Shift, Right Alt, Right Gui.
It might make sense to introduce a helper, that would build us a mask. Say,
kaleidoscope::hid::modifierBitMask(Key_LeftControl, Key_LeftShift) would return
(1 << 0) | (1 << 1). This is doable with a little bit of templating, but a PR without this is just as good. The intended use is:
// assuming we're in the kaleidoscope::hid namespace
// return true-ish if Ctrl+Shift was held
return lastActiveModifiers() & modifierBitMask(Key_LeftControl, Key_LeftShift);
Another option is to have
#defines for the various modifiers, stuff one could OR together, but I failed to come up with a good name for those, so went with the helper instead.