-1

I would like to change address bar color for the site, which is built with Gatsby.js.

All I came up with was the modification of the "siteMetadata" section in "gatsby-config.js". Does it make any sense?enter image description here

Pawel
  • 78
  • 9
  • Can you provide a minimal, reproducible example please?? https://stackoverflow.com/help/minimal-reproducible-example – Maestro Jul 15 '20 at 12:17

1 Answers1

2

You can change the color on mobile Android using the meta tag theme-color in the head of your page, e.g.

<meta name="theme-color" content="#123456">

See https://stackoverflow.com/a/33193739/1247853 for a more in-detail discussion about other browsers.

If you are using the gatsby-starter-blog or the gatsby-starter-default you can set this meta tag in gatsby-config.js:

    {
      resolve: `gatsby-plugin-manifest`,
      options: {
        ...
        theme_color: `#123456`,
        ...
      },

If you are not using these starters, you can use React Helmet. Install it by following the instructions on https://www.gatsbyjs.org/docs/add-page-metadata/ , then place the following code somewhere that is executed on every page, e.g. in src/components/layout.js

  import { Helmet } from "react-helmet"

  return (
    <Helmet
      meta={[
        {
          name: `theme-color`,
          content: '#123456',
        },
      ]}>
   // ... rest of the page ...
   </Helmet>
 )
ehrencrona
  • 6,102
  • 1
  • 18
  • 24