code.scss 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. /* https://github.com/antfu/prism-theme-vars */
  2. @use 'prism-theme-vars/base.css';
  3. @use 'prism-theme-vars/marker.css';
  4. [class*='language-']:before {
  5. font-family: var(--code-font-family);
  6. }
  7. span[class~='language-css']:before {
  8. content: '';
  9. }
  10. :root {
  11. --prism-marker-opacity: 0.6;
  12. --prism-marker-color: var(--code-text-color);
  13. --prism-line-height: var(--code-line-height);
  14. }
  15. html:not(.dark) {
  16. --prism-builtin: #3182bd;
  17. --prism-comment: #848486;
  18. --prism-deleted: #3182bd;
  19. --prism-function: #6196cc;
  20. --prism-boolean: #c25205;
  21. --prism-number: #c25205;
  22. --prism-property: #717c11;
  23. --prism-punctuation: #a8a9cc;
  24. --prism-keyword: #c792ea;
  25. --prism-variable: #0b8235;
  26. --prism-url-decoration: #67cdcc;
  27. --prism-symbol: green;
  28. --prism-selector: #0b8235;
  29. }
  30. html.dark {
  31. --prism-scheme: dark;
  32. --prism-foreground: #a6accd;
  33. --prism-background: #181818;
  34. --prism-comment: #758575;
  35. --prism-string: #c3e88d;
  36. --prism-literal: #429988;
  37. --prism-keyword: #89ddff;
  38. --prism-boolean: #6394bf;
  39. --prism-number: #6394bf;
  40. --prism-variable: #c2b36e;
  41. --prism-function: #82aaff;
  42. --prism-deleted: #bc6066;
  43. --prism-class: #54b1bf;
  44. --prism-builtin: var(--el-color-primary-light-3);
  45. --prism-property: #c792ea;
  46. --prism-namespace: #db889a;
  47. --prism-punctuation: #89ddff;
  48. --prism-decorator: #bd8f8f;
  49. --prism-regex: #ab5e3f;
  50. --prism-json-property: #6b8b9e;
  51. --prism-line-number: #888888;
  52. --prism-line-number-gutter: #eeeeee;
  53. --prism-line-highlight-background: #444444;
  54. --prism-selection-background: #444444;
  55. --prism-inline-background: #2d2d2d;
  56. }
  57. code {
  58. margin: 0;
  59. border-radius: 4px;
  60. padding: 0.15rem 0.5rem;
  61. font-family: var(--code-font-family);
  62. font-size: var(--code-font-size);
  63. color: var(--code-text-color);
  64. line-height: var(--code-line-height);
  65. background-color: var(--code-bg-color);
  66. }
  67. pre {
  68. code {
  69. background-color: transparent;
  70. }
  71. }
  72. a > code {
  73. color: var(--code-link-color);
  74. }
  75. code .token.deleted {
  76. color: #ec5975;
  77. }
  78. code .token.inserted {
  79. color: var(--c-brand);
  80. }
  81. div[class*='language-'] {
  82. position: relative;
  83. margin: 1rem -1.5rem;
  84. background-color: var(--code-bg-color);
  85. overflow-x: auto;
  86. }
  87. li > div[class*='language-'] {
  88. border-radius: 6px 0 0 6px;
  89. margin: 1rem -1.5rem 1rem -1.25rem;
  90. }
  91. @media (min-width: 420px) {
  92. div[class*='language-'] {
  93. margin: 1rem 0;
  94. border-radius: 6px;
  95. }
  96. li > div[class*='language-'] {
  97. margin: 1rem 0 1rem 0;
  98. border-radius: 6px;
  99. }
  100. }
  101. [class*='language-'] pre,
  102. [class*='language-'] code {
  103. text-align: left;
  104. white-space: pre;
  105. word-spacing: normal;
  106. word-break: normal;
  107. word-wrap: normal;
  108. tab-size: 4;
  109. hyphens: none;
  110. }
  111. [class*='language-'] pre {
  112. position: relative;
  113. z-index: 1;
  114. margin: 0;
  115. padding: 0.25rem;
  116. background: transparent;
  117. overflow-x: auto;
  118. }
  119. [class*='language-'] code {
  120. padding: 0;
  121. line-height: var(--code-line-height);
  122. font-size: var(--code-font-size);
  123. color: var(--code-text-color);
  124. }
  125. /* Line highlighting */
  126. .highlight-lines {
  127. position: absolute;
  128. top: 0;
  129. bottom: 0;
  130. left: 0;
  131. padding: 1.25rem 0;
  132. width: 100%;
  133. line-height: var(--code-line-height);
  134. font-family: var(--code-font-family);
  135. font-size: var(--code-font-size);
  136. user-select: none;
  137. overflow: hidden;
  138. }
  139. .highlight-lines .highlighted {
  140. background-color: rgba(0, 0, 0, 0.66);
  141. }
  142. /* Line numbers mode */
  143. div[class*='language-'].line-numbers-mode {
  144. padding-left: 3.5rem;
  145. }
  146. .line-numbers-wrapper {
  147. position: absolute;
  148. top: 0;
  149. bottom: 0;
  150. left: 0;
  151. z-index: 3;
  152. border-right: 1px solid var(--el-overlay-color-lighter);
  153. padding: 1.25rem 0;
  154. width: 3.5rem;
  155. text-align: center;
  156. line-height: var(--code-line-height);
  157. font-family: var(--code-font-family);
  158. font-size: var(--code-font-size);
  159. color: #888;
  160. }