トップ回答者
PowerShell の配色を変えるには?

質問
-
文字と背景が同色になっているため、文字が読めなくなっています。
PowerShell で読めない文字の配色を変えるにはどうしたら良いのでしょうか?
PowerShell 上でコマンドを実行させると、その出力が表示されるのですが、文字の色と背景色が同じのようで、下記画像のように文字が読めなくなります。
四角で囲んだ部分には文字が在るのですが、見えません。
改めて四角の領域の文字をコピーすると以下のようになっています。
-------------------------------------
Local: http://localhost:9000
External: http://192.168.56.1:9000
-------------------------------------
UI: http://localhost:3001
UI External: http://192.168.56.1:3001
-------------------------------------
見えてない部分の文字色を変えるにはどうしたら良いのでしょうか?
検索してざっと目を通したのは以下の情報です。
--
Gulp output on Windows CMD is unreadable
stackoverflow
https://goo.gl/eitb6B
Respect console's color settings (on Powershell on windows) #2381
GitHub
https://goo.gl/5Y0rPn
How to Change PowerShell Console Font and Background Colors
Petri IT Knowledgebase
https://goo.gl/t4kcz9
Windows PowerShell Monokai Console Color Scheme
GitHub
https://goo.gl/kzqCNO
Solarized - Command Prompt theme
GitHub
https://goo.gl/96qvpI
List of all colors available for powershell?
stackoverflow
https://goo.gl/W346dU
Powershell: Properly coloring Get-Childitem output once and for all
stackoverflow
https://goo.gl/3seBz3
Windows PowerShell Tip of the Week
TechNet Library
https://goo.gl/0fOLZ0
Gary's $this and that about PowerShell
Microsoft TechNet
https://goo.gl/hpIHkV
PowerShell Basics: Console Configuration
WindowsITPro.com
https://goo.gl/Kqa4nQ
- 編集済み custar 2016年10月29日 2:48
回答
-
魔界の仮面弁士さん、情報ありがとうございます。
以下のような設定方法は、前記検索結果の中でも出ていたので試しはしましたが、ずばり見えない部分のみを指定する方法が分からなかったので、採用しませんでした。
$Host.UI.RawUI.ForegroundColor = 'White'
背景色:紺の powershell 上で magenta を表示しようとすると見えなくなるようです。
ソースを読んでみると、以下のように記述されていました。
(1) の部分に "magenta" がベタで指定されています。
node_modules/browser-sync/lib/logger.js
logger.unprefixed("info", " %s: {magenta:%s}", ....................... (1) getPadding(key.length, longestName + offset) + keyname, urls[key] );
この情報を元に調べてみると、同じ問題が挙がっています。
--
Magenta gulp log entries invisible in Powershell #25 ............... (2)
screepers/screeps-typescript-starter
github
https://goo.gl/kF9gu4
Yellow and Magenta do not display in powershell #2
chalk/chalk
github
https://goo.gl/j500Gd
gulp-print in Powershell is empty .................................. (3)
stackoverflow
https://goo.gl/wLEXhe
(2) によると .gulprc という設定ファイルで色を変更できるようになるかも、と言われています。
Allow customizing CLI colors through .gulprc file #63
gulpjs/gulp-cli
github
https://goo.gl/AYY3tM
暫くは (3) で提案されてる "gulp --no-colors" で済ませておこうと思います。
- 編集済み custar 2016年10月29日 7:13
- 回答の候補に設定 miyamamMicrosoft employee 2016年11月6日 3:26
- 回答としてマーク 牟田口大介Moderator 2016年12月14日 0:13
すべての返信
-
色の変更は、PowerShell コンソール左上の [>_]アイコンをクリックして
プロパティとして調整するか、もしくは下記のようなスクリプトで変更できます。How can I set the PowerShell console background color (not the text background color)?
ただし、出力するスクリプト側で意図的に文字色が指定されていたものについては、
実行するスクリプト自体を修正するしかないと思います。一時的なものであれば、文字色ではなく、背景色を変更してみてはいかがでしょうか。
背景色を意図的に変えることはあまり多くないと思うので。 -
魔界の仮面弁士さん、情報ありがとうございます。
以下のような設定方法は、前記検索結果の中でも出ていたので試しはしましたが、ずばり見えない部分のみを指定する方法が分からなかったので、採用しませんでした。
$Host.UI.RawUI.ForegroundColor = 'White'
背景色:紺の powershell 上で magenta を表示しようとすると見えなくなるようです。
ソースを読んでみると、以下のように記述されていました。
(1) の部分に "magenta" がベタで指定されています。
node_modules/browser-sync/lib/logger.js
logger.unprefixed("info", " %s: {magenta:%s}", ....................... (1) getPadding(key.length, longestName + offset) + keyname, urls[key] );
この情報を元に調べてみると、同じ問題が挙がっています。
--
Magenta gulp log entries invisible in Powershell #25 ............... (2)
screepers/screeps-typescript-starter
github
https://goo.gl/kF9gu4
Yellow and Magenta do not display in powershell #2
chalk/chalk
github
https://goo.gl/j500Gd
gulp-print in Powershell is empty .................................. (3)
stackoverflow
https://goo.gl/wLEXhe
(2) によると .gulprc という設定ファイルで色を変更できるようになるかも、と言われています。
Allow customizing CLI colors through .gulprc file #63
gulpjs/gulp-cli
github
https://goo.gl/AYY3tM
暫くは (3) で提案されてる "gulp --no-colors" で済ませておこうと思います。
- 編集済み custar 2016年10月29日 7:13
- 回答の候補に設定 miyamamMicrosoft employee 2016年11月6日 3:26
- 回答としてマーク 牟田口大介Moderator 2016年12月14日 0:13