{"id":13478593,"url":"https://github.com/colored-rs/colored","last_synced_at":"2025-05-14T07:11:14.259Z","repository":{"id":37336191,"uuid":"53757700","full_name":"colored-rs/colored","owner":"colored-rs","description":"(Rust) Coloring terminal so simple you already know how to do it !","archived":false,"fork":false,"pushed_at":"2025-04-04T17:53:02.000Z","size":184,"stargazers_count":1851,"open_issues_count":35,"forks_count":85,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-05-10T03:51:58.773Z","etag":null,"topics":["ansi-term","colors","crates","hacktoberfest","rust","terminal"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/colored-rs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-03-12T23:06:49.000Z","updated_at":"2025-05-08T20:22:27.000Z","dependencies_parsed_at":"2023-12-31T23:19:09.676Z","dependency_job_id":"79452bce-8518-4d6c-8d7e-e0c96a4fa55b","html_url":"https://github.com/colored-rs/colored","commit_stats":{"total_commits":141,"total_committers":40,"mean_commits":3.525,"dds":0.8368794326241135,"last_synced_commit":"1bb63e43816fba027bd223c1a3f1c4ae18739f02"},"previous_names":["colored-rs/colored","mackwic/colored"],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colored-rs%2Fcolored","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colored-rs%2Fcolored/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colored-rs%2Fcolored/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colored-rs%2Fcolored/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/colored-rs","download_url":"https://codeload.github.com/colored-rs/colored/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253672700,"owners_count":21945480,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansi-term","colors","crates","hacktoberfest","rust","terminal"],"created_at":"2024-07-31T16:01:59.133Z","updated_at":"2025-05-14T07:11:09.243Z","avatar_url":"https://github.com/colored-rs.png","language":"Rust","readme":"# Colored\n\n[![Crates.io](https://img.shields.io/crates/v/colored.svg?maxAge=2592000)](https://crates.io/crates/colored) [![Crates.io](https://img.shields.io/crates/l/colored.svg?maxAge=2592000)](https://github.com/mackwic/colored/blob/master/LICENSE)\n\nColoring terminal so simple, you already know how to do it!\n\n```rust\n    \"this is blue\".blue();\n    \"this is red\".red();\n    \"this is red on blue\".red().on_blue();\n    \"this is also red on blue\".on_blue().red();\n    \"you can use truecolor values too!\".truecolor(0, 255, 136);\n    \"background truecolor also works :)\".on_truecolor(135, 28, 167);\n    \"truecolor from tuple\".custom_color((0, 255, 136));\n    \"background truecolor from tuple\".on_custom_color((0, 255, 136));\n    \"bright colors are welcome as well\".on_bright_blue().bright_red();\n    \"you can also make bold comments\".bold();\n    println!(\"{} {} {}\", \"or use\".cyan(), \"any\".italic().yellow(), \"string type\".cyan());\n    \"or change advice. This is red\".yellow().blue().red();\n    \"or clear things up. This is default color and style\".red().bold().clear();\n    \"purple and magenta are the same\".purple().magenta();\n    \"and so are normal and clear\".normal().clear();\n    \"you can specify color by string\".color(\"blue\").on_color(\"red\");\n    \"you can also use hex colors\".color(\"#0057B7\").on_color(\"#fd0\");\n    String::from(\"this also works!\").green().bold();\n    format!(\"{:30}\", \"format works as expected. This will be padded\".blue());\n    format!(\"{:.3}\", \"and this will be green but truncated to 3 chars\".green());\n```\n\n## How to use\n\nAdd this in your `Cargo.toml`:\n\n```toml\n[dependencies]\ncolored = \"2\"\n```\n\nand add this to your `lib.rs` or `main.rs`:\n\n```rust\n    extern crate colored; // not needed in Rust 2018+\n\n    use colored::Colorize;\n\n    // test the example with `cargo run --example most_simple`\n    fn main() {\n        // TADAA!\n        println!(\"{} {} !\", \"it\".green(), \"works\".blue().bold());\n    }\n```\n\n## Features\n\n- Safe rust, easy to use, minimal dependencies, complete test suite\n- Respect the `CLICOLOR`/`CLICOLOR_FORCE` behavior (see [the specs](http://bixense.com/clicolors/))\n- Respect the `NO_COLOR` behavior (see [the specs](https://no-color.org/))\n- Do note that `CLICOLOR_FORCE` overrules `NO_COLOR`, which overrules `CLICOLOR`\n- Works on Linux, MacOS, and Windows (Powershell)\n\n#### Colors:\n\n- black\n- red\n- green\n- yellow\n- blue\n- magenta (or purple)\n- cyan\n- white\n\nBright colors: prepend the color by `bright_`. So easy.\nBackground colors: prepend the color by `on_`. Simple as that.\nBright Background colors: prepend the color by `on_bright_`. Not hard at all.\n\n#### Truecolors\n\nColored has support for truecolors where you can specify any arbitrary rgb value.\n\nThis feature will only work correctly in terminals which support true colors (i.e. most modern terminals).\n\nYou can check if your terminal supports true color by checking the value of the environment variable `$COLORTERM` on your terminal. A value of `truecolor` or `24bit` indicates that it will work.\n\n#### Styles:\n\n- bold\n- underline\n- italic\n- dimmed\n- reversed\n- blink\n- hidden\n- strikethrough\n\nYou can clear color _and_ style anytime by using `normal()` or `clear()`\n\n#### Advanced Control:\n\n##### Dynamic color from str\n\nAs `Color` implements `FromStr`, `From\u003c\u0026str\u003e`, and `From\u003cString\u003e`, you can easily cast a string into a color like that:\n\n```rust\n// the easy way\n\"blue string yo\".color(\"blue\");\n\n// this will default to white\n\"white string\".color(\"zorglub\");\n\n// the safer way via a Result\nlet color_res : Result\u003cColor, ()\u003e = \"zorglub\".parse();\n\"red string\".color(color_res.unwrap_or(Color::Red));\n```\n\n\n##### Colorization control\n\nIf you want to disable any coloring at compile time, you can simply do so by\nusing the `no-color` feature.\n\nFor example, you can do this in your `Cargo.toml` to disable color in tests:\n\n```toml\n[features]\n# this effectively enable the feature `no-color` of colored when testing with\n# `cargo test --features dumb_terminal`\ndumb_terminal = [\"colored/no-color\"]\n```\n\nYou can have even finer control by using the\n`colored::control::set_override` method.\n\n## Todo\n\n- **More tests ?**: We always welcome more tests! Please contribute!\n\n## Credits\n\nThis library wouldn't have been the same without the marvelous ruby gem [colored](https://github.com/defunkt/colored).\n\nThanks for the [ansi\\_term crate](https://github.com/ogham/rust-ansi-term) for\nproviding a reference implementation, which greatly helped making this crate\noutput correct strings.\n\n## Minimum Supported Rust Version (MSRV)\nThe current MSRV is `1.80`, which is checked and enforced automatically via CI. This version may change in the future in minor version bumps, so if you require a specific Rust version you should use a restricted version requirement such as `~X.Y`.\n\n## License\n\n[Mozilla Public License 2.0](https://www.mozilla.org/en-US/MPL/2.0/). See the\n[LICENSE](https://github.com/mackwic/colored/blob/master/LICENSE) file at the\nroot of the repository.\n\nIn non legal terms it means that:\n- if you fix a bug, you MUST give me the code of the fix (it's only fair)\n- if you change/extend the API, you MUST give me the code you changed in the\n  files under MPL2.\n- you CAN'T sue me for anything about this code\n- apart from that, you can do almost whatever you want. See the LICENSE file\n  for details.\n\n## Contributors\n\n- Thomas Wickham: [@mackwic](https://github.com/mackwic)\n- Hunter Wittenborn [@hwittenborn](https://github.com/hwittenborn)\n- Corey \"See More\" Richardson: [@cmr](https://github.com/cmr)\n- Iban Eguia: [@Razican](https://github.com/Razican)\n- Alexis \"Horgix\" Chotard: [@horgix](https://github.com/horgix)\n- Keith Yeung: [@KiChjang](https://github.com/KiChjang)\n- Kyle Galloway: [@kylegalloway](https://github.com/kylegalloway)\n- Luke Hsiao: [@lukehsiao](https://github.com/lukehsiao)\n- kurtlawrence: [@kurtlawrence](https://github.com/kurtlawrence)\n","funding_links":[],"categories":["Rust","Libraries","Repository"],"sub_categories":["Command-line","Command-line Utilities"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcolored-rs%2Fcolored","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcolored-rs%2Fcolored","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcolored-rs%2Fcolored/lists"}