Is it better to use [30m colors or [90m colors?

I’ve specifically avoided that for the moment, because the debugger color implementation is (intentionally) very simple. The current version taps into the Z-machine color implementation, which only supports ten basic colors (those eight, “default”, and “current”), so those ten are the only values of color and background-color that the frontend recognizes. Handling any more would mean building a separate implementation for the debugger, and at that point we might as well just handle full 24-bit #ff0088 color instead of faffing around with names.

That said, the Z-machine does recognize a few grays in its “named color” system, so those could be added. But the spec tags them as “Z6 only” so I’m not sure whether interpreters handle them in Z5 and Z8.

My goal, implementation-wise, has been to keep the debugger style system as simple as possible; terminals will never be able to do especially nice typography, so the main purpose is to make sure your Z-machine implementation works properly. If someone else wants to extend it to do 24-bit color, though, by all means feel free; you’d just want to increase the 8-bit divfg and divbg variables in eval.h to be 32-bit, and rewrite eval_color.

1 Like

Here’s how dim versus bright green looks:

Having had a look, the bright colors are working best for me over a black background. Which is probably not surprising!

Do these colors have hex or rgb values? I could check the contrasts

1 Like

Sadly no standard ones. Each terminal does whatever it wants. Wikipedia lists a bunch of examples; of those, “Terminal.app”, “xterm”, and “Ubuntu” are the most relevant ones. (On Windows, the debugger uses Windows Glk instead of the terminal, so it uses an entirely separate set of colors. Because this wasn’t complicated enough already!)

If we can come up with a set of RGB codes that work for everyone, I can just make the debugger specify exactly which colors it wants instead of leaving it up to the terminal; I might default to these ones Dannii posted above, since I don’t trust my own judgements on individual colors.

Otherwise, we’ll have to deal with the vagaries of the terminal. But I would like the simple names “red” and “green” to pick sensible defaults of some sort, that will work for as many people as possible.

2 Likes

I had a little time :slight_smile:

Accessibility-wise, it’s a wash.

When using the dim colors over both black and white screens, the average ACPA contrast is 55.7

With the bright colors, the average ACPA contrast is 56.1

I used terminal.app for comparison

Terminal.app - dim colors Average contrast = 55.7
Background Color Name RGB Contrast Value
Bright White Black 0,0,0 106.4
Bright White Red 153,0,0 87.84
Bright White Green 0,166,0 58.95
Bright White Yellow 153,153,0 56.99
Bright White Blue 0,0,178 95.71
Bright White Magenta 178,0,178 77.22
Bright White Cyan 0,166,178 55.48
Black (0,0,0) White 191,191,191 68.5
Black (0,0,0) Red 153,0,0 14.31
Black (0,0,0) Green 0,166,0 42.78
Black (0,0,0) Yellow 153,153,0 44.78
Black (0,0,0) Blue 0,0,178 0
Black (0,0,0) Magenta 178,0,178 24.54
Black (0,0,0) Cyan 0,166,178 46.32
Terminal.app - bright colors Averagecontrast = 56.1
Bright White Bright Black (Gray) 102, 102, 102 78.75
Bright White Bright Red 230, 0, 0 70.33
Bright White Bright Green 0, 217, 0 35.78
Bright White Bright Yellow 230, 230, 0 16.44
Bright White Bright Blue 0, 0, 255 85.82
Bright White Bright Magenta 230, 0, 230 62.91
Bright White Bright Cyan 0, 230, 230 24.92
Black (0,0,0) Bright Red 230, 0, 0 31.34
Black (0,0,0) Bright Green 0, 217, 0 66.73
Black (0,0,0) Bright Yellow 230, 230, 0 87.23
Black (0,0,0) Bright Blue 0, 0, 255 16.23
Black (0,0,0) Bright Magenta 230, 0, 230 38.77
Black (0,0,0) Bright Cyan 0, 230, 230 78.19
Black (0,0,0) Bright White 230, 230, 230 91.66

2 Likes

Both sets of these ANSI colors have very high saturation (because the difference between maximum and minimum of Red, Green and Blue is high).

I prefer less saturation on both White/Light and Black/Dark backgrounds. They should also look more pleasant to the user.

To do this just set the 0 value component to higher, but much below than the other components.

1 Like

This is one decision that I really shouldn’t be making, because with my bad color vision, I tend to crank the contrast up to maximum and use combinations that are garish to anyone else. I personally would default to colors that are all 0’s and 255’s, and I imagine people with good color vision would not enjoy that.

So—if this thread can come to a consensus on a good set of eight RGB codes, just tell me, and I’ll implement those. Otherwise, I’ll switch to the dim colors (like Git uses). As a starting point, I believe the ones Dannii posted should be:

#000000 // black
#ef0000 // red
#00d000 // green
#efef00 // yellow
#006fb0 // blue
#ff00ff // magenta
#00efef // cyan
#ffffff // white

These are the ones the debugger currently uses in Windows Glk; they’re taken from the Z-machine spec (except with the low three bits set equal to the fourth, because the spec only covers the top five bits). If this thread comes up with a better color scheme, I’ll update the Windows version to match.

(By a “good” set of eight RGB codes I mean that all eight are clearly distinct and not hard to read against both a dark and light background, except black doesn’t have to be readable on a dark background and white doesn’t have to be readable on a light background.)

@RobertSzacki
I took your advice and came up with this scheme that tries to honour the colour labels. I’m a big fan of hue shifting so my red preference has a bit of magenta in it, etc… but that would be insanity to command line purists so I held back. :wink:

Your suggestion of avoiding 0s was spot on.

Anyway, just stirring the pot here. :smile:

Edit: Just a slight hue shift example comparison. I notice the red being just a bit more legible because of it. Maybe, I’m splitting hairs.

NOTE: I think the one I did in the FOLLOWING REPLY below is the superior one now.

1 Like

Those are very readable, but the yellow on white looks gold, not yellow.

1 Like

You’re so cute when you get literal, Mike. :smile:

Let me see if I can find a yellow that’s readable against a white background… be right back. :wink:

Edit: This is about as yellow as I feel comfortable with on white. But I used to be a jewellery designer and goldsmith, so maybe I just lean towards gold. It looks more 10K than 18K now. :wink:

Second Edit: Just tweaked the cyan a bit to feel lighter on the white. Mike’s got me all self conscious now. :smile:

2 Likes

Lots of people tell me my color sense is weird. I call things green that other people say are yellow and vice versa. Pure colors are fine, but anything in between…not so much.

1 Like

These look great! But unfortunately, the debugger has no way to know whether the user has a light or dark background color. It’s okay if a few combinations (like white on light background) are illegible, but as many as possible should be legible against whichever background the user has.

(On Linux and Mac, the debugger basically only has access to ioctl and ANSI escape codes. Its ability to figure out anything beyond ioctl is almost nonexistent. On Windows, I believe Windows Glk always defaults to a white background.)

2 Likes

Yes, some colors may look almost invisible on white background, like Yellow, light Orange or Pink, Light Green. But well - we can change the Saturation and Brightness (Value) as well.

The same goes for Black, but now they are Brown, Deep Blue or Violet.

I just like less saturation. Like I showed on my C syntax colors, it’s possible to achieve good, pleasant color-set. Yellow in 100% saturation can be difficult to use in text-editor, for obvious reason.

1 Like

This is a stab at matched colours across black and white backgrounds. It’s not ideal, but maybe it’s acceptable.

I’ll see if I find another strategy. I love obsessing over stupid shit! :wink:

2 Likes

Your red, green, magenta, and yellow all look great. The blue and cyan don’t look quite blue and cyan enough to me, especially on black. (Though I am slightly colourblind myself…)

Black and white should use the basic ANSI colours so they use whatever the theme has. That would work wouldn’t it?

I appreciate the yellow being more orange, because it means I can tell it apart from the green.

Hmm.. Blue in that picture is the most beautiful shade of Blue in my opinion. Cyan is OK as well with this saturation.

I suggest just slightly more Value on Dark and slightly less Value on Light theme.

As of colors I like the Computer colors from Commodore 64 on. There was nice set of 16 colors, very well chosen.

1 Like

I was looking on my computer before, now I’m on my phone, and the blue looks like blue here! The cyan on black still looks grey to me though.

Colours are tricky.

1 Like

Replying to myself because I’m a rebel.

This is pretty much where my brain stops with tweaking colours based on my laptop display and my photoreceptors. Slight tweaks all around. To give both sides a fair shake, you have to focus on one side for several seconds. Then you’ll notice your brain takes over and the colours become more distinct. Going back and forth between the two makes both feel muddy and washed out.

Well, if you use it or not, I had fun experimenting with this. :slight_smile:

1 Like

Here’s practical Color set used by me.

It contains almost full ANSI set, maybe except Magenta and Red, which are “hot” colors.

Note that I like to use slightly saturated background.