| 在Chrome中,主題當(dāng)做一個特殊的插件處理。主題要像普通文件一樣打包,但是主題中不包含HTML或者JavaScript代碼。 你可以在主題庫里找到一些主題下載。 下面只是簡單介紹下主題制作,詳細(xì)的內(nèi)容可以參考http://code.google.com/p/chromium/wiki/ThemeCreationGuide 
 主題是在Manifest文件中定義的。下面是個定義主題的典型例子: 
            
            復(fù)制代碼
                {
  "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"
    }
  }
} 我們看到在theme類下有幾個元素,分為為images、colors、tints、properties。下面分別介紹他們。 
 colors 用來定義基本顏色。顏色需要用RGB格式表示,你可以在browser_theme_provider.cc查看到底可以定義哪些內(nèi)容。 
 images 圖片需要用相對地址引用,你設(shè)置browser_theme_provider.cc文件中kThemeableImages數(shù)組的所有元素。去掉IDR_并且轉(zhuǎn)化成小寫格式后就是你需要設(shè)置的東西,比如IDR_THEME_NTP_BACKGROUND 需要轉(zhuǎn)化為theme_ntp_background。 
 properties 這個地方用來定義諸如背景定位方式、背景重復(fù)等屬性。browser_theme_provider.cc里面可以看到有哪些屬性可以定義。 
 tints 你可以給部分UI著色,比如按鈕、框架、背景tab標(biāo)簽。(這里翻譯可能有問題,chromechina注) 原文 http://code.google.com/chrome/extensions/themes.html由ChromeChina翻譯,轉(zhuǎn)載注明出處http://dev./ |