{"id":41752,"date":"2024-11-16T03:44:27","date_gmt":"2024-11-16T01:44:27","guid":{"rendered":"https:\/\/coma.lv\/2024\/11\/16\/how-to-change-the-address-bar-color-in-a-mobile-browser\/"},"modified":"2024-11-16T03:44:27","modified_gmt":"2024-11-16T01:44:27","slug":"how-to-change-the-address-bar-color-in-a-mobile-browser","status":"publish","type":"post","link":"https:\/\/coma.lv\/en\/2024\/11\/16\/how-to-change-the-address-bar-color-in-a-mobile-browser\/","title":{"rendered":"How to Change the Address Bar Color in a Mobile Browser"},"content":{"rendered":"\n<p style=\"text-align: left;\">You have probably noticed that many popular sites such as the BBC and Facebook use their brand colors for the address bar in mobile browsers. In this article we will show you how you can achieve a similar effect.<\/p>\n<h2 style=\"text-align: left;\">Why Make the Address Bar Color Match Your Site in a Mobile Browser?<\/h2>\n<p style=\"text-align: left;\">Many WordPress themes support mobile devices. However, it still looks like just a website. Changing the address bar color creates the feeling that the person is using an app. All of this leads to a more pleasant user experience, sales and conversions.<\/p>\n<p style=\"text-align: left;\">Today this feature is supported in most modern Chromium-based mobile browsers, including Google Chrome, Edge, Brave, Opera and Samsung Internet. Browsers also support specifying different colors for light and dark mode, which lets the address bar automatically adapt to the user&#8217;s preferences.<\/p>\n<h2 style=\"text-align: left;\" data-start=\"1255\" data-end=\"1276\">How to Do It<\/h2>\n<p style=\"text-align: left;\">Just add the following code to the header.php file of your child theme right before the closing <em>&lt;\/head&gt;<\/em> tag.<\/p>\n<p style=\"text-align: left;\"><em>&lt;meta name=&#8221;theme-color&#8221; content=&#8221;#ff6600&#8243; \/&gt;<\/em><\/p>\n<p style=\"text-align: left;\">This line is an HTML meta tag that a mobile browser uses to change the color of the address bar.<\/p>\n<p style=\"text-align: left;\" data-start=\"1792\" data-end=\"1872\">If you want to support light and dark mode, you can add two lines:<\/p>\n<p style=\"text-align: left;\" data-start=\"1792\" data-end=\"1872\"><em>&lt;meta name=&#8221;theme-color&#8221; media=&#8221;(prefers-color-scheme: light)&#8221; content=&#8221;#ffffff&#8221;&gt;<\/em><br \/>\n<em>&lt;meta name=&#8221;theme-color&#8221; media=&#8221;(prefers-color-scheme: dark)&#8221; content=&#8221;#000000&#8243;&gt;<\/em><\/p>\n<p style=\"text-align: left;\">The content field holds the hex code of the color you want to use as the background. Not sure how to get this code? You can get it using any graphics editor such as Adobe Photoshop, Gimp, Paint and others.<\/p>\n<p style=\"text-align: left;\"><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/coma.lv\/wp-content\/uploads\/2016\/11\/colorpicker-photoshop.jpg\" alt=\"WordPress\" title=\"\"><\/p>\n<p style=\"text-align: left;\" data-start=\"1792\" data-end=\"1872\">You can also pick a color using online HTML color picker services or browser extensions such as ColorZilla to quickly get the hex code you need from any web page.<\/p>\n<p style=\"text-align: left;\" data-start=\"1792\" data-end=\"1872\">*This method does not work in iOS Safari, but if you are building a PWA (a progressive web app, that is, a website that behaves like an app on the device), you can change the status bar color with <em>&lt;meta name=&#8221;apple-mobile-web-app-status-bar-style&#8221;&gt;<\/em><\/p>\n<div class=\"contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary\" style=\"text-align: left;\">\n<div class=\"sticky top-9\">\n<div class=\"absolute end-0 bottom-0 flex h-9 items-center pe-2\">\n<div>\n<h2 data-start=\"2290\" data-end=\"2305\">WordPress<\/h2>\n<p data-start=\"2306\" data-end=\"2602\">Today many modern WordPress themes and plugins let you choose the address bar color through the theme settings interface, so manually editing header.php may not be necessary. If you prefer full control, the good old <em>&lt;meta&gt;<\/em> method still works perfectly.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr \/>\n<p style=\"text-align: left;\"><em>Our specialization is WordPress website development and maintenance. Contact us for a free consultation \u2014 <a href=\"mailto:vadim@coma.lv\">vadim@coma.lv<\/a>, <a href=\"tel:+37129394520\">+371 29394520<\/a><\/em><\/p>\n<hr \/>\n","protected":false},"excerpt":{"rendered":"<p>You have probably noticed that many popular sites such as the BBC and Facebook use their brand colors for the address bar in mobile browsers. In this article we will show you how you can achieve a similar effect. Why Make the Address Bar Color Match Your Site in a Mobile Browser? Many WordPress themes [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":38239,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1225,1406],"tags":[],"class_list":["post-41752","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","category-for-beginners"],"_links":{"self":[{"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/posts\/41752","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/comments?post=41752"}],"version-history":[{"count":0,"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/posts\/41752\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/media\/38239"}],"wp:attachment":[{"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/media?parent=41752"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/categories?post=41752"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/tags?post=41752"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}