[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: is it possible to ignore dark theme completely?


On Tue, 4 Jun 2024 at 15:36, Benoît Minisini <
benoit.minisini@xxxxxxxxxxxxxxxx> wrote:

> Le 04/06/2024 à 15:27, Bruce Steers a écrit :
> >
> >
> > On Tue, 4 Jun 2024 at 14:05, Benoît Minisini
> > <benoit.minisini@xxxxxxxxxxxxxxxx
> > <mailto:benoit.minisini@xxxxxxxxxxxxxxxx>> wrote:
> >
> >     Le 04/06/2024 à 15:00, Bruce Steers a écrit :
> >      >
> >      >
> >      > On Mon, 3 Jun 2024 at 23:17, Benoît Minisini
> >      > <benoit.minisini@xxxxxxxxxxxxxxxx
> >     <mailto:benoit.minisini@xxxxxxxxxxxxxxxx>
> >      > <mailto:benoit.minisini@xxxxxxxxxxxxxxxx
> >     <mailto:benoit.minisini@xxxxxxxxxxxxxxxx>>> wrote:
> >      >
> >      >     Le 03/06/2024 à 21:52, Bruce Steers a écrit :
> >      >      > So I just discovered my Blockski+ program looks terrible
> >     if dark
> >      >     theme
> >      >      > is used.
> >      >      >
> >      >      > Many of the self drawn button images and game images are
> >     inverting
> >      >      > colors where i do not want them to.
> >      >      >
> >      >      > Can my program be forced to ignore dark theme and load
> things
> >      >     without
> >      >      > modification?
> >      >      >
> >      >      > Or will i need to re-invert every image that is being
> >     effected by
> >      >     this?
> >      >      >
> >      >      > That's what i have been doing, something like
> >      >      > If Application.DarkTheme Then $hPicture =
> >      >      > $hPicture.Image.Invert(True).Picture
> >      >      >
> >      >      > But it'd be handy if i could get the program to render the
> >     same
> >      >      > regardless of dark theme or not.
> >      >      >
> >      >      > Respects
> >      >      > BruceS
> >      >      >
> >      >
> >      >     Do not use Picture[] if you don't want automatic conversion
> >     to dark
> >      >     theme. Use Picture.Load() instead.
> >      >
> >      >     Regards,
> >      >
> >      >     --
> >      >     Benoît Minisini.
> >      >
> >      >
> >      > I tried using env GB_GUI_DARK_THEME=0
> >      > looks like setting it to 1 forces dark mode to be true but
> >     setting it to
> >      > 0 does not force non dark mode.
> >      >
> >      > would it take much to make GB_GUI_DARK_THEME work for setting
> false?
> >      >
> >      > Respects
> >      > BruceS
> >      >
> >
> >     Why don't you modify your project so that you make the difference
> >     between the images that must adapt to dark mode (toolbar and menu
> icons
> >     usually), and the others images (that you must load with
> >     'Picture.Load()' then) ? This is the right thing to do.
> >
> >     --
> >     Benoît Minisini.
> >
> >
> > my concern is load speed.
> > i have already adapted the program to use Picture.Load in place of
> > Picture[] where needed.
> >
> > the games loads multiple blocks (could be hundreds) and used
> > Picture[sBlockPicturePath] thus utilizing the cache.
> >
> > Not being unable to override it and having to use Load() i think may be
> > slow on slow disks.
> >
> > I guess i can workaround it by pre-loading the block images once then
> > using that.
> >
> > Cheers anyway :)
> >
> > BruceS
>
> Picture[] is really for icons, and Picture properties, because when the
> system icon theme changes, the internal picture is cached is used to
> automatically reload the icons.
>
> You should create your own cache with a collection, so that you won't be
> disturbed by the automatic processes behing Picture[] (dark theme
> adaptation, and automatic reload on system icon theme changes).
>
> Regards,
>
> --
> Benoît Minisini.
>

Yep that's what I went with,  I made a Picture.class and added a Sub
LoadC() to it that uses a cache collection.

Cheers for the advice :)
BruceS

' Gambas class file  Picture.class

Export
Create Static

Static Private $hCol As New Collection

Static Public Sub _exit()

  $hCol = Null

End


Static Public Sub LoadC(Path As String) As Picture

  If Not $hCol.Exist(Path) Then $hCol[Path] = Super.Load(Path)
  Return $hCol[Path]

End

Follow-Ups:
Re: is it possible to ignore dark theme completely?Bruce Steers <bsteers4@xxxxxxxxx>
References:
is it possible to ignore dark theme completely?Bruce Steers <bsteers4@xxxxxxxxx>
Re: is it possible to ignore dark theme completely?Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: is it possible to ignore dark theme completely?Bruce Steers <bsteers4@xxxxxxxxx>
Re: is it possible to ignore dark theme completely?Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: is it possible to ignore dark theme completely?Bruce Steers <bsteers4@xxxxxxxxx>
Re: is it possible to ignore dark theme completely?Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>