Skip to content

Add true colour RGB option as input arguments#102

Merged
hugovk merged 9 commits intotermcolor:mainfrom
icyveins7:main
Apr 7, 2025
Merged

Add true colour RGB option as input arguments#102
hugovk merged 9 commits intotermcolor:mainfrom
icyveins7:main

Conversation

@icyveins7
Copy link
Contributor

Hi there, I really like this package but wanted the ability to print in any arbitrary RGB colour. Since most terminals now (even Windows Terminal) allow for 24-bit RGB, I think this would be a useful addition.

I'm not sure what else I would need to change for this to be accepted (or if this is even desired as a feature). Let me know and I'll amend it!

Preview of the feature (added to main.py):

image

@codecov
Copy link

codecov bot commented Apr 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.79%. Comparing base (b2c165a) to head (e0491a9).
Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #102      +/-   ##
==========================================
+ Coverage   97.65%   97.79%   +0.13%     
==========================================
  Files           3        3              
  Lines         128      136       +8     
==========================================
+ Hits          125      133       +8     
  Misses          3        3              
Flag Coverage Δ
macos-latest 97.79% <100.00%> (+0.13%) ⬆️
ubuntu-latest 97.79% <100.00%> (+0.13%) ⬆️
windows-latest 97.79% <100.00%> (+0.13%) ⬆️

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

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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 could you add tests and an example to the README?

@hugovk hugovk added the changelog: Added For new features label Apr 6, 2025
icyveins7 and others added 4 commits April 7, 2025 22:41
specify that ints are 0-255

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
this spans all 256**3 permutations
256**3 permutations was too ridiculously long
@icyveins7
Copy link
Contributor Author

icyveins7 commented Apr 7, 2025

I've added tests for the color and on_color arguments with 2 representative RGB tuple cases each. Original plan to test all 256^3 permutations was a bit too enthusiastic.

README has also been edited as requested.

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.

Thank you!

@hugovk
Copy link
Member

hugovk commented Apr 7, 2025

I've added tests for the color and on_color arguments with 2 representative RGB tuple cases each. Original plan to test all 256^3 permutations was a bit too enthusiastic.

Yeah, just a couple of representative values are fine 😅

README has also been edited as requested.

Thanks!

@icyveins7
Copy link
Contributor Author

Cool, hope to see it merged! Am looking to use this in my own mini libraries.

@hugovk hugovk merged commit beee6dd into termcolor:main Apr 7, 2025
31 checks passed
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.

2 participants