]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/ui/gadgets/labels/labels.factor
ui.theme: updates to color scheme.
[factor.git] / basis / ui / gadgets / labels / labels.factor
index c95ac71bfb1daf58ebae4b9875cb9ded97a27f35..a4fce2cd57ba57899131af0bbe6ddb10c7cd4f0e 100644 (file)
@@ -1,9 +1,9 @@
 ! Copyright (C) 2005, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays colors.constants combinators fonts
+USING: accessors arrays colors.constants combinators fonts fry
 kernel make math.functions models namespaces sequences splitting
-strings ui.baseline-alignment ui.gadgets ui.gadgets.tracks
-ui.pens.solid ui.render ui.text ;
+strings ui.baseline-alignment ui.gadgets ui.gadgets.theme
+ui.gadgets.tracks ui.pens.solid ui.render ui.text ;
 IN: ui.gadgets.labels
 
 ! A label gadget draws a string.
@@ -64,13 +64,21 @@ M: label baseline*
 M: label cap-height*
     label-metrics cap-height>> round ;
 
+<PRIVATE
+
+: label-background ( label -- color )
+    gadget-background background get or ; inline
+
+: label-foreground ( label -- color )
+    gadget-foreground foreground get or ; inline
+
+PRIVATE>
+
 M: label draw-gadget*
-    >label<
-    [
-        background get [ font-with-background ] when*
-        foreground get [ font-with-foreground ] when*
-    ] dip
-    draw-text ;
+    [ >label< ] keep
+    [ label-background [ font-with-background ] when* ]
+    [ label-foreground [ font-with-foreground ] when* ]
+    bi-curry compose dip draw-text ;
 
 M: label gadget-text* string>> % ;
 
@@ -84,7 +92,7 @@ M: label-control model-changed
         swap >>model ;
 
 : text-theme ( gadget -- gadget )
-    monospace-font >>font ;
+    monospace-font >>font theme-font-colors ;
 
 : reverse-video-theme ( label -- label )
     sans-serif-font reverse-video-font >>font