Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add theme and plot thickness options #847

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

MRog40
Copy link

@MRog40 MRog40 commented Oct 17, 2022

I was using OpenHardwareMonitor at night on my otherwise all black OLED system, so a quick google search pointed me towards "Hey, try Libre Hardware Monitor it is still maintained". I came across an all but abandoned PR for themes and decided to revive the code and add some other additions for customization

Themes
image

Plot Stroke Thickness
image

Auto dark theme (set by windows theme setting), 2pt Stroke Thickness
image

Black theme, 2pt Stroke Thickness
image

Light theme, 4pt Stroke Thickness
image

@PhyxionNL
Copy link
Collaborator

Maybe some of the colors of the graph can be tweaked a bit? The dark blue is very hard to see on dark theme (graph is somewhat OK, but the labels are almost unreadable).

@MRog40
Copy link
Author

MRog40 commented Oct 17, 2022

These are user selected colors, I chose to have #FF0000 and #00FF00. I'm assuming if the user is editing the pen colors, we'd want to leave it even when theme is changed. The alternative would be to evaluate the contrast and adjust the color to maintain it, but it seems fine to leave selected pen colors in the event of a theme change.

Here is the auto generated colors in light and dark mode:
image

I did recognize one issue when testing this that I'm going to fix - the colors aren't updated when the theme is

@MRog40
Copy link
Author

MRog40 commented Oct 18, 2022

Updated themes:
image

And repaired the colors not being updated at the point the theme is applied

@MRog40 MRog40 mentioned this pull request Oct 18, 2022
@PhyxionNL
Copy link
Collaborator

Thanks! One small thing, if you switch theme, the graph titlebar doesn't get updated to new color until you focus it. But I think the title bar needs to keep OS color, this is how other apps do it too.

@MRog40
Copy link
Author

MRog40 commented Oct 21, 2022

I made a video of the behavior on my end: https://imgur.com/R8r6ycM

If you switch theme, the graph titlebar doesn't get updated to new color until you focus it.

I wasn't sure whether you meant switch OS theme, or switch LHM theme. In the video, I showed that changing both immediately updates the LHM main window and plot window themes without any additional interaction needed.

But I think the title bar needs to keep OS color, this is how other apps do it too.

I don't think there is a proper or improper way to do this, in video I show Microsoft Edge top bar changing color with theme. Plenty of apps use their own color for the title bar, and I think this is the preferred behavior here.

@PhyxionNL
Copy link
Collaborator

PhyxionNL commented Oct 22, 2022

If you switch OS theme (app preferences), the titlebar color of the plot window isn't updated until you refocus it. I tried it on two systems and both have the same problem 🤔

I don't think there is a proper or improper way to do this, in video I show Microsoft Edge top bar changing color with theme. Plenty of apps use their own color for the title bar, and I think this is the preferred behavior here.

Edge doesn't change here (Windows 10), it stays on Windows' color.

@kamkie
Copy link

kamkie commented Oct 22, 2022

edge on windows 11 is system color on default theme, and user choosen otherwise (Ice mint etc)
image

@MRog40
Copy link
Author

MRog40 commented Oct 25, 2022

@PhyxionNL I unfortunately don't have a Windows 10 system to test this behavior. All I do is look in the registry for HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize\AppsUseLightTheme and set the theme based on that. Outside of registry behavior, I can't imagine W10 would have different UI handling for out of focus apps than W11. In terms of fixing this issue I have no ideas to try, and I don't think it should block this feature.

@pomianowski
Copy link
Contributor

@PhyxionNL I unfortunately don't have a Windows 10 system to test this behavior. All I do is look in the registry for HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize\AppsUseLightTheme and set the theme based on that. Outside of registry behavior, I can't imagine W10 would have different UI handling for out of focus apps than W11. In terms of fixing this issue I have no ideas to try, and I don't think it should block this feature.

You can detect the WININICHANGE (0x001A) message and then retrieve registry theme information.
https://github.com/lepoco/wpfui/blob/f2e2d136ad4aef88daa67ca17856a2fbe1abd4eb/src/Wpf.Ui/Appearance/Watcher.cs#L112
https://github.com/lepoco/wpfui/blob/f2e2d136ad4aef88daa67ca17856a2fbe1abd4eb/src/Wpf.Ui/Appearance/SystemTheme.cs#L30

Animation

@PhyxionNL
Copy link
Collaborator

@PhyxionNL I unfortunately don't have a Windows 10 system to test this behavior. All I do is look in the registry for HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize\AppsUseLightTheme and set the theme based on that. Outside of registry behavior, I can't imagine W10 would have different UI handling for out of focus apps than W11. In terms of fixing this issue I have no ideas to try, and I don't think it should block this feature.

It's not that the detection to change theme is broken, it does that correctly. But it doesn't update the titlebar color of dialogs unless you focus them.

@JFMugen
Copy link

JFMugen commented Nov 1, 2022

Awesome, thank you!

@ntoff
Copy link
Contributor

ntoff commented Nov 2, 2022

If I close LHWM and reopen it, the plot window (separate window) is no longer in dark mode.

Windows 10

image

@yurisuika
Copy link

Thanks for this!

@PhyxionNL
Copy link
Collaborator

@MRog40 Can you address the remaining issues mentioned here so it can be merged? Thanks!

@DerekTurtleRoe
Copy link

I've been using this PR version for a long time now because I can't live without dark mode 😄

Much appreciated @MRog40

@MRog40
Copy link
Author

MRog40 commented Jan 30, 2023

I've fixed a couple of the bugs with opening/closing and losing theme settings, still working out the title bar color

@Tamarindo94
Copy link

How can this be enabled? Theming options don't appear in my menu...

@ghost
Copy link

ghost commented Feb 2, 2023

How can this be enabled? Theming options don't appear in my menu...

Give the issue a thumbs up then wait and let developers develop it until one day in the releases section you see a new version and "Dark mode added" is one of the items in the change log, then shower them in praise and donations. Actually you could start praise and donations now, I guess, nobody would mind ;)

@jojo2massol
Copy link

Little issue with the mouseover : at program startup, the color of the text and the box (see image below) is a bit weird. This color is the same whatever the theme is. When the theme is changed, the issue disappears.
image

@jojo2massol
Copy link

How can this be enabled? Theming options don't appear in my menu...

You have to compile it yourself from MRog40:darkmode with Visual Studio 😉

@MRog40
Copy link
Author

MRog40 commented Mar 8, 2023

How can this be enabled? Theming options don't appear in my menu...

Sorry for the delay everyone - day job taking priority for the moment.

I actually was previously requested to compile a release with dark mode, you can find that release here: https://github.com/MRog40/LibreHardwareMonitorDark/releases

I'm going to work on getting this PR in hopefully next sprint

@DerekTurtleRoe
Copy link

@MRog40 It's fine, I am excited for it to be merged! Hopefully your job isn't too stressful or anything. Thanks for your work so far! 😄

@MRog40
Copy link
Author

MRog40 commented Jul 7, 2023

Status update:
image
It's fully working after interaction, just figuring out why it isn't working right on launch. At initial startup the plot top bar is white (on detached plot window only) and the plot details on mouse click are still blue with white text. After any interaction like clicking a checkbox on and off, it all works properly

@jojo2massol
Copy link

I hope you will be able to find out !
If you're unable to do so, maybe you can force changing theme, like with the checkbox, at startup ? Not very clean, but if it works...

@kamkie
Copy link

kamkie commented Sep 15, 2023

Status update: image It's fully working after interaction, just figuring out why it isn't working right on launch. At initial startup the plot top bar is white (on detached plot window only) and the plot details on mouse click are still blue with white text. After any interaction like clicking a checkbox on and off, it all works properly

It also do not work when changing them is you did not interact with label befor changing theme
like plot label do not exists to set theme on it when theme is applied

@kamkie
Copy link

kamkie commented Sep 25, 2023

image looks like OxyPlot.WindowsForms.PlotView#ShowTracker is creating it using hardcoded colors

@kamkie
Copy link

kamkie commented Sep 25, 2023

adding something like

        ApplyTheme();
        _plot.ShowTracker(new TrackerHitResult());
        _plot.HideTracker();
        foreach (Control plotControl in _plot.Controls)
        {
            plotControl.BackColor = Theme.Current.PlotBackgroundColor;
        }

to PlotPanel constructor makes it working

@MRog40
Copy link
Author

MRog40 commented Oct 28, 2023

Thank you @kamkie for the fix. Two remaining issues I'll try and wrap up:

  1. At initial startup the plot top bar is white (on detached plot window only).
  2. The plot tracker text color is incorrect.
    Interacting with the plot doesn't fix either of these, I have to interact with a sensor for it to update.

@MRog40
Copy link
Author

MRog40 commented Oct 28, 2023

I believe all the issues are now fixed. Latest was uploaded to https://github.com/MRog40/LibreHardwareMonitorDark/releases to test

@MRog40
Copy link
Author

MRog40 commented Oct 28, 2023

@MRog40 Can you address the remaining issues mentioned here so it can be merged? Thanks!

@PhyxionNL I believe all the issues have been addressed

@PhyxionNL
Copy link
Collaborator

@MRog40 Can you address the remaining issues mentioned here so it can be merged? Thanks!

@PhyxionNL I believe all the issues have been addressed

Just tried it out, but plot window is still white for me (manually set theme to Dark).

image

Also Parameters dialog is white.

@phl23
Copy link

phl23 commented Dec 1, 2023

@MRog40 Can you address the remaining issues mentioned here so it can be merged? Thanks!

@PhyxionNL I believe all the issues have been addressed

Just tried it out, but plot window is still white for me (manually set theme to Dark).

image

Also Parameters dialog is white.

Works for me here. With every plot location, but I used my former config file. Maybe there is a difference.

@PhyxionNL
Copy link
Collaborator

Try this artifact: https://github.com/LibreHardwareMonitor/LibreHardwareMonitor/suites/18575006450/artifacts/1080435156
It's not working correctly for me.
FWIW, in Personalization > Colors in Windows: I have Windows mode on Dark and app mode on Light.

@Tamarindo94
Copy link

Tamarindo94 commented Dec 2, 2023

How can this be enabled? Theming options don't appear in my menu...

Sorry for the delay everyone - day job taking priority for the moment.

I actually was previously requested to compile a release with dark mode, you can find that release here: https://github.com/MRog40/LibreHardwareMonitorDark/releases

I'm going to work on getting this PR in hopefully next sprint

This is great, thanks a lot!! Will let you know if I find any issues

@MRog40
Copy link
Author

MRog40 commented Jan 9, 2024

Try this artifact: https://github.com/LibreHardwareMonitor/LibreHardwareMonitor/suites/18575006450/artifacts/1080435156 It's not working correctly for me. FWIW, in Personalization > Colors in Windows: I have Windows mode on Dark and app mode on Light.

I've tested the provided artifact and still the theme always works for me, I've tried all combinations of separate plot window, integrated plot, and all theme options including auto and it always works. Having different Windows / App themes doesn't matter, as I only look at the "AppsUseLightTheme" registry key and never the windows settings.

@MRog40
Copy link
Author

MRog40 commented Jan 9, 2024

Here is a little video demo using your artifact showing it only responds to App theme changes, and it responds even faster than windows explorer does:

Phyxion_Artifact_Theme.mp4

@MRog40
Copy link
Author

MRog40 commented Jan 30, 2024

Merged master and uploaded another updated release here for those that are using this version: https://github.com/MRog40/LibreHardwareMonitorDark/releases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet