Example:
Is it possible to create such lines and the two little things as the image shows? If so, how can I do this?
Example:
Is it possible to create such lines and the two little things as the image shows? If so, how can I do this?
Yes, it's possible to build an image, with use of external tools (bash has no built-in graphics APIs). As examples, you could:
.png
, etc).-draw
argument to the convert
command).If, by contrast, you want to render that image to the terminal, you can use your terminal font's available line-drawing characters and color support, but will not have the same level of detailed control (ability to select fonts, select pixel-specific locations, etc).
Look at the list of characters in http://en.wikipedia.org/wiki/Box-drawing_character
If your user supports a Unicode-aware terminal, then, you could do something like:
printf '\u2500\u252c\u2500\nf%sO%so\n\u2500\u2534\u2500\n' \
"$(tput setf red)" "$(tput setf black)"
The \u2500
s get replaced with horizontal bars, the \u252c
with a horizontal bar with a tee pointing down, the \u2534
with a horizontal bar with a tee pointing up, etc.
The %s
s get replaced with corresponding arguments -- "$(tput setf red)"
to make the foreground text red (or no character at all, if the current terminal doesn't support color), the "$(tput setf black)"
... well, does the obvious thing.