Color.st
changeset 6654 57ee2fe958b9
parent 6584 f087c33d95db
child 6785 7babceb91298
--- a/Color.st	Tue Dec 09 16:29:45 2014 +0100
+++ b/Color.st	Tue Dec 09 16:36:50 2014 +0100
@@ -4127,31 +4127,51 @@
 !
 
 hue
-    "return the hue (in hue/light/saturation model) in degrees [0..360]"
+    "return the hue (in hue/light/saturation model) in degrees [0..360].
+     The hue value is the position on the color wheel.
+     0 is red, 120 green, 240 blue"
 
     |r g b h|
 
     (red isNil and:[colorId notNil]) ifTrue:[
-	device getRGBFrom:colorId into:[:xr :xg :xb |
-	    r := xr.
-	    g := xg.
-	    b := xb.
-	]
+        device getRGBFrom:colorId into:[:xr :xg :xb |
+            r := xr.
+            g := xg.
+            b := xb.
+        ]
     ] ifFalse:[
-	r := self red.
-	g := self green.
-	b := self blue.
+        r := self red.
+        g := self green.
+        b := self blue.
     ].
 
     self class withHLSFromRed:r green:g blue:b do:[:xh :xl :xs |
-	h := xh
+        h := xh
     ].
     ^ h
 
     "
+     Color red hue    
      Color yellow hue
     "
 
+    "
+     color wheel:
+
+     |v|
+
+     v := View new extent:200@200.
+     v openAndWait.
+     0 to:360 do:[:hue |
+        100 downTo:0 do:[:sat |
+            |p|
+            v paint:(Color hue:hue light:50 saturation:sat).
+            p := Point r:sat degrees:hue.
+            v displayLineFrom:100@100 to:p+(100@100).
+        ].
+     ].
+    "
+
     "Modified: 11.6.1996 / 17:14:51 / cg"
 !
 
@@ -5600,11 +5620,11 @@
 !Color class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Color.st,v 1.235 2014-10-23 12:19:08 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Color.st,v 1.236 2014-12-09 15:36:50 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/Color.st,v 1.235 2014-10-23 12:19:08 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Color.st,v 1.236 2014-12-09 15:36:50 cg Exp $'
 ! !