ColorMenu.st
changeset 1372 54d8812de860
parent 1119 11cd3ce5171b
child 1410 be0e2a06be7c
--- a/ColorMenu.st	Sat May 08 20:13:33 1999 +0200
+++ b/ColorMenu.st	Sat May 08 23:48:05 1999 +0200
@@ -130,10 +130,12 @@
 colorMenu:labelAreColored value:aValue
     "returns a color menu
     "
-    |menu fgOrBg mainCol style|
+    |menu fgOrBg mainCol style e|
 
     menu  := Menu new.
-    style := labelAreColored == false ifTrue:[#backgroundColor] ifFalse:[#color].
+    style := (labelAreColored == false) 
+                ifTrue:[#backgroundColor] 
+                ifFalse:[#color].
 
     self colorDefinition do:[:aSlice|
         |size colOp color item smenu|
@@ -159,7 +161,17 @@
                     colOp keywords keysAndValuesDo:[:i :c| label := label, ' ', c, ' ' , (el at:i) printString ].
                 ]
             ].
-            sitem := MenuItem labeled:(Text string:('Color ', label) emphasis:(style->color)).
+            e := style->color.
+            style == #backgroundColor ifTrue:[
+                color brightness < 0.5 ifTrue:[
+                    e := Array with:e
+                               with:(#color->Color white) 
+                ]
+            ].
+            sitem := MenuItem 
+                        labeled:(Text 
+                                    string:('Color ', label)
+                                    emphasis:e).
             sitem argument:color.
             sitem value:aValue.
             smenu addItem:sitem.
@@ -631,5 +643,5 @@
 !ColorMenu class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/ColorMenu.st,v 1.17 1998-09-08 11:10:04 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/ColorMenu.st,v 1.18 1999-05-08 21:48:05 cg Exp $'
 ! !