Skip to content

Commit 7815333

Browse files
koddssonkeithamus
andcommitted
Mess around with the codemirror styles
Co-authored-by: Keith Cirkel <[email protected]>
1 parent 0f20089 commit 7815333

File tree

3 files changed

+72
-11
lines changed

3 files changed

+72
-11
lines changed

css/code-interactive.css

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,73 @@
11
:host {
2-
background-color: hotpink;
2+
background-color: var(--surface-2);
3+
display: block;
4+
border-radius: var(--radius-2);
5+
max-inline-size: 100ch;
6+
padding: var(--size-3);
7+
margin-block: var(--size-5);
8+
overflow-x: auto;
9+
color: var(--text-2);
10+
11+
--token-tag: var(--indigo-6);
12+
--token-attr-name: var(--pink-6);
13+
--token-attr-equals: var(--gray-6);
14+
--token-attr-value: var(--cyan-7);
15+
--token-selector: var(--indigo-6);
16+
--token-property: var(--pink-6);
17+
--token-punctuation: var(--gray-6);
18+
--token-keyword: var(--orange-6);
19+
--token-class-name: var(--indigo-6);
20+
--token-number: var(--green-6);
21+
--token-comment: var(--teal-6);
22+
--token-function: var(--pink-6);
23+
--token-string: var(--cyan-6);
24+
--token-template-string: var(--cyan-6);
25+
--token-interpolation: var(--gray-6);
26+
}
27+
28+
/* Dark syntax highlighting */
29+
@media (prefers-color-scheme: dark) {
30+
:host {
31+
color: var(--cyan-6);
32+
--token-punctuation: var(--indigo-2);
33+
--token-tag: var(--indigo-4);
34+
--token-attr-name: var(--pink-6);
35+
--token-attr-equals: var(--indigo-2);
36+
--token-attr-value: var(--cyan-6);
37+
--token-selector: var(--indigo-4);
38+
--token-property: var(--pink-6);
39+
}
40+
}
41+
42+
.ͼ1 .cm-scroller {
43+
font-family: var(--font-mono);
44+
}
45+
46+
.ͼf {
47+
color: var(--token-template-string);
48+
}
49+
50+
/* Shared tokens */
51+
.token.punctuation {
52+
color: var(--token-punctuation);
53+
}
54+
/* CSS tokens */
55+
.token.selector {
56+
color: var(--token-selector);
57+
}
58+
.token.property {
59+
color: var(--token-property);
60+
}
61+
/* HTML tokens */
62+
.token.tag {
63+
color: var(--token-tag);
64+
}
65+
.token.attr-name {
66+
color: var(--token-attr-name);
67+
}
68+
.token.attr-value {
69+
color: var(--token-attr-value);
70+
}
71+
.token.attr-equals {
72+
color: var(--token-attr-equals);
373
}

css/global.css

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -346,15 +346,6 @@ page-search {
346346
}
347347
}
348348

349-
pre[class^="language-"] {
350-
background: var(--surface-2);
351-
border-radius: var(--radius-2);
352-
max-inline-size: 100ch;
353-
padding: var(--size-3);
354-
margin-block: var(--size-5);
355-
overflow-x: auto;
356-
}
357-
358349
.surface {
359350
box-shadow: var(--shadow-4);
360351
border-radius: var(--radius-3);

script/codemirror.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class CodeInteractiveElement extends HTMLElement {
7070
})
7171

7272
connectedCallback() {
73-
this.shadowRoot.adoptedStyleSheets = [styles]
73+
this.shadowRoot.adoptedStyleSheets.push(styles)
7474
}
7575
}
7676

0 commit comments

Comments
 (0)