Skip to content

Commit

Permalink
FEAT: Add missing docstrings and optimize with ajoin
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Mar 9, 2025
1 parent b70610b commit 69ee044
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/mezz/mezz-ansi.reb
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
Rebol [
Title: "ANSI escape sequences support"
File: %mezz-ansi.reb
Version: 1.0.0
Date: 4-Mar-2021
Version: 1.1.0
Date: 9-Mar-2025
Purpose: "Decorate any value with bright ANSI color sequences"
]

;- using 2x append to avoid making a reduced block for the output
as-gray: func[value][append append copy "^[[1;30m" value "^[[0m"]
as-red: func[value][append append copy "^[[1;31m" value "^[[0m"]
as-green: func[value][append append copy "^[[1;32m" value "^[[0m"]
as-yellow: func[value][append append copy "^[[1;33m" value "^[[0m"]
as-blue: func[value][append append copy "^[[1;34m" value "^[[0m"]
as-purple: func[value][append append copy "^[[1;35m" value "^[[0m"]
as-cyan: func[value][append append copy "^[[1;36m" value "^[[0m"]
as-white: func[value][append append copy "^[[1;37m" value "^[[0m"]
as-gray: func["Decorates a value with gray ANSI escape codes" value return: [string!]][ajoin ["^[[1;30m" value "^[[0m"]]
as-red: func["Decorates a value with red ANSI escape codes" value return: [string!]][ajoin ["^[[1;31m" value "^[[0m"]]
as-green: func["Decorates a value with green ANSI escape codes" value return: [string!]][ajoin ["^[[1;32m" value "^[[0m"]]
as-yellow: func["Decorates a value with yellow ANSI escape codes" value return: [string!]][ajoin ["^[[1;33m" value "^[[0m"]]
as-blue: func["Decorates a value with blue ANSI escape codes" value return: [string!]][ajoin ["^[[1;34m" value "^[[0m"]]
as-purple: func["Decorates a value with purple ANSI escape codes" value return: [string!]][ajoin ["^[[1;35m" value "^[[0m"]]
as-cyan: func["Decorates a value with cyan ANSI escape codes" value return: [string!]][ajoin ["^[[1;36m" value "^[[0m"]]
as-white: func["Decorates a value with white ANSI escape codes" value return: [string!]][ajoin ["^[[1;37m" value "^[[0m"]]

0 comments on commit 69ee044

Please sign in to comment.