-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfe-highlight.css
More file actions
189 lines (170 loc) · 6.07 KB
/
fe-highlight.css
File metadata and controls
189 lines (170 loc) · 6.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/* Fe syntax highlighting — CSS custom properties define all colors.
Default: Catppuccin Mocha (dark). Light override via prefers-color-scheme
or data-theme="light". Host pages can override any --fe-* variable. */
/* ============================================================================
Color variables
============================================================================ */
/* Default: Catppuccin Mocha (dark) */
:root {
--fe-hl-keyword: #cba6f7;
--fe-hl-variable-builtin: #94e2d5;
--fe-hl-type: #f9e2af;
--fe-hl-type-interface: #cba6f7;
--fe-hl-type-variant: #f9e2af;
--fe-hl-function: #89b4fa;
--fe-hl-string: #a6e3a1;
--fe-hl-string-escape: #94e2d5;
--fe-hl-number: #94e2d5;
--fe-hl-comment: #6c7086;
--fe-hl-operator: #94e2d5;
--fe-hl-variable: #a6e3a1;
--fe-hl-attribute: #cba6f7;
--fe-hl-constant: #94e2d5;
--fe-hl-punctuation: #6c7086;
--fe-code-bg: #1e1e2e;
--fe-code-border: #313244;
--fe-code-text: #cdd6f4;
--fe-code-line-number: #6c7086;
--fe-code-font: "JetBrains Mono", "Fira Code", monospace;
--fe-code-size: 0.8rem;
--fe-code-line-height: 1.6;
--fe-code-radius: 6px;
}
/* Light override: Catppuccin Latte — via OS preference */
@media (prefers-color-scheme: light) {
:root:not([data-theme="dark"]) {
--fe-hl-keyword: #7c3aed;
--fe-hl-variable-builtin: #0891b2;
--fe-hl-type: #b08800;
--fe-hl-type-interface: #7c3aed;
--fe-hl-type-variant: #b08800;
--fe-hl-function: #2563eb;
--fe-hl-string: #16a34a;
--fe-hl-string-escape: #0d9488;
--fe-hl-number: #0891b2;
--fe-hl-comment: #9ca0b0;
--fe-hl-operator: #0891b2;
--fe-hl-variable: #0d9488;
--fe-hl-attribute: #7c3aed;
--fe-hl-constant: #0891b2;
--fe-hl-punctuation: #6b7280;
--fe-code-bg: #eff1f5;
--fe-code-border: #ccd0da;
--fe-code-text: #4c4f69;
--fe-code-line-number: #9ca0b0;
}
}
/* Light override: explicit toggle */
:root[data-theme="light"] {
--fe-hl-keyword: #7c3aed;
--fe-hl-variable-builtin: #0891b2;
--fe-hl-type: #b08800;
--fe-hl-type-interface: #7c3aed;
--fe-hl-type-variant: #b08800;
--fe-hl-function: #2563eb;
--fe-hl-string: #16a34a;
--fe-hl-string-escape: #0d9488;
--fe-hl-number: #0891b2;
--fe-hl-comment: #9ca0b0;
--fe-hl-operator: #0891b2;
--fe-hl-variable: #0d9488;
--fe-hl-attribute: #7c3aed;
--fe-hl-constant: #0891b2;
--fe-hl-punctuation: #6b7280;
--fe-code-bg: #eff1f5;
--fe-code-border: #ccd0da;
--fe-code-text: #4c4f69;
--fe-code-line-number: #9ca0b0;
}
/* ============================================================================
Syntax highlight rules — read variables, no fallbacks
============================================================================ */
.hl-keyword { color: var(--fe-hl-keyword); }
.hl-variable-builtin { color: var(--fe-hl-variable-builtin); font-style: italic; }
.hl-type, .hl-type-builtin { color: var(--fe-hl-type); }
.hl-type-interface { color: var(--fe-hl-type-interface); }
.hl-type-enum-variant { color: var(--fe-hl-type-variant); }
.hl-function, .hl-function-definition, .hl-function-method { color: var(--fe-hl-function); }
.hl-string { color: var(--fe-hl-string); }
.hl-string-escape { color: var(--fe-hl-string-escape); }
.hl-number { color: var(--fe-hl-number); }
.hl-comment, .hl-comment-doc { color: var(--fe-hl-comment); font-style: italic; }
.hl-operator { color: var(--fe-hl-operator); }
.hl-property, .hl-variable-parameter { color: var(--fe-hl-variable); }
.hl-variable { color: var(--fe-hl-variable); }
.hl-attribute { color: var(--fe-hl-attribute); }
.hl-constant { color: var(--fe-hl-constant); font-weight: bold; }
.hl-punctuation-bracket, .hl-punctuation-delimiter, .hl-punctuation-special { color: var(--fe-hl-punctuation); }
/* SCIP symbol hover highlight transitions */
[class*="sym-"] {
transition: background 0.2s ease-out, text-decoration 0.2s ease-out,
text-decoration-color 0.2s ease-out;
}
/* ============================================================================
<fe-code-block> component layout
============================================================================ */
fe-code-block {
display: block;
margin: 1rem 0;
}
.fe-code-block-wrapper {
display: flex;
background: var(--fe-code-bg);
border: 1px solid var(--fe-code-border);
border-radius: var(--fe-code-radius);
overflow-x: auto;
max-width: 100%;
}
.member-header fe-code-block,
.code-header fe-code-block,
.implementor-sig fe-code-block {
margin: 0;
}
.member-header,
.code-header,
.implementor-sig {
--fe-code-border: transparent;
}
.fe-line-numbers {
display: flex;
flex-direction: column;
padding: 0.75rem 0.5rem;
border-right: 1px solid var(--fe-code-border);
text-align: right;
user-select: none;
color: var(--fe-code-line-number);
font-family: var(--fe-code-font);
font-size: var(--fe-code-size);
line-height: var(--fe-code-line-height);
-webkit-text-size-adjust: 100%;
text-size-adjust: 100%;
}
.fe-line-numbers span {
line-height: var(--fe-code-line-height);
}
.fe-code-pre {
flex: 1;
min-width: 0;
margin: 0;
padding: 0.75rem 1rem;
background: transparent;
overflow-x: auto;
font-family: var(--fe-code-font);
font-size: var(--fe-code-size);
line-height: var(--fe-code-line-height);
/* Prevent iOS Safari TextAutoSizing from inflating font-size in code blocks.
Without this, the algorithm selectively enlarges text in blocks whose
intrinsic width exceeds the viewport (timing-dependent on first load),
causing inconsistent sizes across code blocks with identical styles.
Using 100% (not none) preserves user zoom and accessibility settings. */
-webkit-text-size-adjust: 100%;
text-size-adjust: 100%;
}
.fe-code-pre code {
font-family: inherit;
font-size: inherit;
line-height: inherit;
color: var(--fe-code-text);
-webkit-text-size-adjust: 100%;
text-size-adjust: 100%;
}