por*_*omp 1 python curses macos colors
为此,注意到我在 Mac 上运行 python 可能会很有用xterm-color
我正在尝试用 Python 构建一个带有诅咒的国际象棋游戏,但我不知道如何设置颜色对以使用亮黑色或亮白色(这样我可以在棋盘和棋子之间获得更好的对比度。)终端显示明亮的颜色是颜色+8(所以8-15范围),但如果我尝试使用这些,我会回来init_pair() returned ERR(例如,在:)
curses.init_pair(1, 0, 15)
Run Code Online (Sandbox Code Playgroud)
我还认为使用A_BOLD和属性可能会让我在诅咒中设置明亮的颜色,但这似乎没有任何效果。例如:A_BLINK
pad.addstr(y, x, "qwert", curses.color_pair(1)|curses.A_BOLD)
Run Code Online (Sandbox Code Playgroud)
我需要做什么才能获得这些颜色?
编辑: 事实证明,我在终端中的设置错误(未选中“对粗体文本使用明亮的颜色”),但我似乎仍然没有任何方法来设置明亮的背景颜色。
\n\n\n我似乎仍然没有办法设置明亮的背景颜色。
\n
这个问题很老了,但是如果有人会寻找它的答案,你只需结合curses.A_BOLD,curses.A_REVERSE例如:
curses.init_pair(1, curses.COLOR_GREEN, curses.color_BLACK);\n// Pair with green as a foreground color and black as a background\ncurses.color_pair(1);\n// Pair with light green as a background color and black as a foreground\ncurses.color_pair(1) | curses.A_BOLD | curses.REVERSE;\nRun Code Online (Sandbox Code Playgroud)\n\n...现在你还有 2 \xc3\x97 对 :)
\n