ColorEditDialog.st
changeset 2279 f077161d5d57
parent 2274 e09282d74ec3
child 2326 f23fac376621
--- a/ColorEditDialog.st	Mon Feb 18 19:32:21 2008 +0100
+++ b/ColorEditDialog.st	Mon Feb 25 15:10:16 2008 +0100
@@ -563,11 +563,23 @@
 !ColorEditDialog methodsFor:'accessing'!
 
 color
+    |colorName|
+
+    colorName := self colorName.
+    colorName notEmptyOrNil ifTrue:[
+        ^ colorName asSymbol
+    ].
     ^Color redByte:(red value) greenByte:(green value) blueByte:(blue value)
 !
 
-color:aColor 
-    aColor notNil ifTrue:[
+color:aColor
+    aColor isNil ifTrue:[
+        ^ self
+    ].
+
+    aColor isSymbol ifTrue:[
+        self colorNameHolder value:aColor
+    ] ifFalse:[
         self red value:aColor redByte.
         self green value:aColor greenByte.
         self blue value:aColor blueByte.
@@ -588,8 +600,11 @@
     |clr|
 
     clr := self color.
-    self setPreview:clr.
-    self htmlColorNameHolder value:(clr htmlPrintString).
+    clr isColor ifTrue:[
+        "not a symbol"
+        self setPreview:clr.
+        self htmlColorNameHolder value:(clr htmlPrintString).
+    ].
 !
 
 colorNameChanged
@@ -602,16 +617,16 @@
         ^ self
     ].
 
-    red   value:clr redByte withoutNotifying:self.
-    green value:clr greenByte withoutNotifying:self.
-    blue  value:clr blueByte withoutNotifying:self.
+    self red   value:clr redByte withoutNotifying:self.
+    self green value:clr greenByte withoutNotifying:self.
+    self blue  value:clr blueByte withoutNotifying:self.
 
     h := clr hue.
     h notNil ifTrue:[
-        hue        value:(h rounded) withoutNotifying:self.
+        self hue        value:(h rounded) withoutNotifying:self.
     ].
-    light      value:(clr light rounded) withoutNotifying:self.
-    saturation value:(clr saturation rounded) withoutNotifying:self.
+    self light      value:(clr light rounded) withoutNotifying:self.
+    self saturation value:(clr saturation rounded) withoutNotifying:self.
 
     self colorChanged
 !