Skip to content

Commit 1ef8c68

Browse files
committed
Add light theme to code-blocks
1 parent c955c0a commit 1ef8c68

File tree

2 files changed

+165
-16
lines changed

2 files changed

+165
-16
lines changed

app/globals.css

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,98 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;
4+
5+
@layer base {
6+
:root {
7+
--background: 0 0% 100%;
8+
--foreground: 222.2 84% 4.9%;
9+
10+
--card: 0 0% 100%;
11+
--card-foreground: 222.2 84% 4.9%;
12+
13+
--popover: 0 0% 100%;
14+
--popover-foreground: 222.2 84% 4.9%;
15+
16+
--primary: 222.2 47.4% 11.2%;
17+
--primary-foreground: 210 40% 98%;
18+
19+
--secondary: 210 40% 96.1%;
20+
--secondary-foreground: 222.2 47.4% 11.2%;
21+
22+
--muted: 210 40% 96.1%;
23+
--muted-foreground: 215.4 16.3% 46.9%;
24+
25+
--accent: 210 40% 96.1%;
26+
--accent-foreground: 222.2 47.4% 11.2%;
27+
28+
--destructive: 0 84.2% 60.2%;
29+
--destructive-foreground: 210 40% 98%;
30+
31+
--border: 214.3 31.8% 91.4%;
32+
--input: 214.3 31.8% 91.4%;
33+
--ring: 222.2 84% 4.9%;
34+
35+
--radius: 0.5rem;
36+
}
37+
38+
.dark {
39+
--background: 222.2 84% 4.9%;
40+
--foreground: 210 40% 98%;
41+
42+
--card: 222.2 84% 4.9%;
43+
--card-foreground: 210 40% 98%;
44+
45+
--popover: 222.2 84% 4.9%;
46+
--popover-foreground: 210 40% 98%;
47+
48+
--primary: 210 40% 98%;
49+
--primary-foreground: 222.2 47.4% 11.2%;
50+
51+
--secondary: 217.2 32.6% 17.5%;
52+
--secondary-foreground: 210 40% 98%;
53+
54+
--muted: 217.2 32.6% 17.5%;
55+
--muted-foreground: 215 20.2% 65.1%;
56+
57+
--accent: 217.2 32.6% 17.5%;
58+
--accent-foreground: 210 40% 98%;
59+
60+
--destructive: 0 62.8% 30.6%;
61+
--destructive-foreground: 210 40% 98%;
62+
63+
--border: 217.2 32.6% 17.5%;
64+
--input: 217.2 32.6% 17.5%;
65+
--ring: 212.7 26.8% 83.9%;
66+
}
67+
}
68+
69+
@layer base {
70+
* {
71+
border-color: hsl(var(--border));
72+
}
73+
body {
74+
background-color: hsl(var(--background));
75+
color: hsl(var(--foreground));
76+
}
77+
}
78+
79+
code[class*="language-"],
80+
pre[class*="language-"] {
81+
color: var(--prism-text, #24292e) !important;
82+
background-color: var(--prism-bg, #ffffff) !important;
83+
text-shadow: none !important;
84+
font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace !important;
85+
}
86+
87+
code[class*="language-"] > span:not([class]) {
88+
color: var(--prism-text, #24292e) !important;
89+
}
90+
91+
:not(pre) > code[class*="language-"],
92+
pre[class*="language-"] {
93+
background: var(--prism-bg, #ffffff) !important;
94+
}
95+
196
@import '../node_modules/@south-paw/typeface-minecraft/index.css' layer(base);
297
@import './prism-tomorrow.css' layer(base);
398
@import 'tailwindcss';
@@ -275,3 +370,14 @@ code,
275370
.prose code {
276371
font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace !important;
277372
}
373+
374+
code[class*="language-"],
375+
pre[class*="language-"] {
376+
text-shadow: none !important;
377+
font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace !important;
378+
}
379+
380+
:not(pre) > code[class*="language-"],
381+
pre[class*="language-"] {
382+
color: var(--prism-text) !important;
383+
}

app/prism-tomorrow.css

Lines changed: 59 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,44 @@
1+
/* Zdefiniowanie zmiennych dla obu motywów */
2+
:root {
3+
/* Light Theme (GitHub Light style) - Wysoki kontrast */
4+
--prism-bg: #ffffff;
5+
--prism-text: #24292e;
6+
--prism-comment: #6e7781;
7+
--prism-punctuation: #24292e;
8+
--prism-tag: #22863a;
9+
--prism-attr-name: #6f42c1;
10+
--prism-function-name: #6f42c1;
11+
--prism-primitive: #005cc5;
12+
--prism-property: #005cc5;
13+
--prism-keyword: #d73a49;
14+
--prism-string: #032f62;
15+
--prism-operator: #d73a49;
16+
--prism-variable: #e36209;
17+
}
18+
19+
html.dark {
20+
/* Dark Theme (Original Tomorrow Night) */
21+
--prism-bg: #181c23;
22+
--prism-text: #ccc;
23+
--prism-comment: #999;
24+
--prism-punctuation: #ccc;
25+
--prism-tag: #e2777a;
26+
--prism-attr-name: #e2777a;
27+
--prism-function-name: #6196cc;
28+
--prism-primitive: #f08d49;
29+
--prism-property: #f8c555;
30+
--prism-keyword: #cc99cd;
31+
--prism-string: #7ec699;
32+
--prism-operator: #67cdcc;
33+
--prism-variable: #e2777a;
34+
}
35+
36+
/* Zwiększona specyficzność selektorów */
137
code[class*="language-"],
238
pre[class*="language-"] {
3-
color: #ccc;
4-
background: #181c23 !important;
39+
color: var(--prism-text) !important; /* Wymuszenie koloru podstawowego tekstu */
40+
background: var(--prism-bg) !important;
41+
text-shadow: none !important; /* Usunięcie cienia, który czasem powoduje rozmycie kolorów */
542
font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
643
font-size: 1em;
744
text-align: left;
@@ -25,77 +62,83 @@ pre[class*="language-"] {
2562
padding: 1em;
2663
margin: 0.5em 0;
2764
overflow: auto;
28-
background: #181c23 !important;
65+
background: var(--prism-bg) !important;
2966
}
3067

3168
:not(pre) > code[class*="language-"],
3269
pre[class*="language-"] {
33-
background: #23272e;
70+
background: var(--prism-bg);
3471
}
3572

3673
:not(pre) > code[class*="language-"] {
3774
padding: 0.1em;
3875
border-radius: 0.3em;
3976
white-space: normal;
40-
background: #181c23 !important;
77+
background: var(--prism-bg) !important;
4178
}
4279

4380
.token.comment,
4481
.token.block-comment,
4582
.token.prolog,
4683
.token.doctype,
4784
.token.cdata {
48-
color: #999;
85+
color: var(--prism-comment);
4986
}
5087

5188
.token.punctuation {
52-
color: #ccc;
89+
color: var(--prism-punctuation);
5390
}
5491

5592
.token.tag,
56-
.token.attr-name,
5793
.token.namespace,
5894
.token.deleted {
59-
color: #e2777a;
95+
color: var(--prism-tag);
96+
}
97+
98+
.token.attr-name {
99+
color: var(--prism-attr-name);
60100
}
61101

62102
.token.function-name {
63-
color: #6196cc;
103+
color: var(--prism-function-name);
64104
}
65105

66106
.token.boolean,
67107
.token.number,
68108
.token.function {
69-
color: #f08d49;
109+
color: var(--prism-primitive);
70110
}
71111

72112
.token.property,
73113
.token.class-name,
74114
.token.constant,
75115
.token.symbol {
76-
color: #f8c555;
116+
color: var(--prism-property);
77117
}
78118

79119
.token.selector,
80120
.token.important,
81121
.token.atrule,
82122
.token.keyword,
83123
.token.builtin {
84-
color: #cc99cd;
124+
color: var(--prism-keyword);
85125
}
86126

87127
.token.string,
88128
.token.char,
89129
.token.attr-value,
90-
.token.regex,
130+
.token.regex {
131+
color: var(--prism-string);
132+
}
133+
91134
.token.variable {
92-
color: #7ec699;
135+
color: var(--prism-variable);
93136
}
94137

95138
.token.operator,
96139
.token.entity,
97140
.token.url {
98-
color: #67cdcc;
141+
color: var(--prism-operator);
99142
}
100143

101144
.token.important,

0 commit comments

Comments
 (0)