Ignoring Dark Mode

Linux specific forum
HarrysLad
User
User
Posts: 57
Joined: Fri Jun 04, 2010 9:29 pm
Location: Sunny Spain

Ignoring Dark Mode

Post 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)?
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Ignoring Dark Mode

Post 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.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Ignoring Dark Mode

Post 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
Last edited by mk-soft on Sun Dec 18, 2022 3:11 pm, edited 1 time in total.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
HarrysLad
User
User
Posts: 57
Joined: Fri Jun 04, 2010 9:29 pm
Location: Sunny Spain

Re: Ignoring Dark Mode

Post 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:
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Ignoring Dark Mode

Post by mk-soft »

But it could be that "xyz-light" does not exist. Then better remove "-dark". As in the example Procedure DarkMode()
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
HarrysLad
User
User
Posts: 57
Joined: Fri Jun 04, 2010 9:29 pm
Location: Sunny Spain

Re: Ignoring Dark Mode

Post by HarrysLad »

Nice. Very nice. :D
Thanks for that.
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Ignoring Dark Mode

Post by mk-soft »

Over theme name not always work ..

Update
Link: GTK3 DarkMode
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
HarrysLad
User
User
Posts: 57
Joined: Fri Jun 04, 2010 9:29 pm
Location: Sunny Spain

Re: Ignoring Dark Mode

Post 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?
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Ignoring Dark Mode

Post 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
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply