Rebol Color to HTML Color
[1/5] from: sunandadh::aol::com at: 27-Jun-2002 4:40
I recently "needed" (as in wanted on a whim) a varying range of pastel colors
for a HTML table.
The code I came up with to convert a rebol tuple (eg 255.0.255) into a HTML
color spec (#FF00FF) is ungainly to say the least.
Any ideas for a better way? Thanks,
Sunanda.
;; ==================
get-random-pastel: func [/local t1 t2] [
;; ==================
t1: 255.255.255 - random/secure 15.15.15
t2: mold to-binary join to-char t1/1 [to-char t1/2 to-char t1/3]
replace t2 "{" ""
replace t2 "}" ""
return t2
]
[2/5] from: dockimbel:free at: 27-Jun-2002 11:43
KIS (Keep It Simple):
get-random-pastel: does [mold to-binary 255.255.255 - random/secure 15.15.15]
HTH,
-DocKimbel.
[SunandaDH--aol--com] wrote:
[3/5] from: dockimbel:free at: 27-Jun-2002 12:15
Ooops, sorry, not exactly the wanted result. This is what happens when working
on 3 things at the same time. ;)
These 2 solutions should give the correct result :
get-random-pastel: does [to-issue enbase/base to-binary 255.255.255 - random/secure 15.15.15
16]
get-random-pastel: does [skip to-hex to-integer to-binary 255.255.255 - random/secure
15.15.15 2]
Regards,
-DocKimbel.
Nenad Rakocevic wrote:
[4/5] from: sunandadh:aol at: 27-Jun-2002 13:04
DocKimbel:
> These 2 solutions should give the correct result :
>
> get-random-pastel: does [to-issue enbase/base to-binary 255.255.255 -
random/
> secure 15.15.15 16]
> get-random-pastel: does [skip to-hex to-integer to-binary 255.255.255 -
> random/secure 15.15.15 2]
Thanks!
They do indeed -- I had played with something like the hex/integer/binary
conversion path but backtracked before I got all the way.
Sunanda.
[5/5] from: g:santilli:tiscalinet:it at: 29-Jun-2002 14:39
Hi SunandaDH,
On Thursday, June 27, 2002, 10:40:50 AM, you wrote:
Sac> Any ideas for a better way? Thanks,
>> trim/with form to-binary 255.255.255 "{}"
== "#FFFFFF"
>> join "#" enbase/base to-binary 255.255.255 16
== "#FFFFFF"
>> mold to-issue enbase/base to-binary 255.255.255 16
== "#FFFFFF"
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r