【问题标题】:Designing a Chrome theme, what's going wrong?设计一个 Chrome 主题,出了什么问题?
【发布时间】:2013-02-23 03:53:48
【问题描述】:

(所以,我是一名平面设计师/艺术家,对任何类型的代码或脚本都不熟悉。)

在我的 Chrome 主题代码中,出现错误:

“无法从 'E:\Web\dev\theme\dev\Test' 加载扩展。清单不是有效的 JSON。行:7,列:4,语法错误。”

我不知道我哪里出错了,因为指定的语法错误在空格处,如下代码示例所示:

    {
      "manifest_version": 2,
      "version": 2.0
      "name": "Test",
        "theme": {
          "images" : {
          "theme_frame" : "images/frame.png",
          "theme_toolbar" : "images/toolbar.png",
          "theme_ntp_background" : "images/polygons.png",
          "theme_tab_background" : "images/tab.png",
          "theme_ntp_attribution" : "images/theme_ntp_attribution.png"
        },
        "colors" : {
            "ntp_link": [255,255,255],
        "ntp_text": [255,255,255],
        "ntp_section_link": [255,255,255],
        "ntp_section_text": [10 , 17 , 27],
        "ntp_background": [10 , 17 , 27],
        "frame": [10 , 17 , 27],
        "toolbar": [10 , 17 , 27],
        "tab_text": [255,255,255],
        "tab_background_text": [10 , 17 , 27],
        "bookmark_text": [255,255,255]
        },
        "tints" : {
                    "buttons" : [0.33, 0.5, 0.47]
        },
        "properties" : {
            "ntp_background_alignment" : "bottom",
        "ntp_background_repeat": "no-repeat"
        }
      }
    }

那么,哪里出了问题?

【问题讨论】:

    标签: json google-chrome-extension manifest google-chrome-theme


    【解决方案1】:

    你忘了把逗号放在一行

    "version": 2.0
    

    顺便说一句,您可以使用JSONLint 来验证 JSON。

    【讨论】:

    • @peter 所以,我添加了逗号,但现在错误消息显示: > 无法从 'E:\Web\dev\theme\dev\Test' 加载扩展。必需的值'版本丢失或无效。它必须是 1-4 个点分隔的整数,每个整数介于 0 和 65536 之间(这是当前状态):{ "manifest_version": 2, "version": 2.0, "name": "Test", etc
    • 尝试将 2.0 用引号括起来。
    猜你喜欢
    • 1970-01-01
    • 2017-12-14
    • 2022-11-30
    • 1970-01-01
    • 2018-07-19
    • 1970-01-01
    • 2021-09-07
    • 2021-06-19
    • 1970-01-01
    相关资源
    最近更新 更多