{"id":23508803,"url":"https://github.com/lovasko/col.hpp","last_synced_at":"2025-05-13T15:35:07.667Z","repository":{"id":78820632,"uuid":"125629274","full_name":"lovasko/col.hpp","owner":"lovasko","description":"C++ ANSI Colors Header Library","archived":false,"fork":false,"pushed_at":"2018-03-17T22:02:52.000Z","size":56,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-25T11:32:48.360Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lovasko.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-17T12:57:44.000Z","updated_at":"2018-03-17T22:04:11.000Z","dependencies_parsed_at":"2023-04-18T20:07:51.747Z","dependency_job_id":null,"html_url":"https://github.com/lovasko/col.hpp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovasko%2Fcol.hpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovasko%2Fcol.hpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovasko%2Fcol.hpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovasko%2Fcol.hpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lovasko","download_url":"https://codeload.github.com/lovasko/col.hpp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239188697,"owners_count":19597032,"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":[],"created_at":"2024-12-25T11:32:12.040Z","updated_at":"2025-02-16T19:44:32.832Z","avatar_url":"https://github.com/lovasko.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# col.hpp\nThis is a header-only library for C++ (C++98 and onwards) that provides the\nANSI coloring capability for outputting text. It integrates well with the\nstandard library, working with both `std::string` and `std::ostream`.\n\n## Example\nFirst, to define a color, we use the `col::make` function:\n```cpp\nstring red    = col::make(col::red,    col::def, false, false, false);\nstring yellow = col::make(col::yellow, col::def, false, false, false);\nstring green  = col::make(col::green,  col::def, false, false, false);\n```\n\nNow we are ready to print text to the standard output stream:\n```cpp\ncout \u003c\u003c red    \u003c\u003c \"ERROR\" \u003c\u003c col::reset \u003c\u003c \" disk is full\"        \u003c\u003c endl;\ncout \u003c\u003c yellow \u003c\u003c \"WARN \" \u003c\u003c col::reset \u003c\u003c \" disk is almost full\" \u003c\u003c endl;\ncout \u003c\u003c green  \u003c\u003c \"INFO \" \u003c\u003c col::reset \u003c\u003c \" disk is available\"   \u003c\u003c endl;\n```\n\n![screenshot solarized](example.png)\n\nIt is worth to mention the output stream manipulator `col::reset` that can be\nused to reset all color effects previously set to the default terminal state.\n\n## Documentation\nThe full library consists of one type, the color `hue`, and two functions -\n`make` and `reset`. All three are located in the `col` namespace. The color\n`hue` is an enum with the following values:\n * `black`\n * `red`\n * `green`\n * `yellow`\n * `blue`\n * `magenta`\n * `cyan`\n * `light_gray`\n * `dark_gray`\n * `light_red`\n * `light_green`\n * `light_yellow`\n * `light_blue`\n * `light_magenta`\n * `light_cyan`\n * `white`\n * `def`\n\nThe library is intended to be used with instances of `std::ostream`, such as\n`std::iostream`, `std::fstream` or `std::stringstream`. The expected usage is\nto create an instance of color via the `make` function and just simply direct\nit to the stream before writing out the relevant text. This function creates a\nstring that changes the terminal state to use the appropriate color. Once the\ncolor should be changed to a different color, repeat the direction step with\nthe desired new color, or use the `reset` manipulator to return back to the\nterminal default.\n\n## Installation\nThe library is not intended to be linked against, nor is it provided as a\npackage. The aim was to keep the API and code small and readable, so it could\nbe distributed as a part of any project. The recommendation is to simply copy\nthe file and use it directly.\n\n## License\nThe `col.hpp` project is licensed under the terms of the [2-cause BSD\nlicense](LICENSE). In case you would need a different license, please feel free\nto contact the author.\n\n## Author\nDaniel Lovasko \u003cdaniel.lovasko@gmail.com\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flovasko%2Fcol.hpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flovasko%2Fcol.hpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flovasko%2Fcol.hpp/lists"}