logoalt Hacker News

ryandraketoday at 1:18 PM2 repliesview on HN

It would be much better if application developers (and web developers, too) -only- had access to semantic color labels like TEXT, BACKGROUND, ERROR, WARNING, INFO, HIGHLIGHT, and so on, rather than red, yellow, blue, green, black.

I don’t want my applications to decide “this element must be red text on green background.” I want my applications to annotate the UI with things like “warning message” and “title.”


Replies

kpstoday at 2:37 PM

That could be done with a few influential terminal emulators adopting a consensus extension to ISO8613-6, like this: ESC[38:99:‹purpose›m for foreground, ESC[48:99:‹purpose›m for background.

e.g.

    Foreground     Background    Purpose
    -----------    -----------   -------
    ESC[38:99:0m    ESC[48:99:0m   normal ( same as ESC[39m and ESC[49m )
    ESC[38:99:1m    ESC[48:99:1m   emphasise
    ESC[38:99:2m    ESC[48:99:2m   de-emphasise
    ESC[38:99:3m    ESC[48:99:3m   error
    ESC[38:99:4m    ESC[48:99:4m   warning
    ESC[38:99:5m    ESC[48:99:5m   caution
    ESC[38:99:6m    ESC[48:99:6m   notice
Then people (themes) could easily choose foreground colour or background highlighting for particular roles. Some terminal emulators might also choose to configure other stylistic choices like bold, italic, etc.

(I believe ISO8613-6 defines sub-modes 0 through 5 (te;db), with 2 (rgb) and 5 (256-color indexed) being most widely implemented. But some terminals historically mess up : and ; in CSI sequences, and I know at least one would interpret ESC[38:6:1m as ESC[6;1m (blinking bold!), so here I pick 99 (ECMA-48 defines modes up to 65).)

show 1 reply
johncoltranetoday at 1:23 PM

I would really love to have that, too, on every "platform" I have to work on.