Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] How to change the background color? #13

Open
smolck opened this issue Aug 2, 2020 · 8 comments
Open

[Question] How to change the background color? #13

smolck opened this issue Aug 2, 2020 · 8 comments

Comments

@smolck
Copy link

smolck commented Aug 2, 2020

Hello! Firstly, I'd like to say thank you for creating and working on this library; it's really cool and quite useful!

As for my question, (and this might be in the examples, in which case I apologize) I'm not really sure how to change the background color from the default; I tried this but it didn't change anything:

page [
    window [
        Styles [
            Colors (Terminal.Gui.Color.White, Terminal.Gui.Color.Gray)
        ]
    ] [ // ...
      ]
]

I'd really like to just keep the background and foreground color the same as in the terminal, if that makes sense? Either that or change them from the default.

Thanks in advance!

@Hardt-Coded
Copy link
Owner

It's currently not possible in this version. I will implement this feature. Thanks for pointing me to that.

@Hardt-Coded
Copy link
Owner

I have published a preview version via nuget (0.1.8-preview1):

I introduced new Color Style for changing the Color Schemes of "Terminal.Gui":

example:

// normal scheme colors
Colors (Terminal.Gui.Color.White, Terminal.Gui.Color.Gray)

// scheme for focues elements
FocusColors (Terminal.Gui.Color.Red, Terminal.Gui.Color.DarkGray)

// scheme for normal elements with hotkey
HotNormalColors (Terminal.Gui.Color.Blue, Terminal.Gui.Color.Green)

// scheme for focued elements with hotkey
HotFocusedColors (Terminal.Gui.Color.BrightMagenta, Terminal.Gui.Color.BrightGreen)

// scheme for disabled elements
DisabledColors (Terminal.Gui.Color.Brown, Terminal.Gui.Color.White)

also I introduced 3 additional elements

page -> styledPage
menuBar -> styledMenuBar
statusBar -> styledStatusBar

All of them can be filled with the upper color styles, like you do in all other elements.

in your case it also possible to use "stylePage":

but window should also be possible:

stylePage [
    Styles [
            Colors (Terminal.Gui.Color.White, Terminal.Gui.Color.Gray)
            FocusColors (Terminal.Gui.Color.Red, Terminal.Gui.Color.DarkGray)
            HotNormalColors (Terminal.Gui.Color.Blue, Terminal.Gui.Color.Green)
            HotFocusedColors (Terminal.Gui.Color.BrightMagenta, Terminal.Gui.Color.BrightGreen)
            DisabledColors (Terminal.Gui.Color.Brown, Terminal.Gui.Color.White)
    ]
] [
    window [
        Styles [
            Colors (Terminal.Gui.Color.White, Terminal.Gui.Color.Gray)
        ]
    ] [ // ...
      ]
]

I didn't experiment, what combination fo the color had a specific outcome. Would be nice, if you experiment for your self and share what you find out :) - so I can make changes if needed, before I will publish this to all.

@smolck
Copy link
Author

smolck commented Aug 2, 2020

Wow, thanks for the really quick response and fix! Using styledPage works great!

I am curious though what adding Styles to a window does? Because doing that doesn't seem to change anything.

@Hardt-Coded
Copy link
Owner

It can be, that the styles of the page (TopLevel in terms of the Terminal.Gui from Miguel) override the styles of the window. It should work on the window, when you don't use styles on the page. I didn't test all of that. Maybe you can run further research :D

@smolck
Copy link
Author

smolck commented Aug 2, 2020

Yup, that was it; the page's styles do in fact override the styles of the window.

Thanks again! So, should I close this issue now, or would you rather it stay open?

@Hardt-Coded
Copy link
Owner

Nope. Leave it open as long the stylin Gia in preview. Yes documentation. I am very bad at documentation. There is a demo project, where I use all elements. But I will write a proper documentation in the future. Promise :)

@smolck
Copy link
Author

smolck commented Aug 2, 2020

Okay, sounds good!

Oh, one last question; is there a way to make the background color the same color as the terminal background? Or would that require truecolor support in gui.cs (see gui-cs/Terminal.Gui#48)?

@Hardt-Coded
Copy link
Owner

I didn't know any way to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants