Gui.cs: Change Background Color

Created on 16 Nov 2018  路  8Comments  路  Source: migueldeicaza/gui.cs

Any way to change background color from blue to something else?
I've tried setting ColorScheme on everything I can see and no luck...

Regards,
Stefan

Most helpful comment

There are a number of ways of changing the color.

The first thing is to configure the ColorScheme, which defines all the global colors after you have called Application.Init:

Application.Init ();
Colors.Base.Normal = Application.Driver.MakeAttribute (Color.Green, Color.Black);

The other one is to set the ColorScheme on a specific view, here I just change it to the error one, but you can create your own:

var win = new Window (...)
win.ColorScheme = Colors.Error;

All 8 comments

How did you set the color scheme?

Has anyone figured this out yet?

From what @migueldeicaza has asked, I would gather that it's possible to set the Color Scheme, but I can't find out in the documentation how to do it.

Can we get some guidance on that?

I found the following in CursesDriver.cs

I could use any information regarding how to implement it properly.
Also found this and a bunch of other color theme methods in the above named file.

public override void SetColors (ConsoleColor foreground, ConsoleColor background)

Maybe their is an issue with #84 for cross platform compat.

I saw these too #61, #29, and #48 too

Hi @migueldeicaza was wondering if I should put up an issue for guidance about the last commit you did to expose the MakeColor part of the curses API?

That's rather confusing. I'd assume that SetColors() or SetAttribute to set the background colors, but I was only able to set the colors by manually setting Terminal.gui.Colors.Base and editing the application.Driver didn't seem to do anything.

Specificially the line to change the blue is

using Terminal.Gui;
...
            Application.Init();
            Colors.Base = Colors.Dialog;

I'mt testing this on windows.

There are a number of ways of changing the color.

The first thing is to configure the ColorScheme, which defines all the global colors after you have called Application.Init:

Application.Init ();
Colors.Base.Normal = Application.Driver.MakeAttribute (Color.Green, Color.Black);

The other one is to set the ColorScheme on a specific view, here I just change it to the error one, but you can create your own:

var win = new Window (...)
win.ColorScheme = Colors.Error;

Solid, TY!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pviotti picture pviotti  路  8Comments

TylerLeonhardt picture TylerLeonhardt  路  5Comments

alet picture alet  路  6Comments

0x788 picture 0x788  路  3Comments

tig picture tig  路  3Comments