[Seaside] [BUG] [FIX] Color>>asHtmlColor

Pavel Krivanek squeak3 at continentalbrno.cz
Tue Apr 12 11:44:03 CEST 2005


The method Color>>asHtml returns wrong value because it uses message #hex
and the result has 4 bytes instead of 3. Here's a patch:

asHTMLColor
 | t1 |
 ^ String
  streamContents: [:t2 |
   t2 nextPut: $#.
   t1 := (self red * 256) truncated min: 255.
   t2 nextPut: (t1 // 16) asHexDigit.
   t2 nextPut: (t1 \\ 16) asHexDigit.
   t1 := (self green * 256) truncated min: 255.
   t2 nextPut: (t1 // 16) asHexDigit.
   t2 nextPut: (t1 \\ 16) asHexDigit.
   t1 := (self blue * 256) truncated min: 255.
   t2 nextPut: (t1 // 16) asHexDigit.
   t2 nextPut: (t1 \\ 16) asHexDigit]

-- Pavel



More information about the Seaside mailing list