Add support for the "blink" graphic rendition attribute #10277

Open
opened 2026-01-31 02:17:05 +00:00 by claunia · 0 comments
Owner

Originally created by @j4james on GitHub (Aug 25, 2020).

Description of the new feature/enhancement

We already parse and store the SGR 5 blink attribute, but we don't actually "render" it. This is the only remaining DEC attribute that we don't yet support, and it's widely implemented by other terminal emulators. It's probably not essential, but it can occasionally be useful, and is fun for creating simple "animations".

Proposed technical implementation details (optional)

I've been experimenting with this on the conhost side of things, and I found it could quite easily be implemented by hooking into the existing timer routine in the CursorBlinker class, triggering a redraw of the render target every cycle or two. But since we don't want that overhead if nothing is actually blinking, I have a flag that is enabled whenever a blink attribute is encountered in the renderer, and only trigger the redraw if that flag has been set. The flag is cleared before every redraw, so once the viewport is free of any blinking attributes, the redraws will stop.

As for how the blinking is actually rendered, there are two main approaches, demonstrated in the images below. On the left is what I call the "PC style", where the text actually disappears. On the right is the "DEC style" (the way I believe most DEC terminals worked), where the text is just dimmed. Looking at the two screen shots you can see the pros and cons of each approach. In the "Christmas Card", the blinking lights on the tree clearly look better when they just dim, instead of disappearing. The BBS advert, on the other hand, is completely dependent on the PC style to produce the changing text effect.

blinktest

Having grown up with BBSes, I'm kind of partial to the PC style, but looking at things practically, I do think the DEC style is better. If you actually wanted to use blink to draw attention to some text, it's way better if you can still actually read that text. That's not so easy if it's constantly turning invisible, unless you also have a high blink rate, but that can be really annoying. For general text, a slow, subtle blink effect does seem more appropriate.

That said, I don't know of any other terminal emulators that actually implement the DEC style, so if we think it's important being compatible with other terminals emulators (rather than the actual terminals), then that's a factor to consider as well.

Ideally we'd one day have different compatibility modes, so we could actually support both options, but for now I do think we need to pick one to start with. I can't make up my mind which I prefer, so I'm happy to go with whatever the general consensus is here.

Originally created by @j4james on GitHub (Aug 25, 2020). # Description of the new feature/enhancement We already parse and store the `SGR 5` blink attribute, but we don't actually "render" it. This is the only remaining DEC attribute that we don't yet support, and it's widely implemented by other terminal emulators. It's probably not essential, but it can occasionally be useful, and is fun for creating simple "animations". # Proposed technical implementation details (optional) I've been experimenting with this on the conhost side of things, and I found it could quite easily be implemented by hooking into the existing timer routine in the `CursorBlinker` class, triggering a redraw of the render target every cycle or two. But since we don't want that overhead if nothing is actually blinking, I have a flag that is enabled whenever a blink attribute is encountered in the renderer, and only trigger the redraw if that flag has been set. The flag is cleared before every redraw, so once the viewport is free of any blinking attributes, the redraws will stop. As for how the blinking is actually rendered, there are two main approaches, demonstrated in the images below. On the left is what I call the "PC style", where the text actually disappears. On the right is the "DEC style" (the way I believe most DEC terminals worked), where the text is just dimmed. Looking at the two screen shots you can see the pros and cons of each approach. In the "Christmas Card", the blinking lights on the tree clearly look better when they just dim, instead of disappearing. The BBS advert, on the other hand, is completely dependent on the PC style to produce the changing text effect. ![blinktest](https://user-images.githubusercontent.com/4181424/91108543-2766de00-e670-11ea-9d5e-35d6391a4a79.gif) Having grown up with BBSes, I'm kind of partial to the PC style, but looking at things practically, I do think the DEC style is better. If you actually wanted to use blink to draw attention to some text, it's way better if you can still actually read that text. That's not so easy if it's constantly turning invisible, unless you also have a high blink rate, but that can be really annoying. For general text, a slow, subtle blink effect does seem more appropriate. That said, I don't know of any other terminal emulators that actually implement the DEC style, so if we think it's important being compatible with other terminals emulators (rather than the actual terminals), then that's a factor to consider as well. Ideally we'd one day have different compatibility modes, so we could actually support both options, but for now I do think we need to pick one to start with. I can't make up my mind which I prefer, so I'm happy to go with whatever the general consensus is here.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#10277