Skip to content

Conversation

@egmontkob
Copy link
Contributor

@egmontkob egmontkob commented Jan 26, 2026

This PR contains all the color handling related changes I wanted to land.

The way it's split to commits may not be ideal, but I don't want to waste too much time on clarifying that, so I hope you'll be a bit lenient :)

@egmontkob egmontkob requested a review from zyv January 26, 2026 10:30
Copy link
Member

@zyv zyv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add the issues this resolves to the PR body.

I've tested it, and it seems to work nicely. A few comments for your consideration.

Signed-off-by: Egmont Koblinger <egmont@gmail.com>
…dling

No longer ship two different 16-color palettes.

Fix the exact color values of the 6x6x6 color cube.

Fix the tooltip values of the "colors hint" section.

Code refactored and simplified.

Signed-off-by: Egmont Koblinger <egmont@gmail.com>
Signed-off-by: Egmont Koblinger <egmont@gmail.com>
@egmontkob egmontkob force-pushed the terminal-color-improvements branch from 24661f2 to 2e3c6b9 Compare January 26, 2026 12:06
@egmontkob
Copy link
Contributor Author

I'm a little bit inconsistent with whitespaces.

I hate the current style of if(cond){, it really needs two spaces like if (cond) { in my opinion.

I tried to follow the spaceless style when touching previous files, but went with the spaces in the new mc-palette.js.

Do you have a preference? Maybe reformat the entire codebase to a nicer indentation? Follow mc's styleguide?

@zyv
Copy link
Member

zyv commented Jan 26, 2026

I'm a little bit inconsistent with whitespaces.

I hate the current style of if(cond){, it really needs two spaces like if (cond) { in my opinion.

I tried to follow the spaceless style when touching previous files, but went with the spaces in the new mc-palette.js.

Do you have a preference? Maybe reformat the entire codebase to a nicer indentation? Follow mc's styleguide?

I have a preference of either not caring about it at all, or of installing an auto-formatter and sticking with whatever it does. In terms of choosing the auto-formatter preset, I usually take the defaults as long as I can possibly tolerate them. The "default" formatter in the JavaScript world is Prettier. It can also do HTML, CSS, and JSON.

Right now, working on this repository doesn't require npm, but we could add it:

https://github.com/zyv/xyzzy.gmbh

Not necessarily a good example, but to give you an idea of what this means (check package.json and obviously ignore everything that has to do with linters).

I guess this might make sense, since I'm already doing "building" in CI for deployment.

Or we can rely purely on stuff like autofix.ci at the moment - https://prettier.io/docs/ci . Or both.

In any case, I would add this stuff separately and reformat the whole thing in one go (if we opt to do this).

@egmontkob egmontkob force-pushed the terminal-color-improvements branch from 2e3c6b9 to 4984c25 Compare January 27, 2026 14:01
- Various palettes for the first 16 colors
- Light vs. dark mode (swapping the default fg and bg colors)
- Background image (stripes, implemented by applying gray with alpha)
- Brightening the first 8 colors when bold (SGR 1 legacy confusion)

Fix the handling of the 'default' color.

Signed-off-by: Egmont Koblinger <egmont@gmail.com>
@egmontkob egmontkob force-pushed the terminal-color-improvements branch from 4984c25 to 00ef5fe Compare January 27, 2026 15:39
If a character's definition was missing, empty, or multiple characters,
it caused the screenshot to fall apart. Let's use a space in these cases.

This is still not perfect, but I don't want to duplicate and later on
maintain the list of defaults from mc.

Signed-off-by: Egmont Koblinger <egmont@gmail.com>
@egmontkob
Copy link
Contributor Author

Okay, I'm not touching the formatting. That's for a script to do at some time, not now.

Could you please take another look?

@egmontkob egmontkob merged commit a2e8f29 into MidnightCommander:master Jan 28, 2026
2 checks passed
@egmontkob egmontkob deleted the terminal-color-improvements branch January 28, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Has two different 16-color palettes Slightly off color values for the 6x6x6 cube

2 participants