App-XTermUtils
view release on metacpan or search on metacpan
script/get-term-bgcolor view on Meta::CPAN
#!perl
# Note: This script is a CLI for Riap function /XTerm/Util/get_term_bgcolor
# and generated automatically using Perinci::CmdLine::Gen version 0.498
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2021-05-26'; # DATE
our $DIST = 'App-XTermUtils'; # DIST
our $VERSION = '0.007'; # VERSION
use 5.010001;
use strict;
use warnings;
use Perinci::CmdLine::Any;
my $cmdline = Perinci::CmdLine::Any->new(
url => "/XTerm/Util/get_term_bgcolor",
program_name => "get-term-bgcolor",
read_config => 0,
read_env => 0,
);
$cmdline->run;
# ABSTRACT: Get terminal background color
# PODNAME: get-term-bgcolor
__END__
=pod
=encoding UTF-8
=head1 NAME
get-term-bgcolor - Get terminal background color
=head1 VERSION
This document describes version 0.007 of get-term-bgcolor (from Perl distribution App-XTermUtils), released on 2021-05-26.
=head1 SYNOPSIS
Usage:
% get-term-bgcolor [--format=name] [--json] [--(no)naked-res]
[--no-query-terminal] [--no-read-colorfgbg] [--noquery-terminal]
[--noread-colorfgbg] [--page-result[=program]] [--query-terminal]
[--read-colorfgbg] [--view-result[=program]]
=head1 DESCRIPTION
Get the terminal's current background color (in 6-hexdigit format e.g. 000000 or
ffff33), or undef if unavailable. This routine tries the following mechanisms,
from most useful to least useful, in order. Each mechanism can be turned off via
argument.
I<query_terminal>. Querying the terminal is done via sending the following xterm
control sequence:
\e]11;?\a
(or \e]11;?\017). A compatible terminal will issue back the same sequence but
with the question mark replaced by the RGB code, e.g.:
\e]11;rgb:0000/0000/0000\a
I<read_colorfgbg>. Some terminals like Konsole set the environment variable
C<COLORFGBG> containing 16-color color code for foreground and background, e.g.:
C<15;0>.
=head1 OPTIONS
C<*> marks required options.
=head2 Main options
=over
=item B<--no-query-terminal>
=item B<--no-read-colorfgbg>
=back
=head2 Output options
=over
=item B<--format>=I<s>
Choose output format, e.g. json, text.
Default value:
undef
=item B<--json>
Set output format to json.
=item B<--naked-res>
When outputing as JSON, strip result envelope.
Default value:
0
By default, when outputing as JSON, the full enveloped result is returned, e.g.:
[200,"OK",[1,2,3],{"func.extra"=>4}]
The reason is so you can get the status (1st element), status message (2nd
element) as well as result metadata/extra result (4th element) instead of just
the result (3rd element). However, sometimes you want just the result, e.g. when
you want to pipe the result for more post-processing. In this case you can use
`--naked-res` so you just get:
[1,2,3]
=item B<--page-result>
Filter output through a pager.
=item B<--view-result>
View output using a viewer.
( run in 2.053 seconds using v1.01-cache-2.11-cpan-d8267643d1d )