Skip to content
This repository was archived by the owner on Oct 2, 2023. It is now read-only.

Commit 53e126d

Browse files
Inf-inityInf-inity
authored andcommitted
some changes
1 parent bfca624 commit 53e126d

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

general/color_picker/cog.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import colorsys
22
import re
3-
from typing import Any
43

54
from discord import Colour, Embed
65
from discord.ext import commands
@@ -29,20 +28,6 @@ def _to_floats(given: list[tuple[int, ...]]) -> tuple[float, ...]:
2928
return out[0], out[1], out[2]
3029

3130

32-
def _to_rgb(colors: tuple[int, ...]) -> tuple[int, ...]:
33-
out: list[int] = []
34-
35-
for color in colors:
36-
if color < 0:
37-
out.append(0)
38-
if color > 255:
39-
out.append(255)
40-
else:
41-
out.append(color)
42-
43-
return out[0], out[1], out[2]
44-
45-
4631
def _hex_to_color(hex_color: str) -> tuple[int, ...]:
4732
return tuple(int(hex_color[i : i + 2], 16) for i in (0, 2, 4)) # noqa: E203
4833

@@ -64,8 +49,7 @@ async def color_picker(self, ctx: Context, *, color: str):
6449
rgb = _to_floats([(rgb[0], 255), (rgb[1], 255), (rgb[2], 255)])
6550

6651
elif color_re := self.RE_RGB.match(color):
67-
rgb = _to_rgb((color_re.group(1), color_re.group(2), color_re.group(3)))
68-
rgb = _to_floats([(rgb[0], 255), (rgb[1], 255), (rgb[2], 255)])
52+
rgb = _to_floats([(color_re.group(1), 255), (color_re.group(2), 255), (color_re.group(3), 255)])
6953

7054
elif color_re := self.RE_HSV.match(color):
7155
values = _to_floats([(color_re.group(1), 360), (color_re.group(2), 100), (color_re.group(3), 100)])

0 commit comments

Comments
 (0)