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
Need help with dark theme #2472
Comments
Hey @LucasStf, I'm not sure how I can help with the code you provided. What does |
@cwensley This two functions are just updating the background color of the main form, the rich text area etc.. I've created them to just easily switch between theme's. So this is why I'm blocked, when I set a dark theme, the MenuBar items are in black, so black labels on a black background is not something amazing. Same with the name of tabpages, theirs are in black too by default. So I'm trying to figure out how to change the text color of the tabpage Text, and the MenuBar items. |
You should not be manually setting colors from code on the Gtk backend unless you really need to, instead if you want to customise your app you are supposed to provide a Gtk theme which is a bit longer topic to explain. Now if you just want to enable the dark mode for the Gtk backend, you can do it simply by specifying |
Yes. But at the same time, if the application can have customizable user themes in spite of the system light or dark themes, this is impossible to implement. |
@Serg-Norseman I don't understand what you are talking about, can you rephrase it? |
Sorry for interfering with this topic. |
@harry-cpp I already tried to apply a custom GTK theme (Dracula theme and Nordic) to my application using cssProvider but it doesn't work my app was still in full white. using Eto.Forms;
using System;
var cssProvider = new Gtk.CssProvider();
cssProvider.LoadFromPath("gtk.css");
Gtk.StyleContext.AddProviderForScreen(Gdk.Screen.Default, cssProvider, Gtk.StyleProviderPriority.User);
namespace GSCoder.Gtk
{
internal class Program
{
[STAThread]
public static void Main(string[] args)
{
new Application(Eto.Platforms.Gtk).Run(new MainForm());
}
}
} And with : Gtk.Settings.Default.ApplicationPreferDarkTheme = true i have this error : |
You need to init gtk / eto.forms first: using Eto.Forms;
using System;
// You need to not use .Gtk for the namespace name
// otherwise C# will complain about accessing Gtk namespace.
//
// Alternatibly you can change the Gtk namespace itself by doing
// using GtkN = Gtk; and then use GtkN.Settings
namespace GSCoder.GtkApp
{
internal class Program
{
[STAThread]
public static void Main(string[] args)
{
var app = new Application(Eto.Platforms.Gtk);
Gtk.Settings.Default.ApplicationPreferDarkTheme = true;
app.Run(new MainForm());
}
}
} |
@harry-cpp Thank you i have now a dark theme on windows with GTK 👍 |
Expected Behavior
1 : Change the color of the Text tabpage to White.
2 : Change the color of items in the MenuBar to White.
3 : Change the background color of the TreeGridView
Actual Behavior
GTK :
WPF :
Code that Demonstrates the Problem
The code of the TreeGridView
The code of the MenuBar :
The code of the creation of a new tabpage :
Specifications
The text was updated successfully, but these errors were encountered: