How to create a SqueakSource image?

Wilkes Joiner wilkesjoiner at gmail.com
Tue Feb 7 22:39:08 UTC 2006


On 2/7/06, Philippe Marschall <philippe.marschall at gmail.com> wrote:
> 2006/2/7, Wilkes Joiner <wilkesjoiner at gmail.com>:
> > I added a kludge to fix this.
> >
> > Color>>hex
> >         ^ (self toHexString: (self red)),
> >           (self toHexString: (self green)),
> >           (self toHexString: (self blue))
> >
> > Color>>toHexString: aNumber
> >         ^ ((aNumber * 255) asInteger hex allButFirst: 3) padded: #left to: 2 with: $0
> >
> > Not pretty but it works.
>
> I think originally it was like this:
>
> Color >> #hex
>         "Color white hex"
>
>         ^       (Character value: (self red * 255.0) asInteger) hex,
>                 (Character value: (self green * 255.0) asInteger) hex,
>                 (Character value: (self blue * 255.0) asInteger) hex
>
> the current code is from the latest Seaside version, strange ...
>
>
there is a version like this:
Color>>hex
	^ (rgb hex allButFirst: 3) asLowercase

But for the default (Color r: 0.21484375 g: 0.1171875 b: 0.51953125)
it returns 'dc1e213' which isn't valid for html.

The version above returns the correct six character representation:
'361D84' or rgb: 54 29 132.



More information about the Squeak-dev mailing list