Skip to content

Commit a9a9ca3

Browse files
committed
fix(galley): inject syntax theme as high-specificity stylesheet
Tailwind arbitrary-variant overrides weren't winning against prose for the base code color, and SyntaxHighlighter's inline theme styles were being shadowed by .prose code in the cascade. Move the token color table into the page-level <style> block keyed by .galley-body code[class*='language-'] with !important, which has higher specificity than both and zero ambiguity. Reset text-shadow too so prism themes can't bleed back through.
1 parent 2ea6749 commit a9a9ca3

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

src/pages/blog-views/GalleyBlogPostPage.jsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,44 @@ const GalleyBlogPostPage = () => {
505505
line-height: 1;
506506
font-style: normal;
507507
}
508+
509+
/* syntax theme — nuclear option: hit code + every token with high specificity */
510+
.galley-body code[class*="language-"],
511+
.galley-body pre[class*="language-"],
512+
.galley-body code[class*="language-"] * {
513+
color: #1A1613 !important;
514+
text-shadow: none !important;
515+
}
516+
.galley-body code[class*="language-"] .token.comment,
517+
.galley-body code[class*="language-"] .token.prolog,
518+
.galley-body code[class*="language-"] .token.doctype,
519+
.galley-body code[class*="language-"] .token.cdata { color: #8A7C68 !important; font-style: italic; }
520+
.galley-body code[class*="language-"] .token.punctuation { color: #3A302A !important; }
521+
.galley-body code[class*="language-"] .token.property,
522+
.galley-body code[class*="language-"] .token.class-name,
523+
.galley-body code[class*="language-"] .token.constant,
524+
.galley-body code[class*="language-"] .token.symbol,
525+
.galley-body code[class*="language-"] .token.deleted { color: #8A4A1B !important; font-weight: 600; }
526+
.galley-body code[class*="language-"] .token.number,
527+
.galley-body code[class*="language-"] .token.boolean { color: #8A3E1C !important; }
528+
.galley-body code[class*="language-"] .token.selector,
529+
.galley-body code[class*="language-"] .token.string,
530+
.galley-body code[class*="language-"] .token.char,
531+
.galley-body code[class*="language-"] .token.inserted,
532+
.galley-body code[class*="language-"] .token.attr-name,
533+
.galley-body code[class*="language-"] .token.attr-value { color: #556B2F !important; }
534+
.galley-body code[class*="language-"] .token.operator,
535+
.galley-body code[class*="language-"] .token.entity,
536+
.galley-body code[class*="language-"] .token.url { color: #7A3020 !important; }
537+
.galley-body code[class*="language-"] .token.keyword,
538+
.galley-body code[class*="language-"] .token.atrule,
539+
.galley-body code[class*="language-"] .token.regex,
540+
.galley-body code[class*="language-"] .token.tag { color: #5C3A87 !important; font-weight: 600; }
541+
.galley-body code[class*="language-"] .token.function,
542+
.galley-body code[class*="language-"] .token.builtin { color: #1F4A78 !important; font-weight: 600; }
543+
.galley-body code[class*="language-"] .token.important { color: #7A3020 !important; font-weight: bold; }
544+
.galley-body code[class*="language-"] .token.bold { font-weight: bold; }
545+
.galley-body code[class*="language-"] .token.italic { font-style: italic; }
508546
`}</style>
509547

510548
<MarginMark glyph="¶" note="set" />

0 commit comments

Comments
 (0)