清单主题/背景颜色

时间:2017-12-30 11:25:52

标签: manifest manifest.json

在我的manifest.json文件中,我设置了主题颜色和背景颜色

{
    "name": "Friends",
    "short_name": "Friends",
    "icons": [
        {
            "src": "/src/images/icons/friends-b-icon-48x48.png",
            "type": "image/png",
            "sizes": "48x48"
    },
        {
            "src": "/src/images/icons/friends-b-icon-144x144.png",
            "type": "image/png",
            "sizes": "144x144"
    },
        {
            "src": "/src/images/icons/friends-b-icon-256x256.png",
            "type": "image/png",
            "sizes": "256x256"
    },
        {
            "src": "/src/images/icons/friends-b-icon-512x512.png",
            "type": "image/png",
            "sizes": "512x512"
    }

  ],
    "start_url": "/index.html",
    "scope": ".",
    "display": "standalone",
    "orientation": "portrait-primary",
    "background-color": "#795548",
    "theme-color": "#795548",
    "description": "Share your moments with your friends",
    "dir": "ltr",
    "lang": "en-US"
}

但是当我看到Chrome时,它们已经消失了 enter image description here

有谁知道如何解决这个问题? 提前谢谢!

1 个答案:

答案 0 :(得分:2)

manifest.json中,属性的名称使用_作为分隔符,而不是-。 您必须将background-color更改为background_color,将theme-color更改为theme_color