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.248 of Data::Dump::Color (from Perl
10       distribution Data-Dump-Color), released on 2021-06-24.
11

SYNOPSIS

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

DESCRIPTION

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

RESULTS

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

VARIABLES

71       "$Data::Dump::*" package variables from Data::Dump, like
72       $Data::Dump::TRY_BASE64, etc are now in the "Data::Dump::Color"
73       namespace, e.g. $Data::Dump::Color::TRY_BASE64, etc.
74
75       Additional variables include:
76
77       $COLOR => BOOL (default: undef)
78           Whether to force-enable or disable color. If unset, color output
79           will be determined from "NO_COLOR", "COLOR" environment variables,
80           or whether running in interactive terminal (when "-t STDOUT" is
81           true).
82
83       $COLOR_THEME => str
84           Select a color theme, which is a module under
85           "ColorTheme::Data::Dump::Color::" or "ColorTheme::" namespace
86           (with/without the namespace prefix). For example: "Default256",
87           "Bright".
88
89       $INDEX => BOOL (default: 1)
90           Whether to add array/hash index visual aid.
91
92       $LENTHRESHOLD => int (default: 500)
93           Add string length visual aid for hash key/hash value/array element
94           if length is at least this value.
95

FUNCTIONS

97       Only "dd" and "ddx" are exported by default.
98
99   dd
100   ddx
101   dump

FAQ

103   How do I turn off index comments?
104       Set $Data::Dump::Color::INDEX to 0.
105
106   How do I turn off colors?
107       Well, colors is sort of the point of this module. But if you want to
108       turn it off, you can set environment COLOR to 0, or
109       $Data::Dump::Color::COLOR to 0.
110
111   How do I customize colors?
112       Create a color theme and give it a name under
113       "ColorTheme::Data::Dump::Color::*". See an existing color theme for
114       example, e.g. ColorTheme::Data::Dump::Color::Default256.
115

ENVIRONMENT

117   DATA_DUMP_COLOR_THEME
118       Set color theme. Name will be searched under
119       "ColorTheme::Data::Dump::Color::*" or "ColorTheme::*".
120
121   NO_COLOR
122       Can be used to disable color. Takes precedence over the "COLOR"
123       environment.  See <https://no-color.org> for more details.
124
125   COLOR
126       If set, then will force color output on or off. By default, will only
127       output color when in interactive terminal. This is consulted when
128       $COLOR is not set.
129

HOMEPAGE

131       Please visit the project's homepage at
132       <https://metacpan.org/release/Data-Dump-Color>.
133

SOURCE

135       Source repository is at
136       <https://github.com/perlancar/perl-Data-Dump-Color>.
137

BUGS

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

SEE ALSO

146       Data::Dump, JSON::Color, YAML::Tiny::Color
147

AUTHOR

149       perlancar <perlancar@cpan.org>
150

CONTRIBUTORS

152       •   Scott Baker <bakerscot@cpan.org>
153
154       •   Steven Haryanto <sharyanto@cpan.org>
155
157       This software is copyright (c) 2021, 2018, 2014, 2013, 2012 by
158       perlancar@cpan.org.
159
160       This is free software; you can redistribute it and/or modify it under
161       the same terms as the Perl 5 programming language system itself.
162
163
164
165perl v5.34.0                      2021-07-22              Data::Dump::Color(3)
Impressum