Whiptail은 배경색을 자홍색에서 동적으로 변경합니까?

Whiptail은 배경색을 자홍색에서 동적으로 변경합니까?

Whiptail의 배경색을 즉석에서 어떻게 변경합니까? 예를 들어 빨간색, 녹색 또는 노란색, 파란색 솔기는 색상이 부족한 것입니다. 나는 확인했다Newt 앱에서 보라색 배경색을 제거하는 방법은 무엇입니까?정말 시스템을 깨뜨립니다. 영구적인 파란색을 원한다면 괜찮습니다.

예를 들어 Ubuntu를 설치할 때 일치하는 비밀번호를 얻지 못하면 배경색이 변경되므로 수행할 수 있다는 것을 알고 있습니다. Whiptail 매뉴얼 중 어느 것도 방법을 논의하지 않습니다.

이것이 기반이기 때문에 뉴트를 다루는 것을 알고 있지만 거기에서도 방법을 알려주지 않습니다.

답변1

색상 정의가 포함된 파일에 대한 경로를 제공하여 컴파일 시 휩테일의 내부 색상 팔레트를 덮어쓸 수 있습니다.

우분투에서는 sudo update-alternatives --config newt-palette우분투 팔레트와 원본 팔레트 중에서 선택하는 방법을 제공합니다.

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

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

빨간색 창 배경의 메시지 상자를 표시하는 예:

#!/bin/sh

NEWT_COLORS='
  window=,red
  border=white,red
  textbox=white,red
  button=black,white
' \
whiptail --msgbox "passwords don't match" 0 0

우분투 색상에 추가:

#!/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

관련 정보