何为 Design Token (设计语义)

Design Token 是设计工程化视角的产物,也是设计与前端之间共用的语言。

使用 Design Token 可长期维护产品的视觉体系,在一套设计系统中它具备统一命名规则;它本质上通过 Token的方式定义设计系统中的设计原子,如颜色、投影、字体、字号等的寓意,使其与具体的样式值解耦;比如设计师设计的产品品牌色为 #008aff,Token 为 Brand1,当产品风格需要迭代时只需要修改一次 Brand1 的对应变量色值即可实现整套产品的UI迭代;对 Design Token 合理的定义可以让属性参数更容易理解,也更便于对产品风格的控制,保证实际设计中的视觉一致性和扩展性。

在实际设计与标注过程中,理论上产品设计中的所有样式需要取至 Design Token,设计标准过程中应该使用Design Token 进行标注与前端开发。

  1. //Font Family
  2. $font-family-01: Roboto, sans-serif;
  3. //Font Size
  4. $font-size-01: 62px;
  5. $font-size-02: 48px;
  6. $font-size-03: 32px;
  7. $font-size-04: 24px;
  8. $font-size-05: 16px;
  9. $font-size-06: 14px;
  10. $font-size-07: 12px;
  11. //Line Height
  12. $line-height-01: 1;
  13. $line-height-02: 1.5;
  14. //Font Weight
  15. $font-weight-01: normal;
  16. $font-weight-02: medium;
  17. $font-weight-03: bold;
  18. //Letter Spacing
  19. $letter-spacing-01: -1;
  20. $letter-spacing-02: 0;
  21. $letter-spacing-03: 1;
  22. //Brand Colors
  23. $color-primary: #000;
  24. $color-secundary: #fff;
  25. //Media Query
  26. $media-query-01: 576px;
  27. $media-query-02: 768px;
  28. $media-query-03: 992px;
  29. $media-query-04: 1200px;
  30. //Sizes
  31. $size-01: 4px;
  32. $size-01: 8px;
  33. $size-01: 16px;
  34. $size-01: 24px;
  35. $size-01: 32px;
  36. $size-01: 64px;
  37. //Box Shadow
  38. $box-shadow-01: 4px 0 8px 0 rgba(0,0,0,.16);
  39. $box-shadow-02: 8px 0 16px 0 rgba(0,0,0,.16);
  40. $box-shadow-03: 16px 0 24px 0 rgba(0,0,0,.16);
  41. //Border Width
  42. $border-01: 1px;
  43. $border-02: 2px;
  44. $border-03: 4px;
  45. //Border Radius
  46. $border-radius-01: 4px;
  47. $border-radius-02: 50%;
  48. $border-radius-03: 500px;
  49. //Icon Size
  50. $icon-size-01: 16px;
  51. $icon-size-02: 24px;
  52. $icon-size-03: 46px;
  53. //Opacity
  54. $opacity-01: .1;
  55. $opacity-02: .4;
  56. $opacity-03: .6;
  57. $opacity-04: .8;