feat(Colour): factory method for #RRGGBB color codes#1487
feat(Colour): factory method for #RRGGBB color codes#1487shiftinv merged 4 commits intoDisnakeDev:masterfrom
#RRGGBB color codes#1487Conversation
|
|
Co-authored-by: Zenith <genericusername414@gmail.com> Signed-off-by: Eneg <42005170+Enegg@users.noreply.github.com>
I did expect there being a converter for this, but I'm not convinced this simple method is going to be of much use to it. I can see these two relevant methods: disnake/disnake/ext/commands/converter.py Lines 705 to 714 in 9ebc9de disnake/disnake/ext/commands/converter.py Lines 738 to 757 in 9ebc9de ...but they perform work/validation that goes beyond simply stripping the leading |
shiftinv
left a comment
There was a problem hiding this comment.
...but they perform work/validation that goes beyond simply stripping the leading
#and parsing as base 16. It also seems to support 3-digit#RGBformat.
Hmm, fair enough. Imho, in the long term it would still be beneficial to unify these methods in some way, but for now, lgtm!
Summary
This PR adds a new factory method

.from_hextodisnake.Colourwhich accepts strings in the form of"#RRGGBB".This is particularly useful in code editors that provide a color picker when they detect a color code.
Checklist
uv run nox -s lintuv run nox -s pyright