Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Colorize

by extremely (Priest)
on Jun 13, 2001 at 06:58 UTC ( #87994=note: print w/ replies, xml ) Need Help??

in reply to Colorize

Well, not to toot my own horn too much but you could add my Web Color Spectrum Generator to yours and let it scale a color spectrum across the text. That is one of the two uses I built it for, the other being coloring table rows.

$you = new YOU;
honk() if $you->love(perl)

Comment on Re: Colorize
Replies are listed 'Best First'.
Re: Re: Colorize
by WrongWay (Pilgrim) on Jun 13, 2001 at 07:45 UTC
    I actaully looked at that, but deemed it too much for my needs.

    I am currently using this sub to colorize 1,000s of mp3 titles on a private mp3 jukebox of mine. Everytime time I generate the list(do a search) this sub gets called 1,000s of times. I wanted it to keep it light and tight so to speak. Just the basics. Get in and get out quick.

      If speed is a concern, among other things, you might move the declaration of @colors out into an enclosing block:
      { my @colors=(...); sub colorize { ... } }
      This way, @colors will still have only be 'locally' visible to colorize, but it will only be created once, at load-time, instead of every time you call colorize();.
        And be sure that's in a BEGIN block, not just a naked block, or else there's a chance that the initializer for @colors might not have run yet.


        { my @colors=(...); sub colorize { ... } }


        BEGIN { my @colors=(...); sub colorize { ... } }

        -- Randal L. Schwartz, Perl hacker
        Be sure to read my standard disclaimer if this is a reply.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://87994]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2015-10-04 08:17 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (100 votes), past polls