;;; colors.tf from tinyfugue mailing list, David Moore ;;; syntax: /colors /def colors =\ /let colors=black white red magenta yellow green cyan blue%;\ /let fg_colors=%{colors}%;\ /let bg_colors=%{colors}%;\ /let other_attr=%{1}%;\ /colors_ %{fg_colors} /def colors_ =\ /colors__ normal %{other_attr-n} %{bg_colors}%;\ /while ({#}) \ /colors__ %{1} %{other_attr}C%{1} %{bg_colors}%;\ /shift%;\ /done /def colors__ =\ /let title=%;\ /test title := colors_center({1},7)%;\ /let fg=@{%{2}}%;\ /shift 2%;\ /let field=%;\ /let result=%;\ /while ({#}) \ /let bg=@{Cbg%{1}}%;\ /test result := strcat(result, " ", fg, bg, title, "@{n}")%;\ /let result=%{result} %{field}%;\ /shift%;\ /done%;\ /echo -p -- % %{fg}%{title}@{n} %{result} /def colors_center =\ /let info=%;\ /let width=%;\ /let len=%;\ /test info := {1}, width := {2}, len := strlen(info)%;\ /test pad(pad(info, len + (width-len)/2), -width)