https://github.com/piotrmurach/tty-color
Terminal color capabilities detection
https://github.com/piotrmurach/tty-color
Keywords
cli color ruby-gem tty tty-components
Last synced: about 15 hours ago
JSON representation
Repository metadata
Terminal color capabilities detection
- Host: GitHub
- URL: https://github.com/piotrmurach/tty-color
- Owner: piotrmurach
- License: mit
- Created: 2016-01-01T19:03:47.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2025-04-26T20:09:26.000Z (10 months ago)
- Last Synced: 2026-01-30T18:51:30.667Z (about 1 month ago)
- Topics: cli, color, ruby-gem, tty, tty-components
- Language: Ruby
- Homepage: https://ttytoolkit.org
- Size: 102 KB
- Stars: 36
- Watchers: 3
- Forks: 7
- Open Issues: 0
- Releases: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
README.md
TTY::Color
Terminal color capabilities detection.
TTY::Color provides independent color support detection component for TTY toolkit.
Installation
Add this line to your application's Gemfile:
gem "tty-color"
And then execute:
$ bundle
Or install it yourself as:
$ gem install tty-color
Usage
TTY::Color allows you to check if terminal supports color:
TTY::Color.color? # => true
TTY::Color.support? # => true
You can also get the number of colors supported by the terminal using mode method:
TTY::Color.mode # => 64
To detect if color support has been disabled with NO_COLOR environment variable, use disabled?:
TTY::Color.disabled? # => false
TTY::Color is just a module hence you can include it into your scripts directly:
#!/usr/bin/env ruby
include TTY::Color
puts color?
Command line tool
tty-color-cli is a command line tool for the TTY::Color.
To check if terminal supports colors use -s|--support:
tty-color -s
tty-color --support
# => true
And to check color mode use -m|--mode option:
tty-color -m
tty-color --mode
# => 256
Development
After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/piotrmurach/tty-color. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
- Fork it ( https://github.com/piotrmurach/tty-color/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Code of Conduct
Everyone interacting in the TTY::Color project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
Copyright
Copyright (c) 2016 Piotr Murach. See LICENSE for further details.
Owner metadata
- Name: Piotr Murach
- Login: piotrmurach
- Email:
- Kind: user
- Description: Tender loving command line.
- Website: https://piotrmurach.com
- Location: Sheffield / Olsztyn
- Twitter: piotr_murach
- Company:
- Icon url: https://avatars.githubusercontent.com/u/444312?v=4
- Repositories: 89
- Last ynced at: 2025-11-23T03:03:05.684Z
- Profile URL: https://github.com/piotrmurach
GitHub Events
Total
- Push event: 4
Last Year
- Push event: 4
Committers metadata
Last synced: 2 days ago
Total Commits: 163
Total Committers: 5
Avg Commits per committer: 32.6
Development Distribution Score (DDS): 0.031
Commits in past year: 4
Committers in past year: 1
Avg Commits per committer in past year: 4.0
Development Distribution Score (DDS) in past year: 0.0
| Name | Commits | |
|---|---|---|
| Piotr Murach | p****h@g****m | 158 |
| nicholas a. evans | n****s@g****m | 2 |
| mwlang | m****g@c****t | 1 |
| Jan Lelis | m****l@j****e | 1 |
| Igor Kapkov | i****k@m****m | 1 |
Committer domains:
- me.com: 1
- janlelis.de: 1
- cybrains.net: 1
Issue and Pull Request metadata
Last synced: 20 days ago
Total issues: 3
Total pull requests: 5
Average time to close issues: 5 days
Average time to close pull requests: about 17 hours
Total issue authors: 2
Total pull request authors: 4
Average comments per issue: 2.33
Average comments per pull request: 2.8
Merged pull request: 5
Bot issues: 0
Bot pull requests: 0
Past year issues: 0
Past year pull requests: 0
Past year average time to close issues: N/A
Past year average time to close pull requests: N/A
Past year issue authors: 0
Past year pull request authors: 0
Past year average comments per issue: 0
Past year average comments per pull request: 0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- janlelis (2)
- gtatgh (1)
Top Pull Request Authors
- nevans (2)
- janlelis (1)
- igas (1)
- mwlang (1)
Top Issue Labels
Top Pull Request Labels
Package metadata
- Total packages: 4
-
Total downloads:
- rubygems: 201,856,272 total
- Total docker downloads: 965,750,698
- Total dependent packages: 39 (may contain duplicates)
- Total dependent repositories: 4,746 (may contain duplicates)
- Total versions: 36
- Total maintainers: 1
gem.coop: tty-color
Terminal color capabilities detection
- Homepage: https://ttytoolkit.org
- Documentation: http://www.rubydoc.info/gems/tty-color/
- Licenses: MIT
- Latest release: 0.6.0 (published over 5 years ago)
- Last Synced: 2026-03-01T07:02:32.593Z (2 days ago)
- Versions: 11
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 100,928,727 Total
- Docker Downloads: 482,875,349
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.119%
- Docker downloads count: 0.209%
- Downloads: 0.269%
- Maintainers (1)
rubygems.org: tty-color
Terminal color capabilities detection
- Homepage: https://ttytoolkit.org
- Documentation: http://www.rubydoc.info/gems/tty-color/
- Licenses: MIT
- Latest release: 0.6.0 (published over 5 years ago)
- Last Synced: 2026-03-01T05:24:40.882Z (2 days ago)
- Versions: 11
- Dependent Packages: 38
- Dependent Repositories: 4,746
- Downloads: 100,927,545 Total
- Docker Downloads: 482,875,349
-
Rankings:
- Docker downloads count: 0.255%
- Downloads: 0.408%
- Dependent repos count: 0.458%
- Dependent packages count: 0.656%
- Average: 3.493%
- Stargazers count: 8.888%
- Forks count: 10.292%
- Maintainers (1)
proxy.golang.org: github.com/piotrmurach/tty-color
- Homepage:
- Documentation: https://pkg.go.dev/github.com/piotrmurach/tty-color#section-documentation
- Licenses: mit
- Latest release: v0.6.0 (published over 5 years ago)
- Last Synced: 2026-03-01T05:24:43.166Z (2 days ago)
- Versions: 11
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Stargazers count: 6.531%
- Forks count: 7.257%
- Average: 8.541%
- Dependent packages count: 9.576%
- Dependent repos count: 10.802%
conda-forge.org: rb-tty-color
- Homepage: https://rubygems.org/gems/tty-color
- Licenses: MIT
- Latest release: 0.6.0 (published over 4 years ago)
- Last Synced: 2026-02-02T00:25:35.443Z (29 days ago)
- Versions: 3
- Dependent Packages: 1
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 28.82%
- Dependent repos count: 34.025%
- Average: 36.99%
- Stargazers count: 40.459%
- Forks count: 44.657%
Dependencies
- benchmark-ips ~> 2.7.2 development
- coveralls_reborn ~> 0.22.0 development
- simplecov ~> 0.21.0 development
- yardstick ~> 0.9.9 development
- rake >= 0 development
- rspec >= 3.0 development
- actions/checkout v3 composite
- ruby/setup-ruby v1 composite
Score: 26.071183558227993