{"id":17874228,"url":"https://github.com/jomy10/simple_colors","last_synced_at":"2026-04-26T12:32:38.913Z","repository":{"id":57667398,"uuid":"449813810","full_name":"Jomy10/simple_colors","owner":"Jomy10","description":"Macros for formatting text with colors, backgrounds and styles like bold, italic and underlined.","archived":false,"fork":false,"pushed_at":"2022-04-22T10:54:22.000Z","size":4007,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T15:18:00.546Z","etag":null,"topics":["background","color","crate","crates","crates-io","library","rust","style","terminal","text"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Jomy10.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-19T18:42:49.000Z","updated_at":"2022-01-19T19:29:47.000Z","dependencies_parsed_at":"2022-09-03T10:22:16.396Z","dependency_job_id":null,"html_url":"https://github.com/Jomy10/simple_colors","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jomy10%2Fsimple_colors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jomy10%2Fsimple_colors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jomy10%2Fsimple_colors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jomy10%2Fsimple_colors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jomy10","download_url":"https://codeload.github.com/Jomy10/simple_colors/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246911467,"owners_count":20853657,"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":["background","color","crate","crates","crates-io","library","rust","style","terminal","text"],"created_at":"2024-10-28T11:08:06.228Z","updated_at":"2026-04-26T12:32:38.885Z","avatar_url":"https://github.com/Jomy10.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple Colors\nThis crate provides simple macros for formatting strings with colors, backgrounds and styles like bold, italic and underlined.\nThe crate does not use any external dependencies.\n\n[![Licenses](https://img.shields.io/crates/l/simple_colors)](#license)\n[![Crates.io](https://img.shields.io/crates/v/simple_colors)](https://crates.io/crates/simple_colors)\n[![Docs.rs](https://img.shields.io/docsrs/simple_colors)](https://docs.rs/simple_colors/latest/simple_colors/)\n\n\u003cdiv\u003e\n    \u003cimg alt=\"green\" src=\"https://raw.githubusercontent.com/jomy10/simple_colors/master/assets/gif/green.gif\" width=\"400\"/\u003e\n    \u003cimg alt=\"all\" src=\"https://raw.githubusercontent.com/jomy10/simple_colors/master/assets/gif/all.gif\" width=\"400\"/\u003e\n    \u003cimg alt=\"bg\" src=\"https://raw.githubusercontent.com/jomy10/simple_colors/master/assets/gif/bg_blue.gif\" width=\"400\"/\u003e\n    \u003cimg alt=\"bold\" src=\"https://raw.githubusercontent.com/jomy10/simple_colors/master/assets/gif/bold.gif\" width=\"400\"/\u003e\n\u003c/div\u003e\n\n## Installing\nAdd the following line to your **Cargo.toml** file:\n```toml\n[dependencies]\nsimple_colors = \"1\"\n```\n\n## Overview\n\n### Colors\nYou can style text with colors:\n\n```rust\nuse simple_colors::{white, red, printlnc};\nprintln!(\"{}\", red!(\"This is red\"));\nprintlnc!(red!(\"This is also red\"));\nprintlnc!(format!(\"{}, {}.\", white!(\"This is white\"), red!(\"this is red\")))\n```\n\n**Output:**\n\n\u003cimg alt=\"red_output\" src=\"https://raw.githubusercontent.com/jomy10/simple_colors/master/assets/img/red_ex.png\" width=\"500\"/\u003e\n\nThe available colors:\n- black\n- white\n- yellow \u0026 light_yellow\n- red \u0026 light_red\n- cyan \u0026 light_cyan\n- blue \u0026 light_blue\n- magenta \u0026 light_magenta\n- green \u0026 light_green\n- dark_grey \u0026 grey\n\n[Preview](preview.md)\n\n### Backgrounds\nYou can also add backgrounds:\n```rust\nuse simple_colors::{white, bg_black, printlnc};\n\nprintlnc!(bg_black!(white!(\"Black background with white text\")));\n```\n\n\u003cimg alt=\"bg\" src=\"assets/gif/bg_blue.gif\" width=\"450\"/\u003e\n\n### Styles\nYou can also make your text bold, italic or underlined.\n\n```rust\nuse simple_colors::bold;\n\nprintlnc!(bold!(\"This text is bold\"));\n```\n\n### Combining styles\nYou can combine all of the different macros to style your text.\n\n\u003cimg alt=\"all\" src=\"assets/gif/all.gif\" width=\"450\"/\u003e\n\n### Custom styles\nYou can also specify custom styles:\n\n```rust\nuse simple_colors::{color, Color, Style};\n\nenum MyCustomStyles {\n    Style1,\n    Style2\n}\nimpl simple_colors::custom::Style for MyCustomStyles {\n    fn get_style_code(\u0026self) -\u003e String {\n        match self {\n            // Style1 will be bold and light blue\n            MyCustomStyles::Style1 =\u003e \"\\x1b[1m\\x1b[94m\".to_string(),\n            // Style2 will be bold and red\n            MyCustomStyles::Style2 =\u003e\n                format!(\n                    \"{}{}\",\n                    Style::Bold.get_style_code(),\n                    Color::Red.get_style_code()\n                )\n        }\n    }\n}\n println!(\"{}\", color!(MyCustomStyles::Style2, \"Some text that is both bold and red\"))\n```\n\n### Printlnc! and printc!\n`printlnc!()` and `printc!()` are two methods for printing your formatted text like so:\n\n```rust\nprintlnc!(blue!(\"Hello world\"));\n```\n\nwhich is a replacement for:\n```rust\nprintln!(\"{}\", blue!(\"Hello world\"));\n```\n\n## Contributing\nEverything should be covered in this crate. If you find a bug, feel free to open an issue and then making a pull request\n(if you know how to fix the bug). If you can think of improvements, they are also always welcome.\n\n## License\nThis crate is licensed under the [MIT License](LICENSE) or the Apache-2.0 license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjomy10%2Fsimple_colors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjomy10%2Fsimple_colors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjomy10%2Fsimple_colors/lists"}