sir-lancebot
sir-lancebot copied to clipboard
Colour Command Enhancements
Description
#677 Was recently merged, while we focused on the main functionality on that as described in the issue, this issue proposes a few util commands which help when you are working with colours!
- lighten/darken subcommand
-
.colour lighten #3f6d2a 40
would lighten the colour#3f6d2a
by40
percent i.e. mixing 40% white colour -
.colour darken rgb(1, 92, 23) 50
would darken the colourrgb(1, 92, 23)
by50
percent i.e. mixing 50% black colour - Basic implementation: https://paste.pythondiscord.com/melidodoso.py
-
- Find complement colour
-
.colour complement rgb(1, 2, 3)
would find the opposite colour ofrgb(1, 2, 3)
on the colour wheel i.e. the complementary colour. - Implementation: https://stackoverflow.com/a/40234511/14863850
-
- Colour palletes as suggested by @hedyhli
- Alpha values support (https://github.com/python-discord/sir-lancebot/pull/842#discussion_r747189204)
Would you like to implement this yourself?
- [ ] I'd like to implement this feature myself
- [X] Anyone can implement this feature
Thanks for including my suggestions!
Maybe we should come up with a standardized and user-friendly way to represent color values. I can think of three ways this can be done if we're implementing a mini parser to let users specify more than one color (especially for color schemes feature, or even the ability to show information on multiple colors at the same time):
Single argument
If it was a single argument (so no space allowed unless we use or implement a .split()
that respects parenthesis, which IMO is a bit of an overkill), it would work for color names and hex values such as red
, #fff
, lavender
as arguments, but it wouldn't work for other values, as it would look weird and unintuitive from a user's perspective like with rgb(0,0,0)
or hsl(0,100,50)
.
Two arguments
This isn't hard to parse plus it follows how the current implementation is like, e.g.: .color name blue
, color rgb 1 2 3
. But the problem is that the number of arguments that follows the value type may vary -- 0 for random, 1 for hex, name, 3 for rgb, hsl, hsv, and 4 for cmyk. So with the proposed command enhancements would like like color lighten rgb 255 0 0
.
Either of the two
-
.color lighten red
-
.color darken hex #000
-
.color darken rgb 112 255 0
-
.color complement random
If we aren't considering the possibility to specify multiple color values in a single command, I think the last solution would be the best -- it isn't that hard to implement and it's consistent with the current usage. We can have a static function that parses the color value type and it can be shared when we add subcommands like lighten and darken.
What I would like to see, is a 🔁 reaction that shows up after .color random
, that allows you to quickly randomize colors. The existing embed would be edited rather than creating a new one each time
Personally, I like the idea of a complement or other color harmony command, however I don't see much utility of one for darken / lighten. If you really needed to darken or lighten a color, you could take the hsl
part of your color and modify the lightness attribute.
The option to allow users to specify more than one color in a single command would be useful. I had an idea for an alternative approach. A "➕" reaction would show up after color embeds that lets the user save the color into their temporary "palette" in memory. Once the user is ready to see the palette, all of the colors the person has chosen will be combined into an embed and displayed. This could alternatively be paired with a command equivalent which saves the last recent color command into memory.
One thing that's bugging me with the current implementation is that we don't filter out brackets and commas from the input of commands. For example, .color hsv (326, 95, 95)
is not valid, even though that's how the color is displayed in the embed. I think this could be solved If we were to come up with a parser like @hedyhli suggests.
In regards to color palettes, how would we display the information and color preview for more than one color at once? Doesn't Discord only allow one image per embed - awkwardly placed in the corner at that?
I'd also like to see something like .colour list 87ceeb ff0000 ffaabb
which would show an image like: