Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A script to cycle Terminal color/transparency settings' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A script to cycle Terminal color/transparency settings
Authored by: thinkyhead on Aug 26, '04 09:11:36PM
Make it shorter than mine and you win!

#!/usr/bin/perl
$min = ($#ARGV==0 && $ARGV[0]=~/bright/i) ? 45500 : 0;
$r = int(rand(20000)) + $min;
$g = int(rand(20000)) + $min;
$b = int(rand(20000)) + $min;
$col = "$r,$g,$b, -9000";
`osascript -e 'tell front window of app "Terminal" to set background color to {$col}'`;

---
|
| slur was here
|

[ Reply to This | # ]

ZEORGE MADE IT BEST :) HEHE
Authored by: zeorge on Aug 27, '04 02:18:42PM
use this script from your .tcshrc or .bashrc it does not use apple script so its 1000 times faster. you can setup a color list - random colors are chosen. save it als ~/.setcolor.pl for example, and dont forget to chmod +x ~/.setcolor.pl. #!/usr/bin/perl # zeorge 08-2004 - terminal BG color changer - works with panther 10.3.5 # Colors to choose from, in R G B @color_table = ( "0.200 0.000 0.000","0.000 0.200 0.000","0.000 0.000 0.200" ); $opaqueness = "0.95"; #defaults read com.apple.terminal TextColors @text_colors = split " ",`defaults read com.apple.terminal TextColors`; # Randomly select a Color $index = int( rand( scalar( @color_table ) ) ); @colors = split " ", @color_table[$index]; # set selected color in TextColors array # pos 1 and 4 of TextColors = background color $pos = 1 ; @text_colors[$pos*3] = @colors[0]; @text_colors[$pos*3+1] = @colors[1]; @text_colors[$pos*3+2] = @colors[2]; $pos = 4 ; @text_colors[$pos*3] = @colors[0]; @text_colors[$pos*3+1] = @colors[1]; @text_colors[$pos*3+2] = @colors[2]; # ( pos 0 and 4 of TextColors = text color # pos 2 and 3 of TextColors = text bold color # pos 6 of TextColors = selection color # pos 7 of TextColors = cursor color ) # Set the new background color via the 'defaults' command system("defaults","write","com.apple.terminal","TextColors","@text_colors"); system("defaults","write","com.apple.terminal","TerminalOpaqueness","$opaqueness");

[ Reply to This | # ]
ZEORGE MADE IT BEST :) HEHE
Authored by: zeorge on Aug 27, '04 02:27:10PM

use this script from your .tcshrc or .bashrc
it does not use apple script so its 1000 times faster.
you can setup a color list - random colors are chosen.

save it als ~/.setcolor.pl for example,
and dont forget to chmod +x ~/.setcolor.pl.

<code>
#!/usr/bin/perl
# zeorge 08-2004 - terminal BG color changer - works with panther 10.3.5

# Colors to choose from, in R G B
@color_table = ( "0.200 0.000 0.000","0.000 0.200 0.000","0.000 0.000 0.200" );
$opaqueness = "0.95";

#defaults read com.apple.terminal TextColors
@text_colors = split " ",`defaults read com.apple.terminal TextColors`;

# Randomly select a Color
$index = int( rand( scalar( @color_table ) ) );
@colors = split " ", @color_table[$index];

# set selected color in TextColors array
# pos 1 and 4 of TextColors = background color

$pos = 1 ;
@text_colors[$pos*3] = @colors[0];
@text_colors[$pos*3+1] = @colors[1];
@text_colors[$pos*3+2] = @colors[2];
$pos = 4 ;
@text_colors[$pos*3] = @colors[0];
@text_colors[$pos*3+1] = @colors[1];
@text_colors[$pos*3+2] = @colors[2];

# ( pos 0 and 4 of TextColors = text color
# pos 2 and 3 of TextColors = text bold color
# pos 6 of TextColors = selection color
# pos 7 of TextColors = cursor color )

# Set the new background color via the 'defaults' command
system("defaults","write","com.apple.terminal","TextColors","@text_colors");
system("defaults","write","com.apple.terminal","TerminalOpaqueness","$opaqueness");
</code>



[ Reply to This | # ]