TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Graphic with escape codes for 256-color terminals (for colorful shell prompts)

2 点作者 timoteostewart大约 3 年前

2 条评论

timoteostewart大约 3 年前
The graphic is a screenshot of the output of the script below. If you run this script in a terminal, then you can copy the escape sequence you want to use and paste it wherever needed.<p><pre><code> #!&#x2F;bin&#x2F;bash for fgbg in 38 48 ; do for color in {0..255} ; do if (( $color &lt; 256 )) ; then padding=&quot;&quot; fi if (( $color &lt; 100 )) ; then padding=&quot; &quot; fi if (( $color &lt; 10 )) ; then padding=&quot; &quot; fi printf &quot;\e[${fgbg};5;%sm \\\\e[${fgbg};5;%sm${padding} \e[0m&quot; $color $color if [ $((($color + 1) % 6)) == 4 ] ; then echo &quot;&quot; fi done echo &quot;&quot; done exit 0</code></pre>
ChrisGranger大约 3 年前
This works like a charm. Thank you for sharing it.