Possible node interfering with console color?
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 122k
- フォーク
- 37.3k
- 平均マージ
- 4日 2時間
- マージ済み PR(30日)
- 283
説明
There's a whole lot of things I don't understand here, so please let me apologize in advance for this ticket as a shambles.
Initially I was trying to work with a high quality console color library, and I was confounded because I had just switched to the modern Win10 console, with its 24 bit color support, and it wasn't 24 bit coloring. It's a big library by a big programmer, so I was surprised.
So I thought "it's just ansi codes, I'll do it myself," and tried to do it myself. Worked them out in console printf, looked good, node -e, and ... and ... wha?

The same string in the same console was working with printf and not with node -e console.log. The latter was getting downgraded to a different color range.
Okay, node must just not know it's 2-- wha?

So I tried using the FORCE_COLOR flag as a leader. No.

So I tried using it as an envvar. No.

So I switched to process.stdout. No.

And then I looked up my TERM setting. xterm-color-256. Initially I thought "aha!", except then I realized that's not the color you'd get from my testcase in a 6-cube.
Oh, dear. Am I in ... am I in 4-bit color in node, despite having a 24-bit terminal?
Wrote this to find out
const seq = n => new Array(n).fill(false).map( (_, i) => i );
const col = (r,g,b) => 16 + b + (g*6) + (r*36);
seq(6).map(b => {
seq(6).map(g => {
seq(6).map(r => process.stdout.write(`\x1b[38;5;${col(r,g,b)}m*`) );
process.stdout.write(' '); });
process.stdout.write('\n'); });
Yep.

Gulp.
Am I missing something? It seems like my terminal is set up for 24 bit, and node is manually downsampling my terminal output for me despite FORCE_COLOR. It couldn't be doing that, could it? That wouldn't make any sense.
What exists between node and the console which could be doing this?
So I thought I'd be tricky and see if some other language on the machine would get it right, yeah?
Tried python. ... lol

So then, yes, there is something between the language and the console, which is capable of screwing ansi codes up.
How do I find what that something is for node, so that I can find what's misconfigured in it, please?
Thanks
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、最新の Windows 10 コンソールで node -e console.log、process.stdout、FORCE_COLOR、および提供されている ANSI カラーループを使って動作を再現します。Node の出力を printf および Python と比較し、その後、ANSI シーケンスを変更しているのが Node なのか、それとも外部のコンソール層なのかを特定します; 担当するコンポーネントと設定を特定できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, node.js
- 領域
- cli
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 35/100