Open LucasStf opened 1 year ago
Hey @LucasStf, I'm not sure how I can help with the code you provided. What does theme.SetWhiteTheme();
and theme.SetDraculaTheme();
do? You need to use WPF styles to get a dark theme on Windows, not sure about GTK.
@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 Gtk.Settings.Default.ApplicationPreferDarkTheme
to true / false.
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. I only regretted that we do not have access to customize those elements that are written in first message. I also need the functions to customize the text color of the tabs, the text and background of menus and toolbars, grids.
@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. My code was
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 :![image](https://github.com/picoe/Eto/assets/97894103/bf95c9d0-0262-49d6-8256-149da12bc59e)
WPF :![image](https://github.com/picoe/Eto/assets/97894103/d0221995-71b1-4bde-aca0-5ecf1a8edef8)
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