NAME Term::ANSIColor::Conditional - Colorize text only if color is enabled VERSION This document describes version 0.009 of Term::ANSIColor::Conditional (from Perl distribution Term-ANSIColor-Conditional), released on 2021-06-01. SYNOPSIS Use as you would Term::ANSIColor. DESCRIPTION This module is a wrapper for Term::ANSIColor. If color is enabled then everything is the same as Term::ANSIColor. If color is disabled, then "color()" will emit empty string and "colored()" will not colorize input text. How to determine "color is enabled": * If package variable $Term::ANSIColor::Conditional::COLOR is defined, use that. * Otherwise, check if "NO_COLOR" environment variable exists. If yes, color is disabled. * Otherwise, check if "COLOR" environment variable is defined and use that. * Otherwise, check if (-t STDOUT) is true (interactive terminal). If yes, color is enabled. * Otherwise, color is disabled. Note that Term::ANSIColor already supports conditional color via the "ANSI_COLORS_DISABLED" and "NO_COLOR" environment variables, but it does not check for interactive terminal or the "COLOR" environment variable. VARIABLES $COLOR => bool NO_COLOR For more information, see <https://no-color.org>. COLOR ENVIRONMENT HOMEPAGE Please visit the project's homepage at <https://metacpan.org/release/Term-ANSIColor-Conditional>. SOURCE Source repository is at <https://github.com/perlancar/perl-Term-ANSIColor-Conditional>. BUGS Please report any bugs or feature requests on the bugtracker website <https://rt.cpan.org/Public/Dist/Display.html?Name=Term-ANSIColor-Condit ional> When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. SEE ALSO Term::ANSIColor Term::ANSIColor::Patch::Conditional, patch version for this module. These modules also respect the "NO_COLOR" and/or the "COLOR" environment variable: Color::ANSI::Util, Text::ANSITable, Data::Dump::Color, App::diffwc, App::rsynccolor. AUTHOR perlancar <email@example.com> COPYRIGHT AND LICENSE This software is copyright (c) 2021, 2020, 2018, 2017 by firstname.lastname@example.org. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.