I might be going about this all wrong, but I stumbled on this article:
Support Dark and Light themes in Win32 apps
I followed the steps:
1/
#include <dwmapi.h>
2/
#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE
#define DWMWA_USE_IMMERSIVE_DARK_MODE 20
#endif
3/
Call in InitInstance:
BOOL value = TRUE;
::DwmSetWindowAttribute(m_pMainWnd->GetSafeHwnd(),
DWMWA_USE_IMMERSIVE_DARK_MODE,
&value, sizeof(value));
As you can see, I am using a CDialog based application.
4/ I added Dwmapi.lib.
It compiles fine. But when I run my application the title bar is not dark. Why?
A related question is that in the article it states:
This article provides examples of ways to detect system theme changes, and request a light or dark title bar for your Win32 application's window. It does not cover specifics of how to repaint and render your app UI using a Dark mode color set.
So how do we go about this for an MFC Dialog application?
Note that my Windows 11 PC is running in Dark Mode.
In theory, it is achievable for common controls such as dialog boxes.
It will use the themes file.
[Visual Styles] Section shows a VisualStyles section for a High Contrast Black theme.
This thread has implemented it. It may help.
Related
Vaadin Flow 14 ships with light and dark versions of its two bundled themes, Lumo and Material.
And now browsers can ask the host OS for the user’s preference for light or dark modes.
Is there a way to have a Vaadin app automatically use the light or dark theme variant per the user’s wishes?
Marcus Hellberg wrote a helpful post on how to switch light/dark mode theme variants programmatically. I am wondering if Vaadin 14 might be able to switch automatically now that the user preference is detectable from within the browser.
If not, perhaps Someone could show Java code for inquiring about the user’s preference from server-side Java code.
You can use window.matchMedia API to listen for changes to the prefers-color-scheme media query standardized in Media Queries Level 5. See CanIUse.com for browser support.
That CSS media feature of color scheme preference has 3 possible values: no-preference, light, and dark. The code below looks for a match on dark.
Put the JavaScript code shown below into /frontend/prefers-color-scheme.js
On your main view, add the annotation #JsModule("prefers-color-scheme.js")
let mm = window.matchMedia('(prefers-color-scheme: dark)');
function apply() {
document.documentElement.setAttribute("theme",mm.matches?"dark":"");
}
mm.addListener(apply);
apply();
Source: https://gist.github.com/emarc/690eb2659c8b51cb895716914d65ec19
So I have been trying for a couple of hours to set a dark theme for Eclipse Juno, the blinding white in your face is very tiring and strains the eyes after a short time. I managed to find a theme that darkens eclipse but still a few problems remain.
See image
I have no control over the background color of the menubar. Is it possible to change it? I tried everything in Win7 "Window Color and Appearance" but aside from being able to change the fontsize of the window title the colors do not change.
I have no control over the fontsize used for the titles in the various view panels of Eclipse, like the projectexplorer or editor.
No control over scrollbar color.
These are minor issues but would make the end result of the themes so much better. Is it at all possible to do anything with any of those issues on Win7?
Does this help for item 2?
The font size for the view and editor titles can be changed in Preferences. Select General->Appearance->Colors and Fonts. In the panel on the right, expand 'View and Editor Folders' and select 'Part title font' then click the 'Edit...' button.
On this subject, this Eclipse Themes plugin is also worth a look:
https://github.com/jeeeyul/eclipse-themes/
This is an excellent article about Eclipse theming:
http://www.vogella.com/articles/Eclipse4CSS/article.html
As for the menubar and scrollbar, the aforementioned article states:
SWT currently has some limitations for styling. For example it is not
possible to style menus and table headers. In addition some platforms
do not allow the styling of certain widgets, e.g. the Button or the
ScrollBar widget.
In order to make these widgets fit nicely you can install custom Windows theme, such as this one: http://vi20rickrmetal12us.deviantart.com/art/Pre-Black-VS-for-Windows-7-180497508 (before you can install a custom theme, you have to patch your system with Universal Theme Patcher or similar tool).
I hit the same wall some time ago. I found this resources very useful at that point:
A eclipse 4 dark theme described in the blog post of its author. It can be downloaded from github here. You can see also the content of the code.
The home of various eclipse themes here.
Another stackoverflow quetion dealing with similar problems here.
Currently I am using InteliJ Idea with its darkula theme.
How does exactly work themes switching in application? What if I override the default styles? Can I also define different styles for light and dark themes separately? Why the icons colos get changed - i.e. the black background of icons changes into white if the theme is set to Dark. Will it also be changed to white if I override the background style of application bar to white explicitly? How can I make sure nothing gets changed and my app looks the same in Light and Dark themes?
Have you seen these?
Theme Overview for Windows Phone
http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff402557(v=vs.105).aspx
Theme Resources for Windows Phone
http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff769552(v=vs.105).aspx
How to: Apply Theme Resources for Windows Phone
http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff769545(v=vs.105).aspx
I personally use PhoneThemeManager from Jeff Wilcox for theme overriding works!
Of course, it is better to have the same UX across all the Windows Phone application when it comes to light/dark theme support, but I agree that sometimes it is really needed to override the theme.
You can probably find more information in this thread: How to override WindowsPhone dark theme by light
and also previously I was using this tutorial to customize light and dark themes:
http://blog.richardszalay.com/2011/06/11/practical-support-for-light-dark-themes-on-windows-phone-7/
In my Windows Phone 7 app, I want to use the light theme, no matter what theme the user sets in the phone. How to do that ?
Do I need to custom the style or theme ? I just want the default light theme.
Thanks
Jeff Wilcox offers a good way to do this using a theme manager he developed.
http://www.jeff.wilcox.name/2012/01/phonethememanager/
There is a nice way of replacing the default brushes. Saves you setting Forecolor everywhere.
http://www.designersilverlight.com/2011/01/17/theme-forcing-for-windows-phone-7-silverlight/
You'll still need to set the background of the main layout node to the default background brush.
Background="{StaticResource PhoneBackgroundBrush}"
There is no way to force an app to use a specific theme.
The best you can do is create your own style for every control you use and mimic the light theme in your styles.
Beware, this can be a time consuming and tedious task. Be sure to test all pages and all controls in all states when both the light and dark themes have been specified by the user.
I've had to do this (but for the dark theme) and it's not something I'd do again out of choice.
There are a few tips on doing this from one of the PDC sessions on optimising performance http://windowsteamblog.com/windows_phone/b/wpdev/archive/2010/10/28/pdc-live-optimizing-performance-for-silverlight-windows-phone-7-applications.aspx
This is a very bad idea.
Windows Phones use OLED displays - the pixels generate light directly, they are not backlit. Power consumption is therefore highest for white pixels. This is why Microsoft is suddenly obsessed with light text on dark backgrounds. It's not a back-to-the-seventies thing.
If you do this you will cause ridiculous power consumption.
For the benefit of the jerk who voted down a factually correct answer, I quote page 63 of the Windows Phone 7 UI Design and Interaction Guide published in July 2010 by Microsoft.
Avoid using too much white in
applications, such as white
backgrounds, as this may have an
impact on battery life for devices
that have organic LED displays.
If you're wondering why Microsoft included a "light background" theme option, so am I.
e.g. set the application appearance to classic, but set the window appearance to Aero style.
Is there a way to do this?
If you are using WPF or Silverlight you can use Themes. This page on the MSDN goes into some detail.
WPF Themes on CodePlex has examples.
This article on Code Project has some more information.
You'd actually want just one unchangeable theme and that would be the Windows Classic one.