这篇文章解释了 ANSI 转义码——即终端和程序用来传达颜色、光标移动和剪贴板访问等信息的序列——并综述了涵盖这些转义码的各项标准,包括 ECMA-48、xterm 控制序列和 terminfo 数据库。由于转义码只是部分标准化,它们可能不可靠,调试起来也令人沮丧,这促使一些程序放弃 terminfo,转而硬编码一套得到广泛支持的通用转义码。作者希望,一个更加清晰的标准格局——类似于 Web 标准随时间推移不断改进的过程——最终能让终端功能更加可靠、更易于采用。
Hello! Today I want to talk about ANSI escape codes.
For a long time I was vaguely aware of ANSI escape codes (“that’s how you make
text red in the terminal and stuff”) but I had no real understanding of where they were
supposed to be defined or whether or not there were standards for them. I just
had a kind of vague “there be dragons” feeling around them. While learning
about the terminal this year, I’ve learned that:
ANSI escape codes are responsible for a lot of usability improvements
in the terminal (did you know there’s a way to copy to your system clipboard
when SSHed into a remote machine?? It’s an escape code called OSC 52!)
继续阅读全文
为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。
AI 摘要The author repaired their decade-old rechargeable bike lights, which only held a charge for about 5 minutes, by replacing the lithium coin cell batteries (identified as LIR2477 with the help of an LLM). Following a desoldering guide and friends' advice, they removed the old batteries at a local queer makerspace, ordered replacements and silicone glue from AliExpress, soldered in the new batteries, and glued the lights back together. The repair succeeded—the lights now work for nighttime biking—and cost about $20 CAD total, which the author found rewarding despite having minimal electronics experience.
AI 摘要The author describes learning to build backend-rendered websites with Django in a '2010 style' after years of frontend-heavy approaches, and highlights features they enjoy like query builders, template filters (especially `querystring`), and automatic database migrations. They dislike organizing views with inheritance, preferring function-based code instead, and are still figuring out how to reason about Django performance—notably discovering they had accidentally disabled the cached template loader, whose re-enablement significantly improved the site's request throughput.
AI 摘要The author shares lessons learned from using SQLite as the database for a Django site, including how running ANALYZE dramatically sped up a slow full-text search query and how long-running cleanup DELETEs can cause other workers to time out and crash since SQLite allows only one writer at a time. They also describe their backup approaches using restic and Litestream, along with tricks like splitting tables across multiple database files. Despite these challenges, they find SQLite works well for small sites, though the experience has given them more appreciation for databases like Postgres.
AI 摘要The author describes migrating several of their small sites from Tailwind CSS to semantic HTML with vanilla CSS, explaining how Tailwind had taught them useful systems (resets, color palettes, font scales, utility classes) that they adapted while restructuring their CSS around components, base styles, spacing conventions, flexible grid layouts, and esbuild. They cite reasons for leaving Tailwind, including its growing reliance on build systems, their own improved CSS skills, Tailwind's limitations for unusual designs, and the pain of maintaining mixed codebases. Finally, they reflect on learning to respect CSS as a genuinely hard and powerful technology rather than devaluing it, and mention modern features like @layer, @scope, container queries, and subgrid that they hope to explore.
AI 摘要After deciding to stop using Tailwind CSS for new projects, the author missed its convenient color palette and asked on Mastodon for alternatives. This post compiles links to their favorite palettes (such as uchū, flexoki, and reasonable colours) as well as other palettes, color palette generators, and color tools like colorhexa and oklch resources.