如何使用ANSI转义序列设置棕色?

编程入门 行业动态 更新时间:2024-10-14 20:26:23
本文介绍了如何使用ANSI转义序列设置棕色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我可以仅使用序列Esc[Value,Valuem设置背景的棕色吗? (不仅是黑色,红色,绿色,黄色,蓝色,洋红色,青色,白色……我想使用更多颜色).

Can I use only the sequence Esc[Value,Valuem to set the brown color of background? (not only Black, Red, Green, Yellow, Blue, Magenta, Cyan, White... I want use more colors).

如何轻松实施?我想在启动代码中实现它,所以我没有机会使用标准库.

How to implement it easily? I want to implement it in my boot code, so I haven't the opportunity to use standard libraries.

我应该使用哪个参数?

Which parameters should I use?

推荐答案

ANSI仅定义了8种颜色.没有一个是 brown (尽管有些人称非明亮的黄色"为棕色",例如).

ANSI defined only 8 colors. None are brown (though some people call the non-bright "yellow" a "brown", e.g., Yellow appears as brown in konsole).

如果要在Linux 引导代码中使用不同的颜色,则可以使用Linux控制台调色板转义序列来更改控制台调色板中的一项.参考 console_codes(4)手册页:

If you want to use different colors in your Linux boot code, you could use the Linux console color palette escape sequence to alter one of the entries in the console's palette. Referring to console_codes(4) manual page:

ESC ] OSC (Should be: Operating system command) ESC ] P nrrggbb: set palette, with parameter given in 7 hexadecimal digits after the final P :-(. Here n is the color (0-15), and rrggbb indicates the red/green/blue values (0-255). ESC ] R: reset palette

有人使用此功能编写了程序(或脚本),例如 setcolors- .

Some people have written programs (or scripts) using this feature, e.g., setcolors - Change your Linux VT color palette (at boot time too!).

要在终端仿真器中更改颜色,例如,在启动并登录到桌面后,这些其他终端可能具有用于在其调色板中设置条目的控制序列.

To alter colors in terminal emulators, e.g., after booting and logging into your desktop, these other terminals may have control sequences for setting entries in their color palettes.

更多推荐

如何使用ANSI转义序列设置棕色?

本文发布于:2023-10-08 15:09:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1472991.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:棕色   如何使用   序列   ANSI

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!