Whiptail 从洋红色动态更改背景颜色?

Eri*_*ric 3 colors themes color-management software-installation

如何快速更改 Whiptail 的背景颜色。例如红色、绿色或黄色,蓝色接缝为缺色。我检查了如何摆脱 newt 应用程序中的紫色背景色?这真的打破了系统。如果你想要永久的蓝色它是可以的。

我知道这可以在您安装 Ubuntu 时完成,例如,当您没有获得匹配的密码时,它们会更改背景颜色。Whiptail 的手册中没有讨论如何操作。

我确实知道它处理蝾螈,因为这是它的基础,但即使在那里他们也不告诉你如何。

小智 6

通过提供包含颜色定义的文件的路径,可以在编译时覆盖whiptail 的内部调色板。

在 ubuntu 中sudo update-alternatives --config newt-palette提供了一种在 ubuntu 调色板和原始调色板之间进行选择的方法。

可以通过将 设置NEWT_COLORS_FILE为指向替代文件来覆盖此文件的位置。

此外,可以通过设置NEWT_COLORS环境变量来覆盖之前的两个覆盖。

定义的结构是:

name=[fg],[bg][;|:|\n|\r|\t]name2=[fg],[bg]]...

name 可:

root                  root fg, bg
border                border fg, bg
window                window fg, bg
shadow                shadow fg, bg
title                 title fg, bg
button                button fg, bg
actbutton             active button fg, bg
checkbox              checkbox fg, bg
actcheckbox           active checkbox fg, bg
entry                 entry box fg, bg
label                 label fg, bg
listbox               listbox fg, bg
actlistbox            active listbox fg, bg
textbox               textbox fg, bg
acttextbox            active textbox fg, bg
helpline              help line
roottext              root text
emptyscale            scale full
fullscale             scale empty
disentry              disabled entry fg, bg
compactbutton         compact button fg, bg
actsellistbox         active & sel listbox
sellistbox            selected listbox
Run Code Online (Sandbox Code Playgroud)

bg并且fg可以是:

color0  or black
color1  or red
color2  or green
color3  or brown
color4  or blue
color5  or magenta
color6  or cyan
color7  or lightgray
color8  or gray
color9  or brightred
color10 or brightgreen
color11 or yellow
color12 or brightblue
color13 or brightmagenta
color14 or brightcyan
color15 or white
Run Code Online (Sandbox Code Playgroud)

显示带有红色窗口背景的消息框的示例:

#!/bin/sh

NEWT_COLORS='
  window=,red
  border=white,red
  textbox=white,red
  button=black,white
' \
whiptail --msgbox "passwords don't match" 0 0
Run Code Online (Sandbox Code Playgroud)

附加到 ubuntu 颜色:

#!/bin/bash

readarray -t newtcols < /etc/newt/palette

newtcols_error=(
   window=,red
   border=white,red
   textbox=white,red
   button=black,white
)

NEWT_COLORS="${newtcols[@]} ${newtcols_error[@]}" \
whiptail --msgbox "passwords don't match" 0 0
Run Code Online (Sandbox Code Playgroud)