From d9550ac58d31c4f5253e47c2faf385fd60f2f4ac Mon Sep 17 00:00:00 2001 From: Thomas Jensen Date: Tue, 24 Oct 2023 21:43:00 +0200 Subject: [PATCH] Add new box designs 'info', 'warning', and 'critical' which take advantage of coloring and unicode --- boxes-config | 150 ++++++++++++++++++++++- test/184_create_box_colored_contents.txt | 15 +++ test/185_remove_box_uncolor_contents.txt | 15 +++ 3 files changed, 179 insertions(+), 1 deletion(-) create mode 100644 test/184_create_box_colored_contents.txt create mode 100644 test/185_remove_box_uncolor_contents.txt diff --git a/boxes-config b/boxes-config index 444c38e..c93b0d1 100644 --- a/boxes-config +++ b/boxes-config @@ -12,7 +12,7 @@ # # ___________________________________________________________________________________________________________________ # -# Format: ASCII Text +# Character Encoding: UTF-8 # Syntax of this file: https://boxes.thomasjensen.com/config-syntax.html # #==================================================================================================================== @@ -3179,4 +3179,152 @@ END tux # ============================================================================ +BOX info + +author "Thomas Jensen" +designer "Thomas Jensen" +revision "1.0" +created "2023-10-24" +tags "box, color, simple, unicode" + +sample + ▄▄ INFO ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ + █ █ + █ This is an informational message. █ + █ Don't worry about it. █ + █ █ + ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ +ends + +# Monochrome sample: +# ▄▄ INFO ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ +# █ █ +# █ This is an informational message. █ +# █ Don't worry about it. █ +# █ █ +# ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ + +shapes { + nw ("▄") + nnw ("▄ INFO ") + n ("▄") + ne ("▄") + w ("█") + e ("█") + sw ("▀") + s ("▀") + se ("▀") +} + +elastic (n, s, e, w) + +padding { + horizontal 2 + vertical 1 +} + +END info + + +# ============================================================================ + + +BOX warning + +author "Thomas Jensen" +designer "Thomas Jensen" +revision "1.0" +created "2023-10-24" +tags "box, color, simple, unicode" + +sample + ▄▄ WARNING ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ + █ █ + █ Sub-zero temperatures expected. █ + █ Please drive carefully. █ + █ █ + ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ +ends + +# Monochrome sample: +# ▄▄ WARNING ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ +# █ █ +# █ Sub-zero temperatures expected. █ +# █ Please drive carefully. █ +# █ █ +# ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ + +shapes { + nw ("▄") + nnw ("▄ WARNING ") + n ("▄") + ne ("▄") + w ("█") + e ("█") + sw ("▀") + s ("▀") + se ("▀") +} + +elastic (n, s, e, w) + +padding { + horizontal 2 + vertical 1 +} + +END warning + + +# ============================================================================ + + +BOX critical + +author "Thomas Jensen" +designer "Thomas Jensen" +revision "1.0" +created "2023-10-24" +tags "box, color, simple, unicode" + +sample + ▄▄ CRITICAL ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ + █ █ + █ Coolant levels below minimum. █ + █ Disengage main drive and stop for repairs. █ + █ █ + ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ +ends + +# Monochrome sample: +# ▄▄ CRITICAL ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ +# █ █ +# █ Coolant levels below minimum. █ +# █ Disengage main drive and stop for repairs. █ +# █ █ +# ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ + +shapes { + nw ("▄") + nnw ("▄ CRITICAL ") + n ("▄") + ne ("▄") + w ("█") + e ("█") + sw ("▀") + s ("▀") + se ("▀") +} + +elastic (n, s, e, w) + +padding { + horizontal 2 + vertical 1 +} + +END critical + + + #EOF vim: set ai sw=4 expandtab syn=boxes: diff --git a/test/184_create_box_colored_contents.txt b/test/184_create_box_colored_contents.txt new file mode 100644 index 0000000..b832a75 --- /dev/null +++ b/test/184_create_box_colored_contents.txt @@ -0,0 +1,15 @@ +:DESC +Creates a unicode box which also colors its contents. + +:ARGS +-d critical -i box +:INPUT + Aaargh, let go of me! +:OUTPUT-FILTER +:EXPECTED + ▄▄ CRITICAL ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ + █ █ + █ Aaargh, let go of me! █ + █ █ + ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ +:EOF diff --git a/test/185_remove_box_uncolor_contents.txt b/test/185_remove_box_uncolor_contents.txt new file mode 100644 index 0000000..b7c9968 --- /dev/null +++ b/test/185_remove_box_uncolor_contents.txt @@ -0,0 +1,15 @@ +:DESC +Removes a unicode box which had colored its contents, restoring the original monochrome text. + +:ARGS +-r +:INPUT + ▄▄ CRITICAL ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ + █ █ + █ Aaargh, let go of me! █ + █ █ + ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ +:OUTPUT-FILTER +:EXPECTED + Aaargh, let go of me! +:EOF