{"id":17308899,"url":"https://github.com/tekki/print-colored","last_synced_at":"2025-03-27T00:15:09.633Z","repository":{"id":44339315,"uuid":"227037575","full_name":"Tekki/print-colored","owner":"Tekki","description":"Perl module with functions for colored output","archived":false,"fork":false,"pushed_at":"2022-07-09T07:50:14.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T05:26:59.438Z","etag":null,"topics":["colorization","perl"],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Tekki.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-10T05:38:49.000Z","updated_at":"2022-07-09T07:50:16.000Z","dependencies_parsed_at":"2022-09-05T04:41:07.827Z","dependency_job_id":null,"html_url":"https://github.com/Tekki/print-colored","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tekki%2Fprint-colored","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tekki%2Fprint-colored/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tekki%2Fprint-colored/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tekki%2Fprint-colored/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tekki","download_url":"https://codeload.github.com/Tekki/print-colored/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245755683,"owners_count":20667027,"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":["colorization","perl"],"created_at":"2024-10-15T12:06:18.336Z","updated_at":"2025-03-27T00:15:09.614Z","avatar_url":"https://github.com/Tekki.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nPrint::Colored - print, say, prompt with predefined colors\n\n# SYNOPSIS\n\n    use Print::Colored;\n    use Print::Colored ':all';\n\n    # color\n    use Print::Colored ':color';\n\n    $colored_text = color_error $text;    # bright red\n    $colored_text = color_info $text;     # bright blue\n    $colored_text = color_input $text;    # bright cyan\n    $colored_text = color_ok $text;       # bright green\n    $colored_text = color_warn $text;     # bright magenta\n\n    # print\n    use Print::Colored ':print';\n\n    print_error $text;\n    print_info $text;\n    print_input $text;\n    print_ok $text;\n    print_warn $text;\n\n    # prompt\n    use Print::Colored ':prompt';\n\n    $input = prompt_error $text, @params;\n    $input = prompt_info $text, @params;\n    $input = prompt_input $text, @params;\n    $input = prompt_ok $text, @params;\n    $input = prompt_warn $text, @params;\n\n    $password = password_error $text, @params;\n    $password = password_info $text, @params;\n    $password = password_input $text, @params;\n    $password = password_ok $text, @params;\n    $password = password_warn $text, @params;\n\n    # say\n    use Print::Colored ':say';\n\n    say_error $text;\n    say_info $text;\n    say_input $text;\n    say_ok $text;\n    say_warn $text;\n\n# DESCRIPTION\n\n[Print::Colored](https://metacpan.org/pod/Print%3A%3AColored) provides functions to print, say, prompt with predefined colors.\n\n- `error` bright red\n- `info` bright blue\n- `input` bright cyan\n- `ok` bright green\n- `warn` bright magenta\n\nWe should use colors all the time we write sripts that run in the terminal.\nRead [Use terminal colors to distinguish information](https://www.perl.com/article/use-terminal-colors-to-distinguish-information/)\nby [brian d foy](https://metacpan.org/author/BDFOY) to get some more ideas about it.\n\nBut experience shows that the more commands and constants we have to use the less colors our\nscripts have. This was the reason to build this rather simple module.\n\n## Limitations\n\nBecause the colors are predefined, there isn't much to configure. If you don't like them (and quite\nsure you don't) and until we come up with a better solution, you can use [\"coloralias\" in Term::ANSIColor](https://metacpan.org/pod/Term%3A%3AANSIColor#coloralias)\nto modify them.\n\n    use Term::ANSIColor 'coloralias';\n\n    coloralias('error', 'yellow');          # default: bright_red\n    coloralias('info',  'white');           # default: bright_blue\n    coloralias('input', 'bright_white');    # default: bright_cyan\n    coloralias('ok',    'black');           # default: bright_green\n    coloralias('warn',  'red');             # default: bright_blue\n\nAll the commands except [\"color\\_\"](#color_) write directly to `STDOUT`.\n\n    print_ok $filehandle 'Everything okay.';    # ✗ no\n    say_ok $filehandle 'Everything okay.';      # ✗ no\n\nYou can't [\"print\"](#print) and [\"say\"](#say) to filehandles.\n\n    print $filehandle color_ok 'Everything okay.';    # ✓\n    say $filehandle color_ok 'Everything okay.';      # ✓\n\nInstead you have to use one of the [\"color\"](#color) functions.\n\n# color\n\n    use Print::Colored ':color';\n\nImports the functions [\"color\\_error\"](#color_error), [\"color\\_info\"](#color_info), [\"color\\_input\"](#color_input), [\"color\\_ok\"](#color_ok), and [\"color\\_warn\"](#color_warn).\n\n## color\\_error\n\n    $colored_text = color_error 'There was an error';\n\nReturns a text colored as `error`.\n\n## color\\_info\n\n    $colored_text = color_info 'This is an info';\n\nReturns a text colored as `info`.\n\n## color\\_input\n\n    $colored_text = color_input 'Waiting for an input...';\n\nReturns a text colored as `input`.\n\n## color\\_ok\n\n    $colored_text = color_ok 'Everything okay';\n\nReturns a text colored as `ok`.\n\n## color\\_warn\n\n    $colored_text = color_warn 'Last warning';\n\nReturns a text colored as `warn`.\n\n# print\n\n    use Print::Colored ':print';\n\nImports the functions [\"print\\_error\"](#print_error), [\"print\\_info\"](#print_info), [\"print\\_input\"](#print_input), [\"print\\_ok\"](#print_ok), and [\"print\\_warn\"](#print_warn).\n\n## print\\_error\n\n    print_error 'There was an error';\n\nPrints a text colored as `error`.\n\n## print\\_info\n\n    print_info 'This is an info';\n\nPrints a text colored as `info`.\n\n## print\\_input\n\n    print_input 'Waiting for an input...';\n\nPrints a text colored as `input`.\n\n## print\\_ok\n\n    print_ok 'Everything okay';\n\nPrints a text colored as `ok`.\n\n## print\\_warn\n\n    print_warn 'Last warning';\n\nPrints a text colored as `warn`.\n\n# prompt\n\n    use Print::Colored ':prompt';\n\nImports the functions [\"prompt\\_error\"](#prompt_error), [\"prompt\\_info\"](#prompt_info), [\"prompt\\_input\"](#prompt_input), [\"prompt\\_ok\"](#prompt_ok), [\"prompt\\_warn\"](#prompt_warn),\n[\"password\\_error\"](#password_error), [\"password\\_info\"](#password_info), [\"password\\_input\"](#password_input), [\"password\\_ok\"](#password_ok), and [\"password\\_warn\"](#password_warn).\nInternally they call [\"prompt\" in IO::Prompter](https://metacpan.org/pod/IO%3A%3APrompter#prompt).\n\n    $password = prompt_input 'Enter your password: ', -echo =\u003e '*';\n    $password = password_input 'Enter your password: ';\n\n`password` functions ask for a password and are identical to `prompt` with parameter `\u003c-echo =` '\\*'\u003e\u003e.\n\n## prompt\\_error\n\n    $input = prompt_error 'Enter your data: ';\n\nPrompts colored as `error` and returns the input.\n\n## prompt\\_info\n\n    $input = prompt_info 'Enter your data: ';\n\nPrompts colored as `info` and returns the input.\n\n## prompt\\_input\n\n    $input = prompt_input 'Enter your data: ';\n\nPrompts colored as `input` and returns the input.\n\n## prompt\\_ok\n\n    $input = prompt_ok 'Enter your data: ';\n\nPrompts colored as `ok` and returns the input.\n\n## prompt\\_warn\n\n    $input = prompt_warn 'Enter your data: ';\n\nPrompts colored as `warn` and returns the input.\n\n## password\\_error\n\n    $password = password_error 'Enter your password: ';\n\nPrompts colored as `error` for a password and returns the input.\n\n## password\\_info\n\n    $password = password_info 'Enter your password: ';\n\nPrompts colored as `info` for a password and returns the input.\n\n## password\\_input\n\n    $password = password_input 'Enter your password: ';\n\nPrompts colored as `input` for a password and returns the input.\n\n## password\\_ok\n\n    $password = password_ok 'Enter your password: ';\n\nPrompts colored as `ok` for a password and returns the input.\n\n## password\\_warn\n\n    $password = password_warn 'Enter your password: ';\n\nPrompts colored as `warn` for a password and returns the input.\n\n# say\n\n    use Print::Colored ':say';\n\nImports the functions [\"say\\_error\"](#say_error), [\"say\\_info\"](#say_info), [\"say\\_input\"](#say_input), [\"say\\_ok\"](#say_ok), and [\"say\\_warn\"](#say_warn).\n\n## say\\_error\n\n    say_error 'There was an error';\n\nPrints a text with appended newline colored as `error`.\n\n## say\\_info\n\n    say_info 'This is an info';\n\nPrints a text with appended newline colored as `info`.\n\n## say\\_input\n\n    say_input 'Waiting for an input...';\n\nPrints a text with appended newline colored as `input`.\n\n## say\\_ok\n\n    say_ok 'Everything okay';\n\nPrints a text with appended newline colored as `ok`.\n\n## say\\_warn\n\n    say_warn 'Last warning';\n\nPrints a text with appended newline colored as `warn`.\n\n# AUTHOR \u0026 COPYRIGHT\n\n© 2019-2022 by Tekki (Rolf Stöckli).\n\nThis program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.\n\n# SEE ALSO\n\n[IO::Prompter](https://metacpan.org/pod/IO%3A%3APrompter), [Term::ANSIColor](https://metacpan.org/pod/Term%3A%3AANSIColor).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftekki%2Fprint-colored","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftekki%2Fprint-colored","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftekki%2Fprint-colored/lists"}