Hello everyone
I have my project in light colors since I started it. But now I observe that it is more elegant, more readable and careful to use dark theme to consume less energy.
Anyway, me and my environmentalism.
Is there a way to convert my project to a dark theme without dying trying?
I already tried it several times but I gave up because of how huge my project is, full of forms and letters, especially in red and green because they are economic data, as well as icons that I did not take into account their background, etc.
Please, any help would be appreciated.
Greetings
Is there an easy way to put my program in a dark theme?
- gambafeliz
- Posts: 144
- Joined: Friday 2nd September 2022 7:50pm
- Location: I live in the same city as Picasso
Is there an easy way to put my program in a dark theme?
For your misfortunes I am Spanish and I only know Spanish, please, be patient with me, Thank you.
- BruceSteers
- Posts: 1874
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Is there an easy way to put my program in a dark theme?
I'm not so sure.
Maybe using Color.Invert() in a For loop on the form controls to convert it..
Something a bit like that but probably more advanced
Maybe using Color.Invert() in a For loop on the form controls to convert it..
If bDarkMode Then
For each c as Control In Form.Controls
c.Foreground = Color.Invert(c.Foreground)
c.Background = Color.Invert(c.Background)
Next
Endif
Something a bit like that but probably more advanced
If at first you don't succeed , try doing something differently.
BruceS
BruceS
- gambafeliz
- Posts: 144
- Joined: Friday 2nd September 2022 7:50pm
- Location: I live in the same city as Picasso
Re: Is there an easy way to put my program in a dark theme?
It would be interesting. I try it and I'll tell you.
How it works is going to be amazing.
How it works is going to be amazing.
For your misfortunes I am Spanish and I only know Spanish, please, be patient with me, Thank you.
- gambafeliz
- Posts: 144
- Joined: Friday 2nd September 2022 7:50pm
- Location: I live in the same city as Picasso
Re: Is there an easy way to put my program in a dark theme?
I give up. The code works although in my case very partially.
My problem is that I'm going to have to modify everything, everything, the code to resolve the issue to dark.
Nobody's fault. Only me for not having foreseen this possibility.
Note: It occurred to me now, to change the color in the .Form files but I don't know if it is possible. But even if it is possible, I am sure that within the code I assign colors, with which it will continue to be chaos.
Thanks for that attempt to help me, but I'm at a dead end.
My problem is that I'm going to have to modify everything, everything, the code to resolve the issue to dark.
Nobody's fault. Only me for not having foreseen this possibility.
Note: It occurred to me now, to change the color in the .Form files but I don't know if it is possible. But even if it is possible, I am sure that within the code I assign colors, with which it will continue to be chaos.
Thanks for that attempt to help me, but I'm at a dead end.
For your misfortunes I am Spanish and I only know Spanish, please, be patient with me, Thank you.
- BruceSteers
- Posts: 1874
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Is there an easy way to put my program in a dark theme?
This kinda works for me...
I have this Public function in my StartUp.class...
then for each form class file i just add the following in the Form_Open() method...
It'll need more work though i think to check if the desktop is in dark mode.
I think the following code...
o.Foreground = If(o.Foreground = -1, Color.White, Color.Invert(o.Foreground))
may only work on non dark themes where the text is black
I have this Public function in my StartUp.class...
Public DarkMode As Boolean = True
Public Sub CheckDark(Parent As Object)
If Not DarkMode Then Return
Try Parent.Foreground = If(Parent.Foreground = -1, Color.White, Color.Invert(Parent.Foreground))
Try Parent.Background = Color.Invert(Parent.Background)
For Each o As Object In Parent.Children
If o Is Container Then
CheckDark(o)
Else
Try o.Foreground = If(o.Foreground = -1, Color.White, Color.Invert(o.Foreground))
Try o.Background = Color.Invert(o.Background)
Endif
Next
End
then for each form class file i just add the following in the Form_Open() method...
Public Sub Form_Open()
StartUp.CheckDark(Me)
End
It'll need more work though i think to check if the desktop is in dark mode.
I think the following code...
o.Foreground = If(o.Foreground = -1, Color.White, Color.Invert(o.Foreground))
may only work on non dark themes where the text is black
If at first you don't succeed , try doing something differently.
BruceS
BruceS
- gambafeliz
- Posts: 144
- Joined: Friday 2nd September 2022 7:50pm
- Location: I live in the same city as Picasso
Re: Is there an easy way to put my program in a dark theme?
I haven't tried it yet. I'll tell you, but it works or not. I'm honestly moved and I appreciate your effort. Thanks for your help.
For your misfortunes I am Spanish and I only know Spanish, please, be patient with me, Thank you.
- gambafeliz
- Posts: 144
- Joined: Friday 2nd September 2022 7:50pm
- Location: I live in the same city as Picasso
Re: Is there an easy way to put my program in a dark theme?
This code works much better. There are little things but it takes less effort to correct my program.
As I always tell you and I will tell you today you have done a little more good than bad. And I hope you are rewarded. Thank you.
As I always tell you and I will tell you today you have done a little more good than bad. And I hope you are rewarded. Thank you.
For your misfortunes I am Spanish and I only know Spanish, please, be patient with me, Thank you.