formatting: colors is now an Enum
#2122
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Following up on an old TODO comment, now possible because we no longer support Python 2. Making this an Enum means it's safe against plugins accidentally (or intentionally) overwriting the color values.
This isn't the appropriate time to address such an issue, but the color name 'TEAL' doesn't exist in mIRC's documentation, nor is it listed at the "horse docs" I also don't know why 'OLIVE' is an alias to 'ORANGE'.
No color names have been changed yet, but I did add comments to point out the issue during future improvements.
Checklist
make qa(runsmake qualityandmake test)Notes
Compatibility
If a plugin is using the 7.x
formatting.colorsclass as documented and intended, no problem. Any code pulling funny business like overriding color names for convenience will have problems, but we're not going to hand-hold people who went s(o)pelunking in the plugin API's innards and messed with stuff. Their code will break, and they'll have to fix it.Future plans
Stuff like 'TEAL' and 'OLIVE' can be deprecated by creating a custom
EnumMetasubclass that (in our case) would invoke thetools.deprecatedmachinery similar to how theValidatedAttributewithparse=boolstuff works in 7.1. However this PR is just to take care of the immediate, easy conversion from a boring, basic class to an Enum. Fancy stuff later!