MCPcopy Index your code
hub / github.com/pomber/code-surfer / makeTheme

Function makeTheme

packs/themes/src/utils.ts:28–73  ·  view source on GitHub ↗
(
  prismTheme: PrismTheme,
  override: Partial<CodeSurferStyles> = {}
)

Source from the content-addressed store, hash-verified

26};
27
28export function makeTheme(
29 prismTheme: PrismTheme,
30 override: Partial<CodeSurferStyles> = {}
31): CodeSurferTheme {
32 const tokens = {} as Record<string, SxStyleProp>;
33 prismTheme.styles.forEach(s => {
34 tokens[s.types.join(" ")] = s.style;
35 });
36
37 const theme: CodeSurferTheme = {
38 colors: {
39 text: prismTheme.plain.color,
40 background: prismTheme.plain.backgroundColor
41 },
42 styles: {
43 CodeSurfer: {
44 tokens,
45 title: {
46 backgroundColor: prismTheme.plain.backgroundColor,
47 color: prismTheme.plain.color
48 },
49 subtitle: {
50 color: "#d6deeb",
51 backgroundColor: "rgba(10,10,10,0.9)"
52 },
53 pre: {
54 color: prismTheme.plain.color,
55 backgroundColor: prismTheme.plain.backgroundColor
56 },
57 code: {
58 color: prismTheme.plain.color,
59 backgroundColor: prismTheme.plain.backgroundColor
60 },
61 ...override
62 }
63 }
64 };
65
66 const stringStyle = prismTheme.styles.find(s => s.types.includes("string"));
67 const primary = stringStyle && (stringStyle.style.color as string);
68 if (theme.colors && primary) {
69 theme.colors.primary = primary;
70 }
71
72 return theme;
73}

Callers 9

theme.ultramin.tsFile · 0.90
theme.vs-dark.tsFile · 0.90
theme.night-owl.tsFile · 0.90
theme.github.tsFile · 0.90
theme.dracula.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected