Skip to content

Commit

Permalink
🟦 Removed ansi highlight from /color fields
Browse files Browse the repository at this point in the history
  • Loading branch information
bth123 committed Dec 26, 2024
1 parent 4081578 commit 82ddbb0
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions cogs/minecraft/color.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,17 @@ async def color(self, ctx, *, color: str):
rgba_color = to_rgb_int(rgba_float_color, "rgb_float")
elif color.group("decimal"):
rgba_color = to_rgb_int(int(color.group("color")), "decimal")
colors = list([func(rgba_color) for func in (to_hex, to_rgb_float, to_decimal)])
colors.append(rgba_color)
hex_color = to_hex(rgba_color)
rgba_float_color = to_rgb_float(rgba_color)
decimal_color = to_decimal(rgba_color)
#
color_hex = colors[0]
colorize_rgb = lambda color: "\u001b[37m, ".join(f"\u001b[3{i}m{c}" for c, i in zip(color, ('1', '2', '4', '7')))
embed = discord.Embed(
color=no_color,
description=f"## {Emojis.shader_triangle} Форматы цвета\n"
f"**Hex** ```ansi\n#\u001b[31m{color_hex[1:3]}\u001b[32m{color_hex[3:5]}\u001b[34m{color_hex[5:7]}```\n"
f"**RGB float** ```ansi\n{colorize_rgb(colors[1])}```\n"
f"**RGB int** ```ansi\n{colorize_rgb(colors[3])}```\n"
f"**Decimal** ```\n{colors[2]}```"
f"**Hex** ```css\n{hex_color}```\n"
f"**RGB float** ```c\n{str(rgba_float_color)[1:-1]}```\n"
f"**RGB int** ```c\n{str(rgba_color)[1:-1]}```\n"
f"**Decimal** ```c\n{decimal_color}```"
)
#
showcase = generate_showcase(rgba_color)
Expand Down

0 comments on commit 82ddbb0

Please sign in to comment.