colorMenu: change labelColor to white for dark preview colors;
authorClaus Gittinger <cg@exept.de>
Tue, 08 Sep 1998 13:10:04 +0200
changeset 1119 11cd3ce5171b
parent 1118 a49afa5a9f10
child 1120 6f4f09f9ad43
colorMenu: change labelColor to white for dark preview colors; beautified geometry.
ColorMenu.st
--- a/ColorMenu.st	Tue Sep 08 12:18:27 1998 +0200
+++ b/ColorMenu.st	Tue Sep 08 13:10:04 1998 +0200
@@ -379,11 +379,11 @@
           #window: 
            #(#WindowSpec
               #name: 'Define Color'
-              #layout: #(#LayoutFrame 154 0 369 0 493 0 488 0)
+              #layout: #(#LayoutFrame 13 0 29 0 352 0 159 0)
               #label: 'Define Color'
               #min: #(#Point 340 110)
               #max: #(#Point 1152 900)
-              #bounds: #(#Rectangle 154 369 494 489)
+              #bounds: #(#Rectangle 13 29 353 160)
               #usePreferredExtent: false
           )
           #component: 
@@ -392,7 +392,7 @@
                #(
                  #(#VerticalPanelViewSpec
                     #name: 'VerticalPanel1'
-                    #layout: #(#LayoutFrame 0 0.0 0 0.0 60 0 -32 1.0)
+                    #layout: #(#LayoutFrame 0 0.0 0 0.0 58 0 -40 1.0)
                     #component: 
                      #(#SpecCollection
                         #collection: 
@@ -402,73 +402,76 @@
                               #label: 'Red:'
                               #translateLabel: true
                               #adjust: #right
-                              #extent: #(#Point 60 27)
+                              #extent: #(#Point 58 26)
                           )
                            #(#LabelSpec
                               #name: 'GreenLabel'
                               #label: 'Green:'
                               #translateLabel: true
                               #adjust: #right
-                              #extent: #(#Point 60 28)
+                              #extent: #(#Point 58 27)
                           )
                            #(#LabelSpec
                               #name: 'BlueLabel'
                               #label: 'Blue:'
                               #translateLabel: true
                               #adjust: #right
-                              #extent: #(#Point 60 27)
+                              #extent: #(#Point 58 26)
                           )
                         )
                     )
                     #horizontalLayout: #fit
-                    #verticalLayout: #fit
+                    #verticalLayout: #fitSpace
                     #horizontalSpace: 3
                     #verticalSpace: 3
                 )
                  #(#VerticalPanelViewSpec
                     #name: 'VerticalPanel2'
-                    #layout: #(#LayoutFrame 60 0 0 0.0 -160 1.0 -32 1.0)
+                    #layout: #(#LayoutFrame 60 0 0 0.0 -160 1.0 -40 1.0)
                     #component: 
                      #(#SpecCollection
                         #collection: 
                          #(
                            #(#SliderSpec
                               #name: 'RedSlider'
+                              #tabable: true
                               #model: #red
                               #orientation: #horizontal
                               #stop: 255
                               #step: 1
                               #backgroundColor: #(#Color 100.0 0.0 0.0)
-                              #extent: #(#Point 120 27)
+                              #extent: #(#Point 118 16)
                           )
                            #(#SliderSpec
                               #name: 'GreenSlider'
+                              #tabable: true
                               #model: #green
                               #orientation: #horizontal
                               #stop: 255
                               #step: 1
                               #backgroundColor: #(#Color 0.0 100.0 0.0)
-                              #extent: #(#Point 120 28)
+                              #extent: #(#Point 118 16)
                           )
                            #(#SliderSpec
                               #name: 'BlueSlider'
+                              #tabable: true
                               #model: #blue
                               #orientation: #horizontal
                               #stop: 255
                               #step: 1
                               #backgroundColor: #(#Color 0.0 0.0 100.0)
-                              #extent: #(#Point 120 27)
+                              #extent: #(#Point 118 16)
                           )
                         )
                     )
                     #horizontalLayout: #fit
-                    #verticalLayout: #fit
+                    #verticalLayout: #spreadSpace
                     #horizontalSpace: 3
                     #verticalSpace: 3
                 )
                  #(#VerticalPanelViewSpec
                     #name: 'VerticalPanel3'
-                    #layout: #(#LayoutFrame -160 1 0 0.0 -120 1 -32 1.0)
+                    #layout: #(#LayoutFrame -158 1 0 0.0 -120 1 -40 1.0)
                     #component: 
                      #(#SpecCollection
                         #collection: 
@@ -480,7 +483,7 @@
                               #numChars: 3
                               #minValue: 0
                               #maxValue: 255
-                              #extent: #(#Point 40 27)
+                              #extent: #(#Point 38 20)
                           )
                            #(#InputFieldSpec
                               #name: 'GreenField'
@@ -489,7 +492,7 @@
                               #numChars: 3
                               #minValue: 0
                               #maxValue: 255
-                              #extent: #(#Point 40 28)
+                              #extent: #(#Point 38 20)
                           )
                            #(#InputFieldSpec
                               #name: 'BlueField'
@@ -498,18 +501,18 @@
                               #numChars: 3
                               #minValue: 0
                               #maxValue: 255
-                              #extent: #(#Point 40 27)
+                              #extent: #(#Point 38 20)
                           )
                         )
                     )
                     #horizontalLayout: #fit
-                    #verticalLayout: #fit
+                    #verticalLayout: #spreadSpace
                     #horizontalSpace: 3
                     #verticalSpace: 3
                 )
                  #(#LabelSpec
                     #name: 'PreviewBox'
-                    #layout: #(#LayoutFrame -118 1 0 0.0 -2 1.0 -32 1.0)
+                    #layout: #(#LayoutFrame -116 1 0 0.0 -2 1.0 -40 1.0)
                     #label: 'Preview'
                     #translateLabel: true
                     #level: -1
@@ -538,13 +541,15 @@
                         )
                     )
                     #horizontalLayout: #fitSpace
-                    #verticalLayout: #fitSpace
+                    #verticalLayout: #centerMax
                     #horizontalSpace: 3
                     #verticalSpace: 3
                 )
               )
           )
       )
+
+    "Modified: / 6.9.1998 / 23:04:19 / cg"
 ! !
 
 !ColorMenu::DefineColor methodsFor:'accessing'!
@@ -601,7 +606,18 @@
 
     super postBuildWith:aBuilder.
 
-    updateBlock := [(builder componentAt: #PreviewBox) backgroundColor: self color].
+    updateBlock := [
+        |box clr|
+
+        box := builder componentAt: #PreviewBox.
+        clr := self color.
+        box backgroundColor:clr.
+        clr brightness < 0.5 ifTrue:[
+            box foregroundColor:Color white
+        ] ifFalse:[
+            box foregroundColor:Color black
+        ]
+    ].
 
     red   onChangeSend: #value to: updateBlock.
     green onChangeSend: #value to: updateBlock.
@@ -609,11 +625,11 @@
 
     updateBlock value
 
-
+    "Modified: / 6.9.1998 / 22:55:25 / cg"
 ! !
 
 !ColorMenu class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/ColorMenu.st,v 1.16 1998-08-06 18:18:44 tz Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/ColorMenu.st,v 1.17 1998-09-08 11:10:04 cg Exp $'
 ! !