附录A 制作Chrome主题

优质
小牛编辑
134浏览
2023-12-01

Chrome主题与扩展和应用的结构类似,包含一个Manifest文件和一些图片资源。主题的Manifest结构如下:

{
    "version": "2.6",
    "name": "camo theme",
    "theme": {
        "images" : {
            "theme_frame" : "images/theme_frame_camo.png",
            "theme_frame_overlay" : "images/theme_frame_stripe.png",
            "theme_toolbar" : "images/theme_toolbar_camo.png",
            "theme_ntp_background" : "images/theme_ntp_background_norepeat.png",
            "theme_ntp_attribution" : "images/attribution.png"
        },
        "colors" : {
            "frame" : [71, 105, 91],
            "toolbar" : [207, 221, 192],
            "ntp_text" : [20, 40, 0],
            "ntp_link" : [36, 70, 0],
            "ntp_section" : [207, 221, 192],
            "button_background" : [255, 255, 255]
        },
        "tints" : {
            "buttons" : [0.33, 0.5, 0.47]
        },
        "properties" : {
            "ntp_background_alignment" : "bottom"
        }
    }
}

颜色使用RGB格式,即[r, g, b]。图片路径使用基于主题包根路径的相对路径。properties定义了图片的位置和repeat属性。tints定义了按钮、框架和后台标签页等某些部分的色调,使用HSL格式,取值范围为0到1的浮点型数据。

更详细的内容可以参见https://code.google.com/p/chromium/wiki/ThemeCreationGuide