I noticed that QPalette had these (see link below), but KColorScheme didn't. Since there is no function to get the number of items in an enum for C++, it seems like it would be useful to have a built-in way to get the total number of items. I will make a follow up patch to reduce the amount of hardcoded values in KColorScheme.
I also removed some enum item value assignments that don't seem to have any use and might cause issues if new enum items are added.
https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/kernel/qpalette.h#n90