Skip to Content
Perl Graphics Programming
book

Perl Graphics Programming

by Shawn Wallace
December 2002
Beginner
478 pages
17h 55m
English
O'Reilly Media, Inc.
Content preview from Perl Graphics Programming

Colors and Fonts in GD::Graph

All GD::Graph color routines that take colorname as a parameter expect a string with the name of a valid color. GD::Graph comes bundled with the GD::Graph::colour[5] package, which provides some methods for organizing and manipulating color name strings. GD::Graph has 29 predefined color name strings (see Table 4-1). The module is normally used simply to provide access to the standard color names, but it also provides methods for converting between color representations. You can define additional strings in an external file by using the read_rgb( ) method.

Table 4-1. The 29 predefined GD::Graph color names and their hex representations

Color name string

Red

Green

Blue

Hex representation

white

255

255

255

#FFFFFF

lyellow

255

255

0

#FFFF00

gold

255

215

0

#FFD700

cyan

0

255

255

#00FFFF

pink

255

183

193

#FFB7C1

lgray

191

191

191

#BFBFBF

lorange

255

183

0

#FFB700

lbrown

210

180

140

#D2B48C

lgreen

0

255

0

#00FF00

yellow

191

191

0

#BFBF00

orange

255

127

0

#FF7F00

dpink

255

105

180

#FF69B4

green

0

191

0

#00BF00

marine

127

127

255

#7F7FFF

gray

127

127

127

#7F7F7F

dyellow

127

127

0

#7F7F00

dgreen

0

127

0

#007F00

lpurple

255

0

255

#FF00FF

dbrown

165

42

42

#A52A2A

dgray

63

63

63

#3F3F3F

purple

191

0

191

#BF00BF

lred

255

0

0

#FF0000

red

191

0

0

#BF0000

dpurple

127

0

127

#7F007F

dred

127

0

0

#7F0000

lblue

0

0

255

#0000FF

blue

0

0

191

#0000BF

dblue

0

0

127

#00007F

black

0

0

0

#000000

Call the use method with the :colours tag to import the functions _rgb( ), _hue( ), and _luminance( ). The :lists tag imports only colour_list( ) and sorted_colour_list( ), and the :files tag imports the read_rgb( ) function.

The various ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Perl for C Programmers

Perl for C Programmers

Steve Oualline
Programming the Perl DBI

Programming the Perl DBI

Tim Bunce, Alligator Descartes

Publisher Resources

ISBN: 9781449358280Errata Page