在纯字符界面上显示由字符组成的图形,包括Web Console,Linux Terminal。
示例: 星球大战 telnet towel.blinkenlights.nl

                                           /~\
                                          ( oo|    They've shut down
                                          _\=/_    the main reactor.
                          ___         #  /  _  \
                         / ()\        \\//|/.\|\\
                       _|_____|_       \/  \_/  ||
                      | | === | |         |\ /| ||
                      |_|  O  |_|         \_ _/   #
                       ||  O  ||          | | |
                       ||__*__||          | | |
                      |~ \___/ ~|         []|[]
                      /=\ /=\ /=\         | | |
      ________________[_]_[_]_[_]________/_]_[_\_________________________

在Web Console中输出ASCII art

/*JavaScript comment will be removed if you minify your JavaScript.*/
function helloWorld () {
/*
 _____                _          
|_   _|              (_)         
  | | _ __  ___ _ __  _ _ __ ___ 
  | || '_ \/ __| '_ \| | '__/ _ \
 _| || | | \__ \ |_) | | | |  __/
 \___/_| |_|___/ .__/|_|_|  \___|
               | |               
               |_|               
*/
}

var ascii_art = JSON.stringify(helloWorld.toString().split('\n').slice(2, -2), null, 2);

console.log(ascii_art);

/* Copy ascii_art and past to your code */

var ascii_art = [
  " _____                _          ",
  "|_   _|              (_)         ",
  "  | | _ __  ___ _ __  _ _ __ ___ ",
  "  | || '_ \\/ __| '_ \\| | '__/ _ \\",
  " _| || | | \\__ \\ |_) | | | |  __/",
  " \\___/_| |_|___/ .__/|_|_|  \\___|",
  "               | |               ",
  "               |_|               "
]

console.log(ascii_art.join('\n'));

你可以在本页打开F12调试工具查看效果。

在Linux Terminal上输出带有颜色的ASCII art
把下面的内容保存到一个名为ascii_art_source的文件

\033[30;41;5m  ___                         ______           _          _ \033[0m
\033[30;41;5m / _ \                        |  _  \         (_)        | |\033[0m
\033[30;41;5m/ /_\ \ ___ ___ ___  ___ ___  | | | |___ _ __  _  ___  __| |\033[0m
\033[30;41;5m|  _  |/ __/ __/ _ \/ __/ __| | | | / _ \ '_ \| |/ _ \/ _` |\033[0m
\033[30;41;5m| | | | (_| (_|  __/\__ \__ \ | |/ /  __/ | | | |  __/ (_| |\033[0m
\033[30;41;5m\_| |_/\___\___\___||___/___/ |___/ \___|_| |_|_|\___|\__,_|\033[0m

然后执行 echo -e "$(<ascii)" 就能看到效果。

相关网站

原文链接:https://marskid.net/2018/02/08/ascii-art/