Permalink
Browse files

Added tcolor

  • Loading branch information...
1 parent 06b6748 commit 33f2f438b8bcaa57a3325c0aa78e5a4375e9e77f @statico committed Feb 22, 2012
Showing with 19 additions and 0 deletions.
  1. +19 −0 bin/tcolor
View
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+
+# See http://stackoverflow.com/questions/157959/
+
+import sys
+import os
+
+if len(sys.argv) != 5:
+ print "Usage: %s <red> <green> <blue> <alpha>" % sys.argv[0]
+ print "(values are between 0.0 and 1.0)"
+ sys.exit(1)
+
+r, g, b, a = [int(65535 * float(x)) for x in sys.argv[1:5]]
+c = '{%d, %d, %d, %d}' % (r, g, b, a)
+
+cmd = "osascript -e 'tell application \"Terminal\" to set background color of window 1 to %s'" % c
+print cmd
+os.system(cmd)
+

0 comments on commit 33f2f43

Please sign in to comment.