Skip to content

reneeb/Mojolicious-Plugin-MoreHTMLHelpers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Kwalitee status GitHub issues

NAME

Mojolicious::Plugin::MoreHTMLHelpers - Some general helpers

VERSION

version 0.02

SYNOPSIS

In your startup:

  sub startup {
      my $self = shift;

      # do some Mojolicious stuff
      $self->plugin( 'MoreHTMLHelpers' );

      # more Mojolicious stuff
  }

In your template:

<span style="color: <% textcolor('#135713') %>">Any text</span>

HELPERS

This plugin adds a helper method to your web application:

textcolor

This method requires at least one parameter: The color the text color is based on. The text color should have a contrast to the background color. In web apps where the user can define its own color set, it's necessary to calculate the textcolor on the fly. This is what this helper is for.

<span style="background-color: #135713; color: <% textcolor('#135713') %>">Any text</span>

gradient

This creates the CSS directives for a gradient

<style>
    .black-gradient { <%= gradient('#000000') %> }
</style>

will be

<style>
    .black-gradient {
        background: #000000 !important;
        background: -moz-linear-gradient(top,  #000000 0%,#000000 100%) !important;
        background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #000000), color-stop(100%,#000000)) !important;
        background: -webkit-linear-gradient(top,  #000000 0%,#000000 100%) !important;
        background: -o-linear-gradient(top,  #000000 0%,#000000 100%) !important;
        background: -ms-linear-gradient(top,  #000000 0%,#000000 100%) !important;
        background: linear-gradient(to bottom,#000000 0%,#000000 100%) !important;
}
</style>

METHODS

register

Called when registering the plugin. On creation, the plugin accepts a hashref to configure the plugin.

# load plugin, alerts are dismissable by default
$self->plugin( 'MoreHTMLHelpers' );

Development

The distribution is contained in a Git repository, so simply clone the repository

$ git clone http://github.com/reneeb/Mojolicious-Plugin-MoreHTMLHelpers.git

and change into the newly-created directory.

$ cd Mojolicious-Plugin-MoreHTMLHelpers

The project uses Dist::Zilla to build the distribution, hence this will need to be installed before continuing:

$ cpanm Dist::Zilla

To install the required prequisite packages, run the following set of commands:

$ dzil authordeps --missing | cpanm
$ dzil listdeps --author --missing | cpanm

The distribution can be tested like so:

$ dzil test

To run the full set of tests (including author and release-process tests), add the --author and --release options:

$ dzil test --author --release

AUTHOR

Renee Baecker reneeb@cpan.org

COPYRIGHT AND LICENSE

This software is Copyright (c) 2015 by Renee Baecker.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages