mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 21:35:54 +03:00
[GH-ISSUE #73] Ability to disable default style. #52
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#52
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @lesovsky on GitHub (Mar 11, 2018).
Original GitHub issue: https://github.com/rivo/tview/issues/73
Hi,
Is it possible to disable default color style and use console-defined style?
In most cases people use their own color themes in their terminals and IMO programs have to use colors used by terminal and colors defined by programs should be optional. In my experience, changing style automatically from console-defined to program-defined might give unexpected visual appearance in some circumstances.
@rivo commented on GitHub (Mar 11, 2018):
Please see
Styleson how to change the default styles.I don't know if terminal applications have access to any individually predefined colors? This would be a
tcelltopic. Maybe you can find out?@lesovsky commented on GitHub (Mar 11, 2018):
I've already familiarized with
Stylesvariable, and as I understand it defines primitive's default color scheme automatically at program startup and thus overrides colors defined by terminal.Anyway, I going to dig into
tcelland try to find out how it works with colors.Thanks!
@lesovsky commented on GitHub (Mar 13, 2018):
Could you provide simple example how to work with
Styles? I trying to manipulate with struct variables such asStyles.PrimaryTextColor,Styles.PrimitiveBackgroundColor, but see no color changes in primitives.@lesovsky commented on GitHub (Mar 13, 2018):
ok, i see, styles have to be changed before primitives initialization.
@lesovsky commented on GitHub (Mar 13, 2018):
Well, I've completely solved the issue.
Before initializing primitives, it needs to setup
Stylesvariable, in particularStyles.PrimaryTextColorandStyles.PrimitiveBackgroundColorshoul be set totcell.ColorDefault. Thus program will get terminal colors for foreground text and background. Probably, adjusting other Style's variables totcell.ColorDefaultwill make the same behaviour but I didn't check.@rivo commented on GitHub (Mar 13, 2018):
Yes,
tcell.ColorDefaultbasically means "transparent". I haven't checked myself how this affects the drawing of primitive backgrounds but if you say you were able to achieve the desired effect, then I assume that's the solution.The
Stylesstruct is really only meant to be set once in the beginning, to define the overall style of your application. These are the defaults that are used during instantiation of primitives. (That's why they don't have an effect afterwards anymore.)