【AI】创建 claude code cli 风格的欢迎界面
使用高级 ANSI 字体生成器Text to ANSI不要局限于 Python 自带的 pyfiglet 字体。你可以去一些专业的 ANSI Art 网站生成文本然后直接把生成的字符串复制到代码里。去 TAAG (Text to ASCII Art Generator)。尝试使用 Sub-Zero、ANSI Shadow、Cyberlarge 或 Blocks 字体claude code cli欢迎界面使用的就是ANSI Shadow字体。使用 “Test All” 功能找到最接近你想要的那种块状风格复制下来作为一个多行字符串Triple-quoted string放进 Python 代码中然后用 Rich 赋予它 #d07354 颜色。importsysfromrich.consoleimportConsolefromrich.panelimportPanelfromrich.textimportTextfromrich.alignimportAlign# # 1. 替换为你的 ASCII Art (注意保留前面的 r)# MY_AGENT_LOGOr █████╗ ██████╗ ███████╗███╗ ██╗████████╗ ██╔══██╗██╔════╝ ██╔════╝████╗ ██║╚══██╔══╝ ███████║██║ ███╗█████╗ ██╔██╗ ██║ ██║ ██╔══██║██║ ██║██╔══╝ ██║╚██╗██║ ██║ ██║ ██║╚██████╔╝███████╗██║ ╚████║ ██║ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═══╝ ╚═╝ defshow_welcome_screen():# 初始化 Rich 控制台consoleConsole()# 清空屏幕让欢迎界面更干净console.clear()# # 2. 顶部欢迎横幅 (Claude Code 风格)# welcome_textText()welcome_text.append(* Welcome to the ,styledim white)# 你可以在这里修改你的 Agent 名字welcome_text.append(My Agent,stylebold white)welcome_text.append( research preview!,styledim white)bannerPanel(welcome_text,border_style#d07354,# Claude 风格的赤陶色/黏土橙expandFalse,padding(0,1))console.print(\n)console.print(Align.center(banner))console.print(\n)# # 3. 打印核心 Logo# # 将你粘贴的 ASCII Art 赋予相同的颜色并加粗colored_logoText(MY_AGENT_LOGO,stylebold #d07354)console.print(Align.center(colored_logo))console.print(\n)# # 4. 底部登录/继续提示# footerText()footer.append( Login successful. Press ,styledim cyan)footer.append(Enter,stylebold cyan)footer.append( to continue,styledim cyan)console.print(Align.center(footer))console.print(\n)# # 5. 暂停等待用户回车# try:input()exceptKeyboardInterrupt:# 优雅处理用户按 CtrlC 退出的情况console.print(\n[dim]Exiting...[/dim])sys.exit(0)if__name____main__:# 测试运行show_welcome_screen()
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2425958.html
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!