[TxMt] Insert Color Revised (help needed)
Brett Terpstra
brett at circlesixdesign.com
Sat Oct 21 14:20:32 UTC 2006
Good call.
>
>> I think this needed a minor revision to make it work if there was
>> no text selected (no previous color) and you just wanted to insert
>> a color. Once again, probably not the most elegant way to handle
>> it (but it works). Let me know what you think.
>
> Why not instead simply give it a default, if string is empty?
>
> string = STDIN.read
> string = "#999" if string.empty?
> prefix, string = string.match(/(#?)(.*)/)[1,2]
> string = $1 * 2 + $2 * 2 + $3 * 2 if string =~ /^(.)(.)(.)$/
> def_col = ' default color {' + string.scan(/../).map { |i| i.hex *
> 257 }.join(",") + '}'
> ......
>
> Haris
>
>
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate
Brett Terpstra : Art Director
Circle Six Design, Inc.
111 Riverfront Dr, Suite 204
..................................................
p: 507.459.4398
877.858.4332
f: 1.866.540.3063
e: brett at circlesixdesign.com
http://www.circlesixdesign.com
..................................................
More information about the textmate
mailing list