var.scss 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // CSS3 var
  2. @use 'common/var' as *;
  3. @use 'mixins/var' as *;
  4. @use 'mixins/mixins' as *;
  5. // for better performance do not dynamically change the root variable if you really
  6. // do not need that, since this could introduce recalculation overhead for rendering.
  7. // https://lisilinhart.info/posts/css-variables-performance/
  8. // common
  9. :root {
  10. @include set-css-var-value('color-white', $color-white);
  11. @include set-css-var-value('color-black', $color-black);
  12. // get rgb
  13. @each $type in (primary, success, warning, danger, error, info) {
  14. @include set-css-color-rgb($type);
  15. }
  16. // Typography
  17. @include set-component-css-var('font-size', $font-size);
  18. @include set-component-css-var('font-family', $font-family);
  19. @include set-css-var-value('font-weight-primary', 500);
  20. @include set-css-var-value('font-line-height-primary', 24px);
  21. // z-index --el-index-#{$type}
  22. @include set-component-css-var('index', $z-index);
  23. // --el-border-radius-#{$type}
  24. @include set-component-css-var('border-radius', $border-radius);
  25. // Transition
  26. // refer to this website to get the bezier motion function detail
  27. // https://cubic-bezier.com/#p1,p2,p3,p4 (change px as your function parameter)
  28. @include set-component-css-var('transition-duration', $transition-duration);
  29. @include set-component-css-var('transition-function', $transition-function);
  30. @include set-component-css-var('transition', $transition);
  31. // common component size
  32. @include set-component-css-var('component-size', $common-component-size);
  33. }
  34. // for light
  35. :root {
  36. color-scheme: light;
  37. // --el-color-#{$type}
  38. // --el-color-#{$type}-light-{$i}
  39. @each $type in (primary, success, warning, danger, error, info) {
  40. @include set-css-color-type($colors, $type);
  41. }
  42. // color-scheme
  43. // Background --el-bg-color-#{$type}
  44. @include set-component-css-var('bg-color', $bg-color);
  45. // --el-text-color-#{$type}
  46. @include set-component-css-var('text-color', $text-color);
  47. // --el-border-color-#{$type}
  48. @include set-component-css-var('border-color', $border-color);
  49. // Fill --el-fill-color-#{$type}
  50. @include set-component-css-var('fill-color', $fill-color);
  51. // Box-shadow
  52. // --el-box-shadow-#{$type}
  53. @include set-component-css-var('box-shadow', $box-shadow);
  54. // Disable base
  55. @include set-component-css-var('disabled', $disabled);
  56. // overlay & mask
  57. @include set-component-css-var('overlay-color', $overlay-color);
  58. @include set-component-css-var('mask-color', $mask-color);
  59. // Border
  60. @include set-css-var-value('border-width', $border-width);
  61. @include set-css-var-value('border-style', $border-style);
  62. @include set-css-var-value('border-color-hover', $border-color-hover);
  63. @include set-css-var-value(
  64. 'border',
  65. getCssVar('border-width') getCssVar('border-style')
  66. getCssVar('border-color')
  67. );
  68. // Svg
  69. @include css-var-from-global('svg-monochrome-grey', 'border-color');
  70. }