[GH-ISSUE #420] Feature request: turn off a specific attribute using color tags #309

Closed
opened 2026-03-04 01:03:49 +03:00 by kerem · 5 comments
Owner

Originally created by @gnojus on GitHub (Mar 26, 2020).
Original GitHub issue: https://github.com/rivo/tview/issues/420

Currently, the only way one can reset all text attributes with a color is using [::-]. This therefore makes it hard to print text like
normal underlined bold underlined underlined normal
(instead of strikethrough should be underlined)
as all the attributes are removed. Maybe a !b could turn off bold only, or if you want to keep single character tags the letter case could determine the difference.

The above example could be accomplished by something like this:
normal [::u]underlined [::b]bold underlined[::!b] underlined[::!u] normal
or
normal [::u]underlined [::b]bold underlined[::B] underlined[::U] normal
Let me know how this sounds, I can open a PR if this would be suitable for tview.

Originally created by @gnojus on GitHub (Mar 26, 2020). Original GitHub issue: https://github.com/rivo/tview/issues/420 Currently, the only way one can reset all text attributes with a color is using `[::-]`. This therefore makes it hard to print text like normal ~~underlined __bold underlined__ underlined~~ normal (instead of strikethrough should be underlined) as all the attributes are removed. Maybe a `!b` could turn off bold only, or if you want to keep single character tags the letter case could determine the difference. The above example could be accomplished by something like this: `normal [::u]underlined [::b]bold underlined[::!b] underlined[::!u] normal` or `normal [::u]underlined [::b]bold underlined[::B] underlined[::U] normal` Let me know how this sounds, I can open a PR if this would be suitable for tview.
kerem 2026-03-04 01:03:49 +03:00
Author
Owner

@rivo commented on GitHub (Apr 14, 2020):

I think this makes sense. I will look into this myself. No need to submit a PR.

<!-- gh-comment-id:613394467 --> @rivo commented on GitHub (Apr 14, 2020): I think this makes sense. I will look into this myself. No need to submit a PR.
Author
Owner

@gnojus commented on GitHub (Jul 5, 2020):

I realized that I had a wrong view of these attribute tags. I wrongly assumed that they would stack continuously, that is something like [::b]A[::u]B would result in A being bold and B being both bold and underlined. But actually A would only be bold and B - only underlined.

This means that you cannot add a single attribute to the current mask and therefore it wouldn't probably make too much sense to have the ability to disable a single one as well.

<!-- gh-comment-id:653916540 --> @gnojus commented on GitHub (Jul 5, 2020): I realized that I had a wrong view of these attribute tags. I wrongly assumed that they would stack continuously, that is something like `[::b]A[::u]B` would result in `A` being bold and `B` being both bold and underlined. But actually `A` would only be bold and `B` - only underlined. This means that you cannot add a single attribute to the current mask and therefore it wouldn't probably make too much sense to have the ability to disable a single one as well.
Author
Owner

@rivo commented on GitHub (Nov 9, 2021):

@nojus297 Coming back to this due to #619, your last message here makes it sound like your request wasn't so much about turning off individual attributes but stacking styles. In that case, I'd rather refer to #619 and close this issue.

<!-- gh-comment-id:964276712 --> @rivo commented on GitHub (Nov 9, 2021): @nojus297 Coming back to this due to #619, your last message here makes it sound like your request wasn't so much about turning off individual attributes but stacking styles. In that case, I'd rather refer to #619 and close this issue.
Author
Owner

@gnojus commented on GitHub (Nov 9, 2021):

Sounds good to me

<!-- gh-comment-id:964437667 --> @gnojus commented on GitHub (Nov 9, 2021): Sounds good to me
Author
Owner

@rivo commented on GitHub (Aug 26, 2023):

Btw, attributes can now also be turned off individually.

<!-- gh-comment-id:1694375676 --> @rivo commented on GitHub (Aug 26, 2023): Btw, attributes can now also be turned off individually.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#309
No description provided.