Skip to content

Commit 8fec47b

Browse files
authored
Fix: Switch code highlighting theme to min-light/min-dark (#1815)
- Change the code highlighting theme from github-light/github-dark to min-light/min-dark - Add global text selection style with a blue background (rgb(191 219 254 / 0.8))
1 parent 8a9d3eb commit 8fec47b

File tree

5 files changed

+30
-19
lines changed

5 files changed

+30
-19
lines changed

moon/apps/web/components/CodeView/BlobView/BlobEditor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ export default function BlobEditor({ fileContent, filePath, fileName, onCancel }
214214
<FileDiff
215215
fileDiff={fileDiffMetadata}
216216
options={{
217-
theme: { dark: 'github-dark', light: 'github-light' },
217+
theme: { dark: 'min-dark', light: 'min-light' },
218218
diffStyle: 'split',
219219
diffIndicators: 'classic',
220220
overflow: 'wrap',

moon/apps/web/components/CodeView/BlobView/CodeContent.module.css

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,12 @@
6767
background-color: rgb(61, 19, 0);
6868
}
6969

70-
.codeContainer :global(*::selection),
71-
.blameContainer :global(*::selection),
72-
.previewContainer :global(*::selection) {
73-
background-color: #0969da;
74-
color: #fff;
70+
.blameContainer span::selection,
71+
.codeContainer span::selection {
72+
color: inherit;
73+
}
74+
75+
.blameContainer span::-moz-selection,
76+
.codeContainer span::-moz-selection {
77+
color: inherit;
7578
}

moon/apps/web/components/CodeView/BlobView/CodeContent.tsx

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ const CodeContent = ({
144144
setIsShikiLoading(true)
145145
codeToTokens(fileContent, {
146146
lang: detectedLanguage as any,
147-
theme: 'github-light'
147+
theme: 'min-light'
148148
})
149149
.then((result) => {
150150
if (!cancelled) {
@@ -405,7 +405,7 @@ const CodeContent = ({
405405
try {
406406
const result = await codeToTokens(blockContent, {
407407
lang: detectedLanguage as any,
408-
theme: 'github-light'
408+
theme: 'min-light'
409409
})
410410

411411
return { block, tokens: result.tokens }
@@ -603,16 +603,15 @@ const CodeContent = ({
603603
{line.lineNumber}
604604
</div>
605605

606-
<div
607-
className='flex items-center py-1 pl-3 pr-4 font-mono text-sm'
608-
style={{ whiteSpace: 'pre' }}
609-
>
610-
{lineTokens.map((token, key) => (
611-
// eslint-disable-next-line react/no-array-index-key
612-
<span key={key} style={{ color: token.color, display: 'inline' }}>
613-
{token.content}
614-
</span>
615-
))}
606+
<div className='py-1 pl-3 pr-4 font-mono text-sm' style={{ whiteSpace: 'pre' }}>
607+
<span style={{ display: 'inline' }}>
608+
{lineTokens.map((token, key) => (
609+
// eslint-disable-next-line react/no-array-index-key
610+
<span key={key} style={{ color: token.color, display: 'inline' }}>
611+
{token.content}
612+
</span>
613+
))}
614+
</span>
616615
</div>
617616
</div>
618617
)

moon/apps/web/components/DiffView/FileDiff.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export default function FileDiff({
133133
<PierreFileDiff
134134
fileDiff={fileDiffMetadata}
135135
options={{
136-
theme: { dark: 'github-dark', light: 'github-light' },
136+
theme: { dark: 'min-dark', light: 'min-light' },
137137
diffStyle: 'unified',
138138
diffIndicators: 'classic',
139139
overflow: 'wrap',

moon/apps/web/styles/global.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ html {
2525
scrollbar-color: var(--scrollbar-color) transparent;
2626
}
2727

28+
/* Global text selection color */
29+
*::selection {
30+
background-color: rgb(191 219 254 / 0.8);
31+
}
32+
33+
*::-moz-selection {
34+
background-color: rgb(191 219 254 / 0.8);
35+
}
36+
2837
#__next {
2938
/* @apply isolate flex h-full min-h-[100svh] flex-1 flex-col overflow-auto; */
3039
/*@apply isolate flex min-h-[100svh] flex-1 flex-col overflow-auto;*/

0 commit comments

Comments
 (0)