1Data::Dump::Color(3)  User Contributed Perl Documentation Data::Dump::Color(3)
2
3
4

NAME

6       Data::Dump::Color - Like Data::Dump, but with color
7

VERSION

9       This document describes version 0.241 of Data::Dump::Color (from Perl
10       distribution Data-Dump-Color), released on 2018-12-02.
11

SYNOPSIS

13       Use it like you would Data::Dump, e.g.:
14
15        use Data::Dump::Color; dd localtime;
16

DESCRIPTION

18       This module aims to be a drop-in replacement for Data::Dump. It adds
19       colors to dumps. It also adds various visual aids in the comments, e.g.
20       array/hash index, depth indicator, and so on.
21
22       For more information, see Data::Dump. This documentation explains
23       what's different between this module and Data::Dump.
24

RESULTS

26       By default Data::Dump::Color shows array index or hash pair sequence in
27       comments for visual aid, e.g.:
28
29        [
30          "this",      # [0]
31          "is",        # [1]
32          "a",         # [2]
33          "5-element", # [3]
34          "array",     # [4]
35          {
36            0  => "with",  # .{0}
37            1  => "an",    # .{1}
38            2  => "extra", # .{2}
39            3  => "hash",  # .{3}
40            4  => "at",    # .{4}
41            5  => "the",   # .{5}
42            16 => "end",   # .{6}
43          },           # [5]
44        ]
45
46       "[]" and "{}" brackets will indicate whether they are indexes to an
47       array or a hash. The dot prefixes will mark depth level.
48
49       To turn this off, set $INDEX to 0:
50
51        [
52          "this",
53          "is",
54          "a",
55          "5-element",
56          "array",
57          {
58            0  => "with",
59            1  => "an",
60            2  => "extra",
61            3  => "hash",
62            4  => "at",
63            5  => "the",
64            16 => "end",
65          },
66        ]
67

VARIABLES

69       "$Data::Dump::*" package variables from Data::Dump, like
70       $Data::Dump::TRY_BASE64, etc are now in the "Data::Dump::Color"
71       namespace, e.g. $Data::Dump::Color::TRY_BASE64, etc.
72
73       Additional variables include:
74
75       $COLOR => BOOL (default: undef)
76           Whether to force-enable or disable color. If unset, color output
77           will be determined from $ENV{COLOR} or when in interactive terminal
78           (when "-t STDOUT" is true).
79
80       %COLORS => HASH (default: default colors)
81           Define colors.
82
83       $INDEX => BOOL (default: 1)
84           Whether to add array/hash index visual aid.
85
86       $LENTHRESHOLD => int (default: 500)
87           Add string length visual aid for hash key/hash value/array element
88           if length is at least this value.
89

FAQ

91   How do I turn off index comments?
92       Set $Data::Dump::Color::INDEX to 0.
93
94   How do I turn off colors?
95       Well, colors is sort of the point of this module. But if you want to
96       turn it off, you can set environment COLOR to 0, or
97       $Data::Dump::Color::COLOR to 0.
98
99   How do I customize colors?
100       Fiddle the colors in %Data::Dump::Color::COLORS. There will probably be
101       proper color theme support in the future (based on
102       SHARYANTO::Role::ColorTheme.
103

ENVIRONMENT

105       ·   NO_COLOR
106
107           Can be used to disable color. Takes precedence over the "COLOR"
108           environment.  See <https://no-color.org> for more details.
109
110       ·   COLOR
111
112           If set, then will force color output on or off. By default, will
113           only output color when in interactive terminal. This is consulted
114           when $COLOR is not set.
115

HOMEPAGE

117       Please visit the project's homepage at
118       <https://metacpan.org/release/Data-Dump-Color>.
119

SOURCE

121       Source repository is at
122       <https://github.com/perlancar/perl-Data-Dump-Color>.
123

BUGS

125       Please report any bugs or feature requests on the bugtracker website
126       <https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Dump-Color>
127
128       When submitting a bug or request, please include a test-file or a patch
129       to an existing test-file that illustrates the bug or desired feature.
130

SEE ALSO

132       Data::Dump, JSON::Color, YAML::Tiny::Color
133

AUTHOR

135       perlancar <perlancar@cpan.org>
136
138       This software is copyright (c) 2018, 2014, 2013, 2012 by
139       perlancar@cpan.org.
140
141       This is free software; you can redistribute it and/or modify it under
142       the same terms as the Perl 5 programming language system itself.
143
144
145
146perl v5.32.0                      2020-07-28              Data::Dump::Color(3)
Impressum