[GH-ISSUE #868] Override themes for application individually #632

Closed
opened 2026-03-04 01:06:37 +03:00 by kerem · 4 comments
Owner

Originally created by @HeavyBro1337 on GitHub (Aug 23, 2023).
Original GitHub issue: https://github.com/rivo/tview/issues/868

Hello, I want to say right away that the package is fantastic and well-done!
However, there's one quirk that I hope will be fixed in a new version.

The only limitation I encountered while using this package is styling, I am making a networked application which can use several instances of tview.Application and since tview.Styles is a global variable shared among other primitives, I can't really personalize the theme for each session.

The wiki didn't mention any style overriding (i.e. passing Theme struct as the parameter at very least).

image
In this screenshot you can see default theme being used.

image
When I execute this command, it is supposed to change theme at the current session by idea, however when somebody else joins, then the new theme is applied on that session.
image

func applyTheme() {
	tview.Styles.BorderColor = tcell.ColorMaroon
	tview.Styles.PrimaryTextColor = tcell.ColorGold
	tview.Styles.PrimitiveBackgroundColor = tcell.ColorLightGreen
}

The code in question

Originally created by @HeavyBro1337 on GitHub (Aug 23, 2023). Original GitHub issue: https://github.com/rivo/tview/issues/868 Hello, I want to say right away that the package is fantastic and well-done! However, there's one quirk that I hope will be fixed in a new version. The only limitation I encountered while using this package is styling, I am making a networked application which can use several instances of `tview.Application` and since `tview.Styles` is a global variable shared among other primitives, I can't really personalize the theme for each session. The wiki didn't mention any style overriding (i.e. passing Theme struct as the parameter at very least). ![image](https://github.com/rivo/tview/assets/70683749/4eb3019a-cc63-40c5-960a-474ee3556190) In this screenshot you can see default theme being used. ![image](https://github.com/rivo/tview/assets/70683749/06fe25f5-5eae-47e4-a2bf-72c0d307ea26) When I execute this command, it is supposed to change theme at the current session by idea, however when somebody else joins, then the new theme is applied on that session. ![image](https://github.com/rivo/tview/assets/70683749/a076eb4e-9882-4d9b-92e8-d2b81cc8f3ec) ```go func applyTheme() { tview.Styles.BorderColor = tcell.ColorMaroon tview.Styles.PrimaryTextColor = tcell.ColorGold tview.Styles.PrimitiveBackgroundColor = tcell.ColorLightGreen } ``` The code in question
kerem closed this issue 2026-03-04 01:06:37 +03:00
Author
Owner

@rivo commented on GitHub (Apr 4, 2024):

@IvanKorchmit You are correct. The way it currently works is that there is only one global theme which would apply to all applications if you used multiple. (I'm curious how you use multiple instances of Application, I have never seen that before.)

I have plans to allow for more detailed styling but as of now, I can't say when this will be available.

I'm closing this issue for now. If you feel that you need more help, please comment here or open a new issue.

<!-- gh-comment-id:2037676512 --> @rivo commented on GitHub (Apr 4, 2024): @IvanKorchmit You are correct. The way it currently works is that there is only one global theme which would apply to all applications if you used multiple. (I'm curious how you use multiple instances of `Application`, I have never seen that before.) I have plans to allow for more detailed styling but as of now, I can't say when this will be available. I'm closing this issue for now. If you feel that you need more help, please comment here or open a new issue.
Author
Owner

@HeavyBro1337 commented on GitHub (Apr 4, 2024):

@IvanKorchmit You are correct. The way it currently works is that there is only one global theme which would apply to all applications if you used multiple. (I'm curious how you use multiple instances of Application, I have never seen that before.)

I have plans to allow for more detailed styling but as of now, I can't say when this will be available.

I'm closing this issue for now. If you feel that you need more help, please comment here or open a new issue.

Hello, I'm using tview for multi-user dungeon framework via SSH and each session creates Application instance which is where it is used for rendering UI. I was curious to implement something like themes for different rooms (entering dungeon would result in a dark or gray themed UI for better experience)

<!-- gh-comment-id:2037779095 --> @HeavyBro1337 commented on GitHub (Apr 4, 2024): > @IvanKorchmit You are correct. The way it currently works is that there is only one global theme which would apply to all applications if you used multiple. (I'm curious how you use multiple instances of `Application`, I have never seen that before.) > > I have plans to allow for more detailed styling but as of now, I can't say when this will be available. > > I'm closing this issue for now. If you feel that you need more help, please comment here or open a new issue. Hello, I'm using `tview` for multi-user dungeon framework via SSH and each session creates `Application` instance which is where it is used for rendering UI. I was curious to implement something like themes for different rooms (entering dungeon would result in a dark or gray themed UI for better experience)
Author
Owner

@rivo commented on GitHub (Apr 6, 2024):

Got it. Interesting. Well, as mentioned, this is currently not supported but there may be tools to facilitate this soon. (Again, I don't know how "soon".)

If you really need it, short of patching tview, you could think about starting separate processes for each session. But I don't know how complicated this is in your application.

<!-- gh-comment-id:2041073654 --> @rivo commented on GitHub (Apr 6, 2024): Got it. Interesting. Well, as mentioned, this is currently not supported but there may be tools to facilitate this soon. (Again, I don't know how "soon".) If you really need it, short of patching `tview`, you could think about starting separate processes for each session. But I don't know how complicated this is in your application.
Author
Owner

@HeavyBro1337 commented on GitHub (Apr 6, 2024):

Well, I'm totally fine, it would be nice to have that. I can definitely
live without that!

On Sat, Apr 6, 2024, 15:49 rivo @.***> wrote:

Got it. Interesting. Well, as mentioned, this is currently not supported
but there may be tools to facilitate this soon. (Again, I don't know how
"soon".)

If you really need it, short of patching tview, you could think about
starting separate processes for each session. But I don't know how
complicated this is in your application.


Reply to this email directly, view it on GitHub
https://github.com/rivo/tview/issues/868#issuecomment-2041073654, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AQ3IYZK3HRTW3RRJDCGABJDY37VMTAVCNFSM6AAAAAA33QUSYGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBRGA3TGNRVGQ
.
You are receiving this because you were mentioned.Message ID:
@.***>

<!-- gh-comment-id:2041086858 --> @HeavyBro1337 commented on GitHub (Apr 6, 2024): Well, I'm totally fine, it would be nice to have that. I can definitely live without that! On Sat, Apr 6, 2024, 15:49 rivo ***@***.***> wrote: > Got it. Interesting. Well, as mentioned, this is currently not supported > but there may be tools to facilitate this soon. (Again, I don't know how > "soon".) > > If you really need it, short of patching tview, you could think about > starting separate processes for each session. But I don't know how > complicated this is in your application. > > — > Reply to this email directly, view it on GitHub > <https://github.com/rivo/tview/issues/868#issuecomment-2041073654>, or > unsubscribe > <https://github.com/notifications/unsubscribe-auth/AQ3IYZK3HRTW3RRJDCGABJDY37VMTAVCNFSM6AAAAAA33QUSYGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBRGA3TGNRVGQ> > . > You are receiving this because you were mentioned.Message ID: > ***@***.***> >
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#632
No description provided.