Use the color function in the ANSI templates
authorMikael Berthe <mikael@lilotux.net>
Mon, 01 May 2017 13:06:31 +0200
changeset 52 2ffe0d622db9
parent 51 300ac09051a7
child 53 4088535c4c4c
Use the color function in the ANSI templates
templates/ansi-account.tmpl
templates/ansi-status.tmpl
--- a/templates/ansi-account.tmpl	Mon May 01 13:03:06 2017 +0200
+++ b/templates/ansi-account.tmpl	Mon May 01 13:06:31 2017 +0200
@@ -1,12 +1,12 @@
-- Account ID: {{"\x1b[31m"}}{{.id}}{{"\x1b[0m"}}  {{"\x1b[35m"}}@{{.username}}{{"\x1b[0m"}}
-  UID: {{"\x1b[31m"}}{{.acct}}{{"\x1b[0m"}}
-  Display name: {{"\x1b[1m"}}{{.display_name}}{{"\x1b[0m"}}
+- Account ID: {{color "red"}}{{.id}}{{color "reset"}}  {{color "magenta"}}@{{.username}}{{color "reset"}}
+  UID: {{color "red"}}{{.acct}}{{color "reset"}}
+  Display name: {{color "white,,bold"}}{{.display_name}}{{color "reset"}}
   Date: {{.created_at}}
-  URL: {{"\x1b[36m"}}{{.url}}{{"\x1b[0m"}}
+  URL: {{color "cyan"}}{{.url}}{{color "reset"}}
   Statuses: {{.statuses_count}}
   Followers: {{.followers_count}}
   Following: {{.following_count}}
-{{- with .note}}
-  Note: {{. | fromhtml}}{{end}}
+{{- with .note}}{{if ne . "<p></p>"}}
+  Note: {{. | fromhtml}}{{end}}{{end}}
 {{- if eq .locked true}}
   Locked: true{{end}}
--- a/templates/ansi-status.tmpl	Mon May 01 13:03:06 2017 +0200
+++ b/templates/ansi-status.tmpl	Mon May 01 13:06:31 2017 +0200
@@ -1,5 +1,5 @@
-- Status ID: {{"\x1b[31m"}}{{.id}}{{"\x1b[0m"}}  {{"\x1b[35m"}}@{{.account.acct}}{{"\x1b[0m"}}
-  Name: {{"\x1b[1m"}}{{.account.display_name}}{{"\x1b[0m"}}
+- Status ID: {{color "red"}}{{.id}}{{color "reset"}}  {{color "magenta"}}@{{.account.acct}}{{color "reset"}}
+  Name: {{color ",,bold"}}{{.account.display_name}}{{color "reset"}}
   Date: {{.created_at}}
   URL: {{.url}}
 {{- if gt .in_reply_to_id 0.0}}
@@ -7,11 +7,11 @@
 {{- with .spoiler_text}}
   Spoiler: {{.}}{{end}}
 {{- if .reblog }}{{with .reblog}}
-  {{"\x1b[1m"}}Reblogged from: {{"\x1b[34;1m"}}@{{.account.acct}}{{"\x1b[0m"}}
+  {{color ",,bold"}}Reblogged from: {{color "magenta"}}@{{.account.acct}}{{color "reset"}}
     ID: {{.id}}
-    Name: {{"\x1b[1m"}}{{.account.display_name}}{{"\x1b[0m"}}
+    Name: {{color ",,bold"}}{{.account.display_name}}{{color "reset"}}
     Date: {{.created_at}}
-    Message: {{"\x1b[34m"}}{{.content | fromhtml}}{{"\x1b[0m"}}
+    Message: {{color "blue"}}{{.content | fromhtml}}{{color "reset"}}
 {{end}}{{else}}
-  Message: {{"\x1b[34m"}}{{.content | fromhtml}}{{"\x1b[0m"}}
+  Message: {{color "blue"}}{{.content | fromhtml}}{{color "reset"}}
 {{end -}}