Skip to content

Instantly share code, notes, and snippets.

@sora
Created August 26, 2008 22:41
Show Gist options
  • Save sora/7374 to your computer and use it in GitHub Desktop.
Save sora/7374 to your computer and use it in GitHub Desktop.
%!PS-Adobe-3.0 EPSF-3.0
%%Creator: sora
%%Title: rainbow.eps
%%BoundingBox: 0 0 640 640
%%EndComments
/Radius 200 def
/W 320 def /H 320 def
/cshow { dup stringwidth pop 2 div neg 5 rmoveto show } def
/degree2rgb {
/h exch def /s 1 def /v 1 def
/i h 60 idiv floor 6 mod def
/f h 60 idiv floor h 60 div exch sub def
/p s f mul 1 exch sub v mul def
/q 1 f sub s mul 1 exch sub v mul def
i 0 eq { v q 0 } {
i 1 eq { p v 0 } {
i 2 eq { 0 v q } {
i 3 eq { 0 p v } {
i 4 eq { q 0 v } {
i 5 eq { v 0 p } {
0 0 0 } ifelse } ifelse } ifelse } ifelse } ifelse } ifelse
setrgbcolor
} def
/drawCircle {
0 1 359 {
gsave
/curangle exch def
curangle rotate
Radius 0 translate
newpath
curangle degree2rgb
0 0 moveto
curangle 90 mod 0 eq {
1.5 setlinewidth
-10 0 rmoveto
30 0 lineto
} {
2 setlinewidth
20 0 lineto
} ifelse
stroke
grestore
} for
} def
W H translate
drawCircle
/Courier findfont 14 scalefont setfont
.8 setgray
0 0 moveto (rainbow!) cshow
showpage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment