chrome扩展开发之Themes(主题)

一个主题实际就是一个特殊的扩展,用来改变浏览器的外观,主题的打包方式和其他扩展一样,但是不包含html文件和javascript脚本。

你可以通过 themes gallery.来查找和试用主题。

Manifest 清单

这是一个主题例子的清单 manifest.json

  1. {  
  2.   "version""2.6",  
  3.   "name""camo theme",  
  4.   "theme": {  
  5.     "images" : {  
  6.       "theme_frame" : "images/theme_frame_camo.png",  
  7.       "theme_frame_overlay" : "images/theme_frame_stripe.png",  
  8.       "theme_toolbar" : "images/theme_toolbar_camo.png",  
  9.       "theme_ntp_background" : "images/theme_ntp_background_norepeat.png",  
  10.       "theme_ntp_attribution" : "images/attribution.png"  
  11.     },  
  12.     "colors" : {  
  13.       "frame" : [71, 105, 91],  
  14.       "toolbar" : [207, 221, 192],  
  15.       "ntp_text" : [20, 40, 0],  
  16.       "ntp_link" : [36, 70, 0],  
  17.       "ntp_section" : [207, 221, 192],  
  18.       "button_background" : [255, 255, 255]  
  19.     },  
  20.     "tints" : {  
  21.       "buttons" : [0.33, 0.5, 0.47]  
  22.     },  
  23.     "properties" : {  
  24.       "ntp_background_alignment" : "bottom"  
  25.     }  
  26.   }  
  27. }  

colors 颜色

颜色使用RGB格式,要查询所有colors字段相关的属性字符串,可以在browser_theme_provider.cc.文件中用“ kColor*”匹配查找。

images 图片

图片资源试用扩展所在根目录的相对路径。你可以覆盖browser_theme_provider.cc文件中由kThemeableImages 常量定义的任何图片。把“ IDR_”前缀去掉,然后转换为小写即可,例如,IDR_THEME_NTP_BACKGROUND转换后就是theme_ntp_background

properties 属性

这个字段可以让你指定一些属性如:背景,背景重复属性和替换标志;要查看所有属性和值,可以参考browser_theme_provider.cc.

tints 色彩

你可以为UI部件,如按钮,框架,背景标签增加色彩,但不支持使用图像,因为图像不跨平台,在增加新的按钮时变形。要查询所有tints字段相关的属性字符串,可以查找文件browser_theme_provider.cc.

色彩是色调,饱和度,亮度(HSL) 格式,使用0-1.0的浮点数表示。

色调是一个绝对值,为0和1
饱和度是相对于当前提供的图像而言,0.5表示无改变,0表示全部褪色,1表示完全饱和
亮度也是相对的值,0.5表示无改变,0表示全黑,1表示全白

或者你可以用 -1.0来表示不改变任何色彩值。

 

你可能感兴趣的:(JavaScript,json,UI,框架,chrome)