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 support for accent color saturation level #49

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

Conversation

WinExperiments
Copy link

This new version allows you to use any accent color, such as gray, brown, etc. Designed to colorize the default Windows 11 visual style and Rectify11's custom visual styles. Does not have the Windows version checks apart from the taskband ExtendedUI buttons.

@WinExperiments
Copy link
Author

This does not mean it does not work on Windows Vista to 10, in fact, it should work as intended. My main concern was Windows 11.

@OrthodoxWindows
Copy link

I just realized that we forked the project almost at the same time lol.

@WinExperiments
Copy link
Author

@OrthodoxWindows Try out my new version, you'll like it.

if (message == WM_DWMCOLORIZATIONCOLORCHANGED || (message == WM_WTSSESSION_CHANGE && wParam == WTS_SESSION_UNLOCK)) {
accentColorChanges++;
}
else {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to re-apply colorization if theme has been changed (WM_THEMECHANGED)? I'm not sure, just wondering

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used when you change the accent color in order to find your previous saturation. You can check AccentColorHelper.cpp for why I'm using it.

@OrthodoxWindows
Copy link

OrthodoxWindows commented Jun 1, 2024

@OrthodoxWindows Try out my new version, you'll like it.

Indeed, your changes fix all the problems I was having. Thank you very much.

However, I still see one element not colorized ; these are some frames related to the Basic theme (if you use the Basic theme with DWM, you have to use this Windhawk mod to enable them) in the Aerolite style :
msdt_tLbr88Vnx2

For some reason, in the Aero style, it seems to be colorized correctly :
msdt_qt62jZWYpl

@WinExperiments
Copy link
Author

@krlvm This one has full HSL support, meaning the bitmaps change according to the different brightness levels of accent colors. It fully works on the Rectify11 visual styles (light and dark), but on the Microsoft ones (Windows 10/11), the Explorer list views do not support all colors and may turn into weird colors. I thought it was the transparent pixels but they colorize perfectly with the Rectify11 styles. I tried multiplying the saturation by 0.9 and that workaround works but the colors are more inaccurate.

@krlvm
Copy link
Owner

krlvm commented Jun 3, 2024

This is still very cool, I'll think about how I can help this evening and we'll merge it into the upstream

@WinExperiments
Copy link
Author

Have you checked the code?

@krlvm
Copy link
Owner

krlvm commented Jun 4, 2024

Currently it breaks with light orange color:
image

@krlvm
Copy link
Owner

krlvm commented Jun 4, 2024

(just for record, will check what we can do with it)

@WinExperiments
Copy link
Author

Interestingly enough, the correct colors show up if you have the items grouped and click the expand/collapse button. They only show up when the animation is playing, when it finishes, the broken color comes back.

@krlvm
Copy link
Owner

krlvm commented Jun 4, 2024

Interestingly enough, the correct colors show up if you have the items grouped and click the expand/collapse button. They only show up when the animation is playing, when it finishes, the broken color comes back.

The (almost) correct color is also applied to the ListView items focused state

@WinExperiments
Copy link
Author

Does this fix the color issue?

@krlvm
Copy link
Owner

krlvm commented Jun 9, 2024

Yes, it works much better. Thank you!

However, if you set accent color back to Standard Blue, everything looks undersaturated in comparasion to the default colors - where did you get g_hslDefaultAccent values from?

@WinExperiments
Copy link
Author

This is almost perfect, its only bug is when the theme is changed, it applies a weird light gray color and changing the accent color to a normal one gives wrong lightness values and gradients are completely ruined.

accentColorChanges = 1;
}
else if (message == WM_DWMCOLORIZATIONCOLORCHANGED || (message == WM_WTSSESSION_CHANGE && wParam == WTS_SESSION_UNLOCK)) {
accentColorChanges = 2 + accentColorChanges;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be able to use the g_oldhslAccentS and g_oldhslAccentL values, these should not be used on the first time you launch the program, only when the accent color is changed

@WinExperiments
Copy link
Author

It's as if there is no idempotency now - after each restart of the program the colors become darker and darker.
What do you do to get the colors darker?

@krlvm
Copy link
Owner

krlvm commented Jun 18, 2024

I just kill and start the process again, so it recolorizes everything one more time

@krlvm
Copy link
Owner

krlvm commented Jun 18, 2024

You can also change accent colors back and forth a few times and then check the produced color with a graphics editor - it will change

@WinExperiments
Copy link
Author

I just kill and start the process again, so it recolorizes everything one more time

Yes, I have not addressed this issue. I always assumed users would start it once until they restart the device (which resets bitmaps back to default colors). I guess we can save the g_oldhslAccentS and g_oldhslAccentL values get saved in a way that is preserved even if AccentColorizer is not running?

@WinExperiments
Copy link
Author

You can also change accent colors back and forth a few times and then check the produced color with a graphics editor - it will change

Is it a big difference in the colors? I mean back then it was very easy to notice but I've improved the accuracy over time -- I know it is not 100% perfect but it's still very close. I guess it's fractional imperfections in the RGB to HSL logic

@krlvm
Copy link
Owner

krlvm commented Jun 18, 2024

We can store currently applied accent color in registry

@WinExperiments
Copy link
Author

Why do we need to store the accent color? We only need to store g_oldhslAccentS, g_oldhslAccentL, and g_oldhslEnhancedAccentL right?

@krlvm
Copy link
Owner

krlvm commented Jun 18, 2024

Yes, that's what I meant, but we can also store the color itself to avoid re-application

@WinExperiments
Copy link
Author

As for the results, I don't see any difference from Debug.

Have you tried to change the theme (visual style)? Changing from Windows default to High Contrast and back to Windows default is enough -- no custom visual style needed. You'd also need a desaturated accent color (like the "Iris pastel" or "Camouflage desert" colors in the Windows presets) to notice it. The saturation is ignored and lightness is inaccurate when I use Release but that doesn't happen on Debug

@WinExperiments
Copy link
Author

WinExperiments commented Jun 18, 2024

@krlvm Now that I tried launching the release build from VS itself, it works normallyit is still flawed. Have you tried building it? I'll try building it with your new configuration and retest it. Same results on the built version.

@WinExperiments
Copy link
Author

It looks like it doesn't apply the saturation and lightness changes when the theme is changed, but does when you change the accent color after that (on Release). On Debug, everything is done correctly. Why does Release ignore them at theme change?

@krlvm
Copy link
Owner

krlvm commented Jun 18, 2024

It looks like it doesn't apply the saturation and lightness changes when the theme is changed, but does when you change the accent color after that (on Release). On Debug, everything is done correctly.

What's the sequence? Switch to a high contrast theme, go back and change the accent color?

@WinExperiments
Copy link
Author

What's the sequence? Switch to a high contrast theme, go back and change the accent color?

Yes, also, the accent color prior to theme change should be desaturated (like "Iris pastel" or "Camouflage desert" from the Windows presets)

@krlvm
Copy link
Owner

krlvm commented Jun 18, 2024

I can't reproduce it on Windows 10 neither on Release nor on Debug builds, do you use Windows 11?

@WinExperiments
Copy link
Author

Yes I use Windows 11, I also tried on 3 different visual styles. Did you use one of the colors I asked you to use?

@krlvm
Copy link
Owner

krlvm commented Jun 18, 2024

Yes, I did with both colors. Maybe it's a Windows 11 specific problem, I'll get a VM and check.

@WinExperiments
Copy link
Author

Maybe it's a Windows 11 specific problem, I'll get a VM and check.

I don't know. If you wonder what build I'm running, it's 22621.382

@WinExperiments
Copy link
Author

@krlvm Have you tested it on Windows 11?

@OrthodoxWindows
Copy link

OrthodoxWindows commented Jun 23, 2024

@OrthodoxWindows Aerolite uses a fillcolor for that frame which AccentColorizer cannot colorize. It can only colorize bitmaps.

However, many Aerolite style elements do not use bitmaps, yet they are correctly colorized. Its strange.

@WinExperiments
Copy link
Author

However, many Aerolite style elements do not use bitmaps, yet they are correctly colorized. Its strange.

They use ColorList. ColorList is not the same as FillColor.

@OrthodoxWindows
Copy link

However, many Aerolite style elements do not use bitmaps, yet they are correctly colorized. Its strange.

They use ColorList. ColorList is not the same as FillColor.

Thank you, I understand better. While exploring the visual style, I noticed that elements that use FillColor are rare.
Overall, I think I'll modify aerolite to fix the issue (just like I'll modify aero to fix the basic frame Windows 7 styling issue).

@krlvm
Copy link
Owner

krlvm commented Jun 23, 2024

@krlvm Have you tested it on Windows 11?

I haven't had time yet, but I'll try soon

@WinExperiments
Copy link
Author

@krlvm Have you done any further tests? It's been 2 months

@WinExperiments
Copy link
Author

Update: Behavior is different on a more updated 22621 build.

Changing themes now gives a half-saturated default accent color.

@WinExperiments
Copy link
Author

@krlvm I think I fixed almost everything here, the only remaining thing is how to properly support colorization if the theme was already colorized, e.g. when the user quickly signs out and back in, the colorized theme is still loaded in memory, and AccentColorizer would reapply that colorization, leading to wrong saturation and brightness. Same thing could happen if the user terminates the process and re-executes it.

@Flameancer
Copy link

@WinExperiments is your version the latest version of this software?

@WinExperiments
Copy link
Author

@Flameancer Yes it is. I cannot contact the original developer anymore.

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.

4 participants