Text.st
changeset 3248 309a8d08428a
parent 3174 a0dd35569355
child 3273 7cf94988dc15
--- a/Text.st	Fri Apr 18 16:36:53 2014 +0200
+++ b/Text.st	Mon Apr 21 13:39:39 2014 +0200
@@ -1386,6 +1386,29 @@
     "
 !
 
+withColor:aColor
+    "change the color of all characters"
+
+    self emphasisAllAdd:(ColorEmphasis -> aColor).
+
+    "
+     Transcript showCR:
+        ((Text string:'hello') colorizeAllWith:(Color red)) 
+
+     Transcript showCR:
+        ('hello' colorizeAllWith:(Color red)) 
+
+     Transcript showCR:
+        ('hello' allBold colorizeAllWith:(Color red)) 
+
+     Transcript showCR:
+        ('hello' asText colorizeAllWith:(Color red)) 
+
+     Transcript showCR:
+        ('hello ' , ('red' allBold colorizeAllWith:(Color red)) , ' world')
+    "
+!
+
 withoutAnyColorEmphasis
     ^ (self withoutEmphasis:BackgroundColorEmphasis) withoutEmphasis:ColorEmphasis
 !
@@ -1827,11 +1850,11 @@
 !Text class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/Text.st,v 1.124 2014-02-18 16:54:49 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/Text.st,v 1.125 2014-04-21 11:39:39 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic2/Text.st,v 1.124 2014-02-18 16:54:49 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/Text.st,v 1.125 2014-04-21 11:39:39 cg Exp $'
 ! !