Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Looping over all defined colours

26 views
Skip to first unread message

Cecil Westerhof

unread,
Nov 11, 2012, 5:34:20 AM11/11/12
to
Someone on this mailing-list showed met the simple way down to declare
a lot of colours at once. I wold like to do something with all those
colours. Is there a way to iterate the colours?

/colors <<
/colorBlack { 0 0 0 }
/colorBlue { 0 0 1 }
/colorCyan { 0 1 1 } % aqua
/colorFuchsia { 1 0 1 }
/colorGray { .5 .5 .5 }
/colorGreen { 0 .5 0 }
/colorIndigo { .31 0 .5 }
/colorLime { 0 1 0 }
/colorMaroon { .5 0 0 }
/colorNavy { 0 0 .5 }
/colorOlive { .5 .5 0 }
/colorOrange { 1 .56 0 }
/colorPurple { .5 0 .5 }
/colorRed { 1 0 0 }
/colorSilver { .75 .75 .75 }
/colorTeal { 0 .5 .5 }
/colorViolet { .94 .5 .94 }
/colorWhite { 1 1 1 }
/colorYellow { 1 1 0 }
>> def
colors begin

--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

Don Lancaster

unread,
Nov 11, 2012, 12:52:41 PM11/11/12
to
See the many examples on our website.

works for url's; modify for colors...

<< /name1 {data1} name2 {data2}... >>
{mark exch /eurl cvx ] cvx def} forall





--
Many thanks,

Don Lancaster voice phone: (928)428-4073
Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552
rss: http://www.tinaja.com/whtnu.xml email: d...@tinaja.com

Please visit my GURU's LAIR web site at http://www.tinaja.com

Cecil Westerhof

unread,
Nov 17, 2012, 8:50:28 AM11/17/12
to
Op zondag 11 nov 2012 11:34 CET schreef Cecil Westerhof:
I thought that it was perhaps a good idea to show my solution. It is
not the best code (I am still learning to program in postscript) and I
am using a library (but only for the creating of a font and
centerString if I remember well).

%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 595 842

/pageBottom 0 def
/pageLeft 0 def
/pageRight 595 def
/pageTop 842 def

#standard

% Library init
/authorFont 8 def
/backgroundGray .9 def
/usedFont /Bookman-ISOLatin1 findfont def


% Program functions
/displayColour { % r g b colour left bottom right top
5 dict begin
/top exch def
/right exch def
/bottom exch def
/left exch def
/colour exch def

colour right left sub 2 div left add top 10 add centerString
left bottom right top rectangle
gsave
setrgbcolor
fill
grestore
stroke
end
} def

/displayRow {
10 bottom 85 top displayColour
110 bottom 185 top displayColour
210 bottom 285 top displayColour
310 bottom 385 top displayColour
410 bottom 485 top displayColour
510 bottom 585 top displayColour
} def

% Program init
usedFont
authorFont scalefont
setfont


colorWhite ()
colorWhite ()
colorWhite ()
colorWhite ()
colorWhite ()
colorYellowGreen (YellowGreen)
colorYellow (Yellow)
colorWhite (White)
colorWheat (Wheat)
colorVioletRed (VioletRed)
colorViolet2 (Violet2)
colorViolet (Violet)
colorVeryLightGrey (VeryLightGrey)
colorVeryDarkBrown (VeryDarkBrown)
colorTurquoise (Turquoise)
colorThistle (Thistle)
colorTeal (Teal)
colorTan (Tan)
colorSummerSky (SummerSky)
colorSteelBlue (SteelBlue)
colorSpringGreen (SpringGreen)
colorSpicyPink (SpicyPink)
colorSlateBlue (SlateBlue)
colorSkyBlue (SkyBlue)
colorSilver (Silver)
colorSienna (Sienna)
colorSemiSweetChocolate (SemiSweetChocolate)
colorSeaShell (SeaShell)
colorSeaGreen (SeaGreen)
colorScarlet (Scarlet)
colorSalmon (Salmon)
colorRichBlue (RichBlue)
colorRed (Red)
colorQuartz (Quartz)
colorPurple (Purple)
colorPlum (Plum)
colorPink (Pink)
colorPeachPuff (PeachPuff)
colorPaleTurquoise (PaleTurquoise)
colorPaleGreen (PaleGreen)
colorOrchid (Orchid)
colorOrangeRed (OrangeRed)
colorOrange (Orange)
colorOlive (Olive)
colorOldGold (OldGold)
colorNewTan (NewTan)
colorNewMidnightBlue (NewMidnightBlue)
colorNeonPink (NeonPink)
colorNeonBlue (NeonBlue)
colorNavyBlue (NavyBlue)
colorNavy (Navy)
colorMidnightBlue (MidnightBlue)
colorMediumWood (MediumWood)
colorMediumVioletRed (MediumVioletRed)
colorMediumTurquoise (MediumTurquoise)
colorMediumSpringGreen (MediumSpringGreen)
colorMediumSlateBlue (MediumSlateBlue)
colorMediumSeaGreen (MediumSeaGreen)
colorMediumOrchid (MediumOrchid)
colorMediumForestGreen (MediumForestGreen)
colorMediumBlue (MediumBlue)
colorMediumAquamarine (MediumAquamarine)
colorMaroon2 (Maroon2)
colorMaroon (Maroon)
colorMandarianOrange (MandarianOrange)
colorLimeGreen (LimeGreen)
colorLime (Lime)
colorLightSteelBlue (LightSteelBlue)
colorLightGrey2 (LightGrey2)
colorLightGrey (LightGrey)
colorLightBlue (LightBlue)
colorKhaki (Khaki)
colorIndigo (Indigo)
colorIndianRed (IndianRed)
colorHunterGreen (HunterGreen)
colorHoneydew (Honeydew)
colorGreen (Green)
colorGrey (Grey)
colorGreenYellow (GreenYellow)
colorGreenCopper (GreenCopper)
colorGreen (Green)
colorGoldenrod (Goldenrod)
colorGold (Gold)
colorFuchsia (Fuchsia)
colorForestGreen (ForestGreen)
colorFirebrick (Firebrick)
colorFeldspar (Feldspar)
colorFuchsia (Fuchsia)
colorDustyRose (DustyRose)
colorDimGrey (DimGrey)
colorDarkWood (DarkWood)
colorDarkTurquoise (DarkTurquoise)
colorDarkTan (DarkTan)
colorDarkSlateGrey (DarkSlateGrey)
colorDarkSlateBlue (DarkSlateBlue)
colorDarkPurple (DarkPurple)
colorDarkOrchid (DarkOrchid)
colorDarkOliveGreen (DarkOliveGreen)
colorDarkGreenCopper (DarkGreenCopper)
colorDarkGreen (DarkGreen)
colorDarkBrown (DarkBrown)
colorCyan (Cyan)
colorCornFlowerBlue (CornFlowerBlue)
colorCoral (Coral)
colorCopper (Copper)
colorCoolCopper (CoolCopper)
colorCadetBlue (CadetBlue)
colorBronzeII (BronzeII)
colorBronze (Bronze)
colorBrown (Brown)
colorBrightGold (BrightGold)
colorBrass (Brass)
colorBlueViolet (BlueViolet)
colorBlue (Blue)
colorBlack (Black)
colorBakersChocolate (BakersChocolate)
colorBeige (Beige)
colorAzure (Azure)
colorAliceblue (Aliceblue)
colorAquamarine (Aquamarine)


% Program
.9 grayBackground

/bottom 800 def
/top 825 def
displayRow

/bottom 750 def
/top 775 def
displayRow

/bottom 700 def
/top 725 def
displayRow

/bottom 650 def
/top 675 def
displayRow

/bottom 600 def
/top 625 def
displayRow

/bottom 550 def
/top 575 def
displayRow

/bottom 500 def
/top 525 def
displayRow

/bottom 450 def
/top 475 def
displayRow

/bottom 400 def
/top 425 def
displayRow

/bottom 350 def
/top 375 def
displayRow

/bottom 300 def
/top 325 def
displayRow

/bottom 250 def
/top 275 def
displayRow

/bottom 200 def
/top 225 def
displayRow

/bottom 150 def
/top 175 def
displayRow

/bottom 100 def
/top 125 def
displayRow

/bottom 50 def
/top 75 def
displayRow

showpage


.9 grayBackground

/bottom 800 def
/top 825 def
displayRow

/bottom 750 def
/top 775 def
displayRow

/bottom 700 def
/top 725 def
displayRow

/bottom 650 def
/top 675 def
displayRow

showpage
0 new messages