Upgrade to Pro — share decks privately, control downloads, hide ads and more …

社交网站换肤机制

Avatar for tyson tyson
November 18, 2013

 社交网站换肤机制

《第七届Webrebuild年会》分享主题

Avatar for tyson

tyson

November 18, 2013

Other Decks in Technology

Transcript

  1. • 潘泰 燊 Tyson • 腾讯ISUX • Qzone 平 重构工程

    师 • 闷骚 男 • 技 术 宅 • http://tyson.im
  2. 增 强体验 http://www.hao123.com/ • 网站 换肤,即 不改 变网页DOM结 构的前提 ,通

    过 切 换样式 ,改 变网页中的文字色、线条色、背 景色 图标色、或者背景图片, 从而达到更 换网站整体的主题风 格
  3. 书写风格——颜色专用类 /* 链接色 */ .c_tx {color : blue} /* 强

    文本色 */ .c_tx2 {color : black} /* 弱文本色 */ .c_tx3 {color : gray} /* 背景色 */ .bg {background-color : white} <article class=“blog bg”> <h2 class=“title c_tx2”> 文章 标题 </h2> <p class=“content c_tx3”> 文章内容 <a class=“c_tx”>链接</a> </p> </article> • 典型案例:
  4. 书写风格—— 非 颜色专用类 /* 日志 */ .blog {background- color :

    white} /* 日志 标题 */ .title {color : black} /* 日志内容 */ .content {color : gray} /* 链接 */ .link {color : blue} <article class=“blog”> <h2 class=“title”> 文章 标题 </h2> <p class=“content”> 文章内容 <a class=“link”>链接</a> </p> </article> • 典型案例:
  5. 对比分析 0 2 4 6 8 专 用 类 非

    专 用 类 CSS HTML 0 2 4 6 8 专 用 类 非 专 用 类 CSS HTML 代 码 体 积 代 码 体 积 DOM 重复 较多 DOM 重复 较少 • 非 专用类的 写法会使 html 代 码量减少 , css 代 码量增多
  6. 腾讯式开发流程 设计师 重构工程 师 前 开 发 专 用 类

    维护HTML 非 专用类 维护CSS • 非 专用类的 开 发模式 更加敏捷
  7. 镂空Icon 技 术 <i class="icon icon1"></i><a href="##" class="link"> 回复 </a>

    <i class="icon icon2"></i><a href="##" class="link">转 </a> <i class="icon icon3"></i><a href="##" class="link"> 收藏 </a> <i class="icon icon4"></i><a href="##" class="link"> 更多 </a> .icon { display: inline-block; width: 16px; height: 20px; background-image: url(sprite_icons.png); background-color: #34538b; /* 该颜色 制图标的颜色 */ } .icon1 { background-position: 0 0; } .icon2 { background-position: -20px 0; } .icon3 { background-position: -40px 0; } .icon4 { background-position: -60px 0; }
  8. Font-icon 技 术—— 使用方法 @font-face { font-family: 'FontIcon'; src: url('font/webfont.eot');

    src: url('font/webfont.eot?#iefix') format('embedded-opentype'), url('font/webfont.woff') format('woff'), url('font/webfont.ttf') format('truetype'), url('font/webfont.svg#Guifxv2TransportsRegular') format('svg'); font-weight: normal; font-style: normal; } .font-icon { font-family: 'FontIcon'; } <i class=“font-icon">A</i>
  9. Font-icon 技 术—— 使用方法 @font-face { font-family: 'FontAwesome'; src: url('font/fontawesome-webfont.eot');

    src: url('font/fontawesome-webfont.eot?#iefix') format('embedded-opentype'), url('font/fontawesome-webfont.woff') format('woff'), url('font/fontawesome-webfont.ttf') format('truetype'), url('font/fontawesome-webfont.svg #FontAwesomeRegular') format('svg'); font-weight: normal; font-style: normal; } [class^="icon-"]:before, [class*=" icon-"]:before { font-family: FontAwesome; font-weight: normal; font-style: normal; display: inline-block; text-decoration: inherit; } .icon-glass:before { content: "\f000" } .icon-music:before { content: "\f001" } .icon-search:before { content: "\f002" } .icon-envelope:before { content: "\f003 } <i class=“icon-glass"></i>
  10. Font-icon 技 术——Chrome优化效果 src: url('font/webfont.eot'); src: url('font/webfont.eot?#iefix') format('embedded-opentype'), url('font/webfont.woff') format('woff'),

    url('font/webfont.ttf') format('truetype'), url('font/webfont.svg') format('svg'); src: url('font/webfont.eot'); src: url('font/webfont.eot?#iefix') format('embedded-opentype'), url('font/webfont.svg') format('svg'); url('font/webfont.woff') format('woff'), url('font/webfont.ttf') format('truetype'),
  11. 多 图片技术 1 个 Icon = 6 种 规格 *

    18 套配色 = 108 个文件
  12. 种方案 综合对比 多 图片 Font-icon 镂空icon 自由控制 颜色 X √

    √ 图标高保真 √ X √ 适 应不同背景 √ √ X 图标多色彩 √ X X 网站案例 缺点 文件超多 制作麻 烦 背景固定
  13. Qzone V5时代—— 手 动 • 设计稿PS 取色 • 手工 维护31

    套配色 样式 配色设计稿 PS取色 手工写颜色 重复 35 次 重复 31 次
  14. Qzone V6时代—— 半自 动 • 设计稿canvas 取色 • 数据表格化管理 •

    皮肤 1toN 配色设计稿 Canvas取色 数据表 重复 21 次 皮肤1toN
  15. 不断超越,精益求精 1085 43 2 0 200 400 600 800 1000

    1200 Qzone V5 Qzone V6 Qzone V8 操 作 次 数 颜色 跟肤 皮肤 1toN 图标跟肤