to colordb2html
colors_by_name=getColorDatabase
c=[]
foreach colors_by_name
[ c=fPut
(Sentence
reHSB RGB (?).2 (?).3 (?).4
(?).1 (?).2 (?).3 (?).4)
c
]
colors_by_hue=mergeSort c
; colors_by_name
out="|
|
i=Int 0
foreach colors_by_name
[ if (mod i 4)==0
[ out=word out "|
|
]
out=(word out "|
|
|
(?).1
"| | |
)
i+=1
]
out=word out "|
|
openWrite "colors_by_name.html
setWriter "colors_by_name.html
type out
setWriter []
close "colors_by_name.html
;now colors_by_hue
out="|
|
i=Int 0
foreach colors_by_hue
[ if (mod i 4)==0
[ out=word out "|
|
]
out=(word out "|
|
|
(?).4
"| | |
)
i+=1
]
out=word out "|
|
openWrite "colors_by_hue.html
setWriter "colors_by_hue.html
type out
setWriter []
close "colors_by_hue.html
end
to htmlcolor r g b
output (word "#
htmlhex r*255
htmlhex g*255
htmlhex b*255)
end
to htmlhex n
ifelse n >= 16
[ output IntForm Int n 2 16
][ ifelse n>=1
[ output word "0 IntForm n 1 16
][ output "00
]
]
end