An open API service indexing awesome lists of open source software.

https://github.com/michal-josef-spacek/tags-html-gradientindicator

Tags helper for gradient evaluation.
https://github.com/michal-josef-spacek/tags-html-gradientindicator

Last synced: 2 months ago
JSON representation

Tags helper for gradient evaluation.

Awesome Lists containing this project

README

        

NAME
Tags::HTML::GradientIndicator - Tags helper for gradient evaluation.

SYNOPSIS
use Tags::HTML::GradientIndicator;

my $obj = Tags::HTML::GradientIndicator->new(%params);
$obj->process($stars_hr);
$obj->process_css;

METHODS
"new"
my $obj = Tags::HTML::GradientIndicator->new(%params);

Constructor.

* "css"

'CSS::Struct::Output' object for process_css processing.

It's required.

Default value is undef.

* "css_background_image"

CSS parameter for background-image of gradient.

Default value is 'linear-gradient(to right, red, orange, yellow,
green, blue, indigo, violet)'.

* "css_gradient_class"

CSS class name for gradient.

Default value is 'gradient'.

* "height"

Indicator height.

Default value is 30.

* "width"

Indicator width.

Default value is 500.

* "tags"

'Tags::Output' object.

Default value is undef.

"process"
$obj->process($percent_value);

Process Tags structure for gradient.

Returns undef.

"process_css"
$obj->process_css;

Process CSS::Struct structure for output.

Returns undef.

ERRORS
new():
From Class::Utils::set_params():
Unknown parameter '%s'.
From Mo::utils::CSS::check_css_unit():
Parameter 'height' doesn't contain unit number.
Value: %s
Parameter 'height' doesn't contain unit name.
Value: %s
Parameter 'height' contain bad unit.
Unit: %s
Value: %s
Parameter 'width' doesn't contain unit number.
Value: %s
Parameter 'width' doesn't contain unit name.
Value: %s
Parameter 'width' contain bad unit.
Unit: %s
Value: %s
From Tags::HTML::new():
Parameter 'css' must be a 'CSS::Struct::Output::*' class.
Parameter 'tags' must be a 'Tags::Output::*' class.

EXAMPLE1
use strict;
use warnings;

use CSS::Struct::Output::Indent;
use Tags::HTML::GradientIndicator;
use Tags::Output::Indent;

# Object.
my $css = CSS::Struct::Output::Indent->new;
my $tags = Tags::Output::Indent->new;
my $obj = Tags::HTML::GradientIndicator->new(
'css' => $css,
'tags' => $tags,
);

# Process indicator.
$obj->process_css;
$obj->process(50);

# Print out.
print "CSS\n";
print $css->flush."\n";
print "HTML\n";
print $tags->flush."\n";

# Output:
# CSS
# .gradient {
# height: 30px;
# width: 500px;
# background-color: red;
# background-image: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet);
# }
# HTML
#


#

#

#

EXAMPLE2
use strict;
use warnings;

use CSS::Struct::Output::Indent;
use Tags::HTML::GradientIndicator;
use Tags::Output::Indent;

if (@ARGV < 1) {
print STDERR "Usage: $0 percent\n";
exit 1;
}
my $percent = $ARGV[0];

# Object.
my $css = CSS::Struct::Output::Indent->new;
my $tags = Tags::Output::Indent->new;
my $obj = Tags::HTML::GradientIndicator->new(
'css' => $css,
'tags' => $tags,
);

# Process indicator.
$obj->process_css;
$obj->process($percent);

# Print out.
print "CSS\n";
print $css->flush."\n";
print "HTML\n";
print $tags->flush."\n";

# Output for 30:
# CSS
# .gradient {
# height: 30px;
# width: 500px;
# background-color: red;
# background-image: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet);
# }
# HTML
#


#

#

#

DEPENDENCIES
Class::Utils, Error::Pure, Mo::utils::CSS, Tags::HTML.

SEE ALSO
Tags::HTML::Stars
Tags helper for stars evaluation.

REPOSITORY

AUTHOR
Michal Josef Špaček

LICENSE AND COPYRIGHT
© Michal Josef Špaček 2021-2024

BSD 2-Clause License

VERSION
0.07