Setting a web hex color as background color for a canvas 
Author Message
 Setting a web hex color as background color for a canvas

Hi all Smalltalkers,

somebody has an idea how to set a web format hex color value
(#'B0A7A3'') as background color to a canvas? Or how do I convert the
hex value to a VisualWave Smalltalk ColorValue?

Thanks for any help !!
Mike Mueller



Sat, 22 Feb 2003 15:56:38 GMT  
 Setting a web hex color as background color for a canvas
Hi

You can easily convert color to its hex value by sending asWebHex to
instance of ColorValue. That's exactly what's going on during building of a
web page by VisualWave.

Boris.

PS And I really like B0A7A3. It's so hard to find nice color these days.


Quote:
> Hi all Smalltalkers,

> somebody has an idea how to set a web format hex color value
> (#'B0A7A3'') as background color to a canvas? Or how do I convert the
> hex value to a VisualWave Smalltalk ColorValue?

> Thanks for any help !!
> Mike Mueller



Sun, 23 Feb 2003 08:00:53 GMT  
 Setting a web hex color as background color for a canvas
Hi
And also to make it in another direction from hex to aColorValue ( which is
what you originally wanted but I did not understand :-# ) you might want to
use

    String>>fromWebHexToColor
Example:  '#0000FF' fromWebHexToColor

If you are using older version of VisualWorks and do not have that method
here it is:
***************************************
String>>fromWebHexToColor
 | s anArray i r g b |
 s := ReadWriteStream with: (self copyWithout: $#).
 s reset.
 anArray := Array new: 3.
 1 to: 3
  do:
   [:idx |
   i := ReadWriteStream on: String new.
   i nextPutAll: (s next: 2).
   i reset.

   anArray at: idx put: (Integer readFrom: i radix: 16 )].
 r := (anArray at: 1) / 255.
 g := (anArray at: 2) / 255.
 b := (anArray at: 3) / 255.
 ^ColorValue red: r green: g blue: b
***************************************

Best regards, Boris


Quote:
> Hi all Smalltalkers,

> somebody has an idea how to set a web format hex color value
> (#'B0A7A3'') as background color to a canvas? Or how do I convert the
> hex value to a VisualWave Smalltalk ColorValue?

> Thanks for any help !!
> Mike Mueller



Sun, 23 Feb 2003 13:22:40 GMT  
 Setting a web hex color as background color for a canvas
And PLUS I just made it a little bit easier for all of you by extending
existing ColorToolModel by adding additional button.
Later tomorrow I'm gonna add HSB , Lab and CMYK buttons to it.

You can check out
http://www.macrocosmsystems.com/tools/color/
for more information.

Boris


Quote:
> Hi all Smalltalkers,

> somebody has an idea how to set a web format hex color value
> (#'B0A7A3'') as background color to a canvas? Or how do I convert the
> hex value to a VisualWave Smalltalk ColorValue?

> Thanks for any help !!
> Mike Mueller



Sun, 23 Feb 2003 14:07:18 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. How can i change background color afte setting in canvas command

2. conflicts between button colors and background color

3. Changing font color/size and background color with Tile

4. Tkinter canvas: bounding box vs. background color

5. in canvas text item can background color be changed

6. Help with multiple background colors to canvas/text widgets

7. setting button background color

8. How to set background color in VisualWorks 2.0

9. Setting color for mouse color (text)

10. Setting OS/2's Desktop Background Color

11. SWI-Prolog: How can I set the background and font color

12. Setting background colors in wpy

 

 
Powered by phpBB® Forum Software