Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added colorAdd() #53

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

added colorAdd() #53

wants to merge 6 commits into from

Conversation

canTuncPekkan
Copy link

colorAdd() allows the user to add a new color with RGB

example;
colorAdd("Light Coral", (240, 128, 128))

now you can use "Light Coral" as a color

canTuncPekkan and others added 2 commits August 12, 2023 12:31
colorAdd() allows the user to add a new color with RGB
@codecov
Copy link

codecov bot commented Aug 12, 2023

Codecov Report

Patch coverage: 60.00% and project coverage change: -1.69% ⚠️

Comparison is base (609f404) 100.00% compared to head (b19c52e) 98.31%.

Additional details and impacted files
@@             Coverage Diff             @@
##              main      #53      +/-   ##
===========================================
- Coverage   100.00%   98.31%   -1.69%     
===========================================
  Files            3        3              
  Lines          116      119       +3     
===========================================
+ Hits           116      117       +1     
- Misses           0        2       +2     
Flag Coverage Δ
macos-latest 98.31% <60.00%> (-1.69%) ⬇️
ubuntu-latest 98.31% <60.00%> (-1.69%) ⬇️
windows-latest 98.31% <60.00%> (-1.69%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
src/termcolor/termcolor.py 95.55% <50.00%> (-4.45%) ⬇️
src/termcolor/__init__.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@canTuncPekkan
Copy link
Author

canTuncPekkan commented Aug 12, 2023

umm I am new to GitHub and this is the first time this happened. why has it failed? it says;
Screenshot 2023-08-12 at 12 47 42 PM

@hugovk hugovk added the changelog: Added For new features label Aug 13, 2023
@hugovk
Copy link
Member

hugovk commented Aug 13, 2023

Thanks for the PR!

These are some automated checks to make sure tests pass and some code quality/linters are happy.

I added a changelog label, so that's now happy. There's still some lint things to check, but I'll add a review with some other suggestions first.

Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please can you add some unit tests so we know this is working correctly?

COLORS,
HIGHLIGHTS,
RESET,
colorAdd,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's follow PEP 8 and use snake case (here and elsewhere):

Suggested change
colorAdd,
add_color,

"underline": "4",
"blink": "5",
"reverse": "7",
"concealed": "8",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are all these now strings? Can we keep them as integers for backwards compatibility?

Comment on lines +129 to +130
def colorAdd(color: str, RGB: tuple | None = None) -> None:
"""add colors to Available text colors
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def colorAdd(color: str, RGB: tuple | None = None) -> None:
"""add colors to Available text colors
def add_color(color: str, rgb: tuple | None = None) -> None:
"""add color to available text colors.

Comment on lines +133 to +134
color (str): collor index name, used to call this collor
RGB (R, G, B): the RGB value of the collor you want to add. Defaults to None.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
color (str): collor index name, used to call this collor
RGB (R, G, B): the RGB value of the collor you want to add. Defaults to None.
color (str): color name
rgb (R, G, B): the RGB value of the color you want to add. Defaults to None.

color (str): collor index name, used to call this collor
RGB (R, G, B): the RGB value of the collor you want to add. Defaults to None.
"""
if not RGB == None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if not RGB == None:
if not rgb:

@@ -140,7 +151,7 @@ def colored(
Available text colors:
black, red, green, yellow, blue, magenta, cyan, white,
light_grey, dark_grey, light_red, light_green, light_yellow, light_blue,
light_magenta, light_cyan.
light_magenta, light_cyan, and all collors added by addCollor().
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
light_magenta, light_cyan, and all collors added by addCollor().
light_magenta, light_cyan, and any colors added via add_color().

@hugovk
Copy link
Member

hugovk commented Nov 12, 2023

Reminder that this needs some updates. Let me know if you've any questions. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: Added For new features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants