[Newbies] Color>>hex doesn't work ...
Benjamin Schroeder
benschroeder at acm.org
Sat May 6 15:11:56 UTC 2006
Hi Steve,
> Yes - sorry. hex instance method is added by seaside. Looks like so:
>
> hex
> ^ ((self red * 255) asInteger printPaddedWith: $0 to: 2 base: 16) ,
> ((self green * 255) asInteger printPaddedWith: $0 to: 2 base: 16) ,
> ((self blue * 255) asInteger printPaddedWith: $0 to: 2 base: 16).
Ah, I see! I should have checked my Seaside image ... :)
We might be able to make use of Color class>>hex: here in any
case ... replacing the Color>>hex method with something like
hex
^ (self class hex: self red),
(self class hex: self green),
(self class hex: self blue)
might work. I'm of course still not sure why the other method does
what it does; #printPaddedWith:to:base: should probably be fixed in
any case. Color class>>hex: takes a different route to do the
conversion.
This implementation of Color>>hex is terser as well - if it works,
I'll submit it as a patch to the Seaside mailing list when I get a
chance.
Hope this helps,
Ben Schroeder
More information about the Beginners
mailing list