profanity icon indicating copy to clipboard operation
profanity copied to clipboard

Improve color support

Open Markus00000 opened this issue 1 month ago • 0 comments

Is your feature request related to a problem? Please describe.

Issue 1: Incorrect colors

The 256 hard-coded colors contain errors. Gold1 is hsl(0, 100%, 50%), which is red. The website (ditig.com) these colors come from features the same incorrect HSL values. There may be more errors.

Issue 2: Fewer than 256 colors

As the source already states, “there are many duplicates.” That is, duplicate names and colors. If I’m not mistaken, color look-up is only possible by name resulting in fewer than 256 available colors.

Issue 3: Why these colors?

The source calls these colors “xterm default 256 colors.” Putting aside that fewer than 256 colors seem to be usable, running terminal-colors in xterm outputs very different colors (e.g. hue 338 instead of 37 for color 182).

The ditig.com website links to Clashes between web and X11 colors in the CSS color scheme. The short version is that there were X11 colors. Web colors were partly based on these X11 colors and got names like Gold1. Then these web colors were merged back into X11. However, ditig.com lists names of web colors like “DarkTurquoise” as #00d7d7, while the actual web color with that name is #00CED1. Maybe the web color names were matched back to the nearest X11 color and that caused multiple colors to have the same name.

Combined with potential errors, I wonder if these really are the colors profanity is looking for.

Issue 4: Conversion errors

Converting the original HEX colors to HSL introduces conversion errors. #ffd700 is hsl(50.5 100% 50%), but decimal values seem to be rarely used (or supported). hsl(51 100% 50%) is #ffd900. hsl(50 100% 50%) is #ffd500.

If other applications use #ffd700, colors might slightly differ in profanity.

Describe the solution you'd like

Mutt, cmus and other applications support addressing 256 terminal colors. Syntax varies, but color0 to color255 or just the number is common. That is in addition to addressing the first 15 colors by name. (Names which no two applications can seemingly ever agree on.)

If profanity were also able to use the 256 terminal colors, its hard-coded colors could remain for backward compatibility.

/theme colours and the user guide should explain how to use all colors.

Describe alternatives you've considered

Hard-coding the 256 colors that Xterm, Alacritty and probably other terminals use by default. Either as HEX or HSL and addressable by number. If backward compatibility is desired, in addition to the existing named colors.

Markus00000 avatar Nov 23 '25 20:11 Markus00000