{"id":5727,"date":"2024-06-20T16:03:18","date_gmt":"2024-06-20T16:03:18","guid":{"rendered":"https:\/\/puvox.software\/blog\/?p=5727"},"modified":"2024-09-28T07:44:19","modified_gmt":"2024-09-28T07:44:19","slug":"programmatically-change-windows-theme-from-to-dark-light","status":"publish","type":"post","link":"https:\/\/puvox.software\/blog\/programmatically-change-windows-theme-from-to-dark-light\/","title":{"rendered":"Programmatically change Windows Theme from-to DARK\/LIGHT"},"content":{"rendered":"<div class=\"default-content-clss content_5727 type_post \"><p>There are several ways:<\/p>\n<h3>==== Method 1 ====<\/h3>\n<p>Right click on desktop, select <code>New &gt; Shortcut &gt;<\/code> type <code>ms-settings:personalization-colors<\/code>. Then open it anytime.<\/p>\n<p>NOTE: To <span style=\"color: #339966;\">sync <strong>VSCODE<\/strong> theme (dark\/light) to OS theme<\/span>, open <span style=\"color: #ff0000;\"><code>User Preferences<\/code><\/span>in VSCODE, then search &amp; enable <code>autoDetectColorScheme<\/code>.<\/p>\n<p>&nbsp;<\/p>\n<h3>==== Method 2 ====<\/h3>\n<p>Save this snippet in &#8220;<strong>theme-changer.ps1<\/strong>&#8221; file, and <strong>right-click &gt; &#8220;Run with Powershell&#8221;<\/strong><\/p>\n<div>\n<pre>Add-Type -AssemblyName PresentationFramework\r\n$result = [System.Windows.MessageBox]::Show(\"Enable Dark Mode?\", \"Confirmation\", \"YesNoCancel\", \"Question\")\r\nif ($result -eq \"Yes\") {\r\n    Set-ItemProperty -Path HKCU:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize -Name AppsUsesLightTheme -Value 0 -Type Dword -Force\r\n    Set-ItemProperty -Path HKCU:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize -Name SystemUsesLightTheme -Value 0 -Type Dword -Force\r\n} elseif ($result -eq \"No\") {\r\n    Set-ItemProperty -Path HKCU:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize -Name AppsUsesLightTheme -Value 1 -Type Dword -Force\r\n    Set-ItemProperty -Path HKCU:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize -Name SystemUsesLightTheme -Value 1 -Type Dword -Force\r\n} else {\r\n    Write-Host \"canceled\"\r\n}\r\n# if changes does not take effect immediately, either click \"Start\" button, or add this line below: taskkill \/f \/im explorer.exe &amp;&amp; start explorer.exe<\/pre>\n<p>&nbsp;<\/p>\n<h3>==== Method 3 ====<\/h3>\n<p>Open : <span style=\"font-size: 16px;\"><strong>%LocalAppData%\\Microsoft\\Windows\\Themes<\/strong>\u00a0 , copy the file from there to desktop and name it &#8220;Darkmode&#8221;, and change the inside content(in Notepad) of &#8220;AppMode&#8221; and &#8220;SystemMode&#8221; from <strong>Dark<\/strong> ,\u00a0 then do similarly for <strong>Light. <\/strong>Finished! click any of the file on your desktop<\/span><\/p>\n<\/div>\n<div><\/div>\n<h3>==== Method 4 ====<\/h3>\n<div><a href=\"https:\/\/stackoverflow.com\/questions\/546818\/how-do-i-change-the-current-windows-theme-programmatically\">How do I change the current Windows theme programmatically? &#8211; Stack Overflow<\/a><\/div>\n<p>&nbsp;<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<div class=\"default-content-clss excerpt_5727 type_post \"><p>There are several ways: ==== Method 1 ==== Right click on desktop, select New &gt; Shortcut &gt; type ms-settings:personalization-colors. Then open it anytime. NOTE: To sync VSCODE theme (dark\/light) to<a class=\"excerpt-read-more\" href=\"https:\/\/puvox.software\/blog\/programmatically-change-windows-theme-from-to-dark-light\/\">(Continue Reading)<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":5756,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[11],"tags":[],"class_list":["post-5727","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-windows-software"],"_links":{"self":[{"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/posts\/5727","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/comments?post=5727"}],"version-history":[{"count":10,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/posts\/5727\/revisions"}],"predecessor-version":[{"id":5738,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/posts\/5727\/revisions\/5738"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/media\/5756"}],"wp:attachment":[{"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/media?parent=5727"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/categories?post=5727"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/tags?post=5727"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}