Page 1 of 1

Ignoring Dark Mode

Posted: Thu Nov 17, 2022 7:21 pm
by HarrysLad
I have an app that runs on Windows, macOS and Linux.
Unfortunately, neither the macOS nor the Linux versions play well with Dark Mode. :x
I've found out how to disable/ignore Dark Mode in macOS but does anyone know of a solution for Linux (Ubuntu)?

Re: Ignoring Dark Mode

Posted: Thu Nov 17, 2022 9:05 pm
by mk-soft
With Linux, there is no switch for dark mode.
Here you have to change the CSS styles for the application. But I have not yet done this for Global for the application.

Re: Ignoring Dark Mode

Posted: Thu Nov 17, 2022 9:47 pm
by mk-soft
Its easy ... ;)

Example to set dark theme. Works only with exiting theme names with '-dark'

Update

Code: Select all

;- See Link
Link: GTK3-DarkMode

Re: Ignoring Dark Mode

Posted: Thu Nov 17, 2022 10:27 pm
by HarrysLad
mk-soft,

Thanks for the swift response.
You may have misread my first post. I'm not trying to apply Dark Mode globally, I'm trying to ignore Dark Mode locally!

I just removed the "Debug" reference and changed the
"*Theme = UTF8(ThemeName + "-dark")" line
to
"*Theme = UTF8(ThemeName + "-light")"

and it works like a charm!

Thanks so much. You wouldn't know how to do the same trick in Windows, would you? :lol:

Re: Ignoring Dark Mode

Posted: Thu Nov 17, 2022 10:40 pm
by mk-soft
But it could be that "xyz-light" does not exist. Then better remove "-dark". As in the example Procedure DarkMode()

Re: Ignoring Dark Mode

Posted: Thu Nov 17, 2022 11:12 pm
by HarrysLad
Nice. Very nice. :D
Thanks for that.

Re: Ignoring Dark Mode

Posted: Sun Dec 18, 2022 3:12 pm
by mk-soft
Over theme name not always work ..

Update
Link: GTK3 DarkMode

Re: Ignoring Dark Mode

Posted: Sun Dec 18, 2022 4:41 pm
by HarrysLad
Thanks for that mk-soft but it doesn't seem to be working on my Ubuntu 20.04 setup.
If the system dark-mode is off the the buttons toggle the app's mode between dark and light as expected.
However, if the system's dark-mode is on then the buttons do nothing (i.e., the dark-mode remains on).
Any ideas?

Re: Ignoring Dark Mode

Posted: Sun Dec 18, 2022 5:26 pm
by mk-soft
You are right.

Its default theme for application is dark then can not change to default-mode

Update !
also change application theme

Code: Select all

;SetThemeName("Mint-Y")
SetThemeName("Yaru")
or

Code: Select all

    Define Theme.s
    Theme = GetThemeName()
    Theme = RemoveString(Theme, "-dark", #PB_String_NoCase)
    SetThemeName(Theme)
    
    If Not IsDarkMode()
      SetDarkMode(#True)
    EndIf
Link: GTK3-DarkMode