Skip to content

Commit c9b517b

Browse files
authored
feat: add Reader theme (#315)
Adds a new theme, Reader, with a minimalist, but customizable sytle. ![image](https://github.com/user-attachments/assets/bfb03e74-8eca-4624-93e1-9bf678ba0e77)
1 parent 8bc7a3b commit c9b517b

File tree

2 files changed

+327
-0
lines changed

2 files changed

+327
-0
lines changed

src/lib/themes/reader/page.jinja

+136
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
<!doctype html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8" />
6+
<link rel="icon" href="/favicon.png" />
7+
<meta name="viewport" content="width=device-width, initial-scale=1" />
8+
<title>{{title}} | {{profile.display_name}}</title>
9+
10+
<style>
11+
/* Comment out Google Fonts from Google CDN to prevent tracking. */
12+
@import url('https://fonts.googleapis.com/css2?family=Libre+Caslon+Display&family=Lora:ital@0;1&display=swap');
13+
14+
body {
15+
--body: Lora, Cambria, Cochin, Times, sans-serif;
16+
--head: 'Libre Caslon Display', Georgia, 'Times New Roman' Times, serif;
17+
color-scheme: dark light;
18+
background-color: black white;
19+
text-rendering: optimizeLegibility;
20+
}
21+
.content {
22+
display: flex;
23+
align-items: start;
24+
gap: 2rem;
25+
padding-block: 4rem;
26+
/* flex-wrap: wrap; */
27+
padding-inline: 2rem;
28+
}
29+
30+
main {
31+
height: 100%;
32+
min-height: 100dvh;
33+
font-weight: normal;
34+
font-family: var(--body);
35+
}
36+
nav {
37+
position: sticky;
38+
top: 4rem;
39+
opacity: .7;
40+
font-family: var(--body);
41+
a {
42+
text-decoration: none;
43+
}
44+
transition: opacity 200ms ease-out;
45+
&:hover {
46+
opacity: 1;
47+
}
48+
}
49+
h1,h2 {
50+
font-family: var(--head);
51+
font-size: 1.125em;
52+
font-weight: 500;
53+
}
54+
h1 {
55+
font-size: 1.25em;
56+
margin: 0;
57+
}
58+
59+
ul {padding:0;}
60+
li {
61+
list-style-type: none;
62+
display:flex;
63+
}
64+
a, p {
65+
max-width: 45ch;
66+
hypens: auto;
67+
text-wrap: pretty;
68+
}
69+
a {
70+
color: inherit;
71+
flex-grow: 2;
72+
transition: text-decoration 200ms ease-in-out;
73+
&:hover {
74+
text-decoration: underline;
75+
}
76+
}
77+
.back {
78+
display: flex;
79+
align-items: center;
80+
justify-contents: start;
81+
gap: .25em;
82+
}
83+
.cozy {
84+
background-color: #E4DFD2;
85+
color: #32281B;
86+
}
87+
.oled {
88+
background-color: oklch(0 0 0);
89+
color: oklch(.9 0 0);
90+
}
91+
.dark {
92+
background-color: oklch(.26 0 0);
93+
color: oklch(.85 0 0);
94+
}
95+
.brut {
96+
--body: Inter, "San Francisco", Calibri, "Gill Sans",
97+
Oxygen, Ubuntu, system-ui, -apple-system, Roboto,
98+
sans-serif;
99+
--head: var(--body);
100+
h1, h2 {
101+
font-size: 1rem;
102+
font-weight: 500;
103+
color: oklch(.9 0 0);
104+
}
105+
p, a {
106+
color: oklch(.76 0 0);
107+
}
108+
}
109+
</style>
110+
</head>
111+
112+
<!-- Add a class to change the style [cozy, brut, oled, dark] -->
113+
<body class="cozy">
114+
<div class="content">
115+
<nav>
116+
<a class="back" href="https://{{profile.handle}}.weird.one/{{handle}}">
117+
<svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
118+
<path d="M6.85355 3.85355C7.04882 3.65829 7.04882 3.34171 6.85355 3.14645C6.65829 2.95118 6.34171 2.95118 6.14645 3.14645L2.14645 7.14645C1.95118 7.34171 1.95118 7.65829 2.14645 7.85355L6.14645 11.8536C6.34171 12.0488 6.65829 12.0488 6.85355 11.8536C7.04882 11.6583 7.04882 11.3417 6.85355 11.1464L3.20711 7.5L6.85355 3.85355ZM12.8536 3.85355C13.0488 3.65829 13.0488 3.34171 12.8536 3.14645C12.6583 2.95118 12.3417 2.95118 12.1464 3.14645L8.14645 7.14645C7.95118 7.34171 7.95118 7.65829 8.14645 7.85355L12.1464 11.8536C12.3417 12.0488 12.6583 12.0488 12.8536 11.8536C13.0488 11.6583 13.0488 11.3417 12.8536 11.1464L9.20711 7.5L12.8536 3.85355Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd">
119+
</path>
120+
</svg>
121+
Home
122+
</a>
123+
</nav>
124+
<main>
125+
<header>
126+
127+
<h1>{{title}}</h1>
128+
</header>
129+
<article>
130+
{{markdown | markdown}}
131+
</article>
132+
</main>
133+
</div>
134+
</body>
135+
136+
</html>

src/lib/themes/reader/profile.jinja

+191
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
<!doctype html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8" />
6+
<link rel="icon" href="/favicon.png" />
7+
<meta name="viewport" content="width=device-width, initial-scale=1" />
8+
<title>{{profile.display_name}}</title>
9+
<link rel="canonical" href="{{handle}}" />
10+
11+
<style>
12+
/* Comment out Google Fonts from Google CDN to prevent tracking. */
13+
@import url('https://fonts.googleapis.com/css2?family=Libre+Caslon+Display&family=Lora:ital@0;1&display=swap');
14+
15+
body {
16+
--body: Lora, Cambria, Cochin, Times, sans-serif;
17+
--head: 'Libre Caslon Display', Georgia, 'Times New Roman' Times, serif;
18+
color-scheme: dark light;
19+
background-color: black white;
20+
text-rendering: optimizeLegibility;
21+
}
22+
23+
* { margin: 0;}
24+
main {
25+
height: 100%;
26+
min-height: 100dvh;
27+
padding-inline: 2rem;
28+
font-weight: normal;
29+
font-family: var(--body);
30+
}
31+
h1,h2 {
32+
font-family: var(--head);
33+
font-size: 1.125em;
34+
font-weight: 400;
35+
}
36+
ul {padding:0;}
37+
section { padding-block-end: 1rem;}
38+
li {
39+
list-style-type: none;
40+
display:flex;
41+
}
42+
a, p {
43+
max-width: 45ch;
44+
hypens: auto;
45+
text-wrap: pretty;
46+
}
47+
a {
48+
color: inherit;
49+
text-decoration: none;
50+
flex-grow: 2;
51+
transition: text-decoration 200ms ease-in-out;
52+
&:hover {
53+
text-decoration: underline;
54+
}}
55+
section:first-child {
56+
padding-block-start: 4rem;
57+
div{
58+
display: flex;
59+
align-items: stretch;
60+
gap: .25rem;
61+
}
62+
figure {
63+
display:flex;
64+
align-items: end;
65+
margin: 0;
66+
}
67+
figure, img {
68+
width: 100%;
69+
max-width: 1.125rem;
70+
}
71+
h1 {
72+
line-height: 100%;
73+
}
74+
}
75+
.prof {
76+
text-align: center;
77+
p, a {margin-inline: auto;}
78+
section>div{
79+
justify-content: center;
80+
}
81+
}
82+
.cozy {
83+
background-color: #E4DFD2;
84+
color: #32281B;
85+
}
86+
.oled {
87+
background-color: oklch(0 0 0);
88+
color: oklch(.9 0 0);
89+
}
90+
.dark {
91+
background-color: oklch(.26 0 0);
92+
color: oklch(.85 0 0);
93+
}
94+
.brut {
95+
--body: Inter, "San Francisco", Calibri, "Gill Sans",
96+
Oxygen, Ubuntu, system-ui, -apple-system, Roboto,
97+
sans-serif;
98+
--head: var(--body);
99+
section {
100+
h1, h2 {
101+
font-size: 1rem;
102+
font-weight: 400;
103+
opcaticy: .9;
104+
}
105+
p, a {
106+
color: oklch(.4 0 0);
107+
font-weight: 360;
108+
transition: opacity 300ms ease-in;
109+
&:hover {
110+
opacity: 1;
111+
}
112+
}
113+
}
114+
}
115+
116+
</style>
117+
</head>
118+
119+
<!-- Add a class to change the style [cozy, prof, brut, oled, dark] -->
120+
<body class="cozy brut">
121+
<main>
122+
<section>
123+
<div>
124+
<figure class="avatar-figure">
125+
<img class="avatar" src="/avatar" alt="{{display_name}} avatar" />
126+
</figure>
127+
<h1>{{display_name}}</h1>
128+
</div>
129+
{% if bio %}
130+
<div> {{bio | markdown}} </div>
131+
{% endif %}
132+
</section>
133+
134+
{% if social_links %}
135+
<section>
136+
<h2>Contact</h2>
137+
<ul class="contact">
138+
{% for link in social_links %}
139+
<li><a rel="me" title="{{link.label}}" href="{{link.url}}" target="_blank" class="link">
140+
{{link.platform_name}}
141+
</a></li>
142+
{% endfor %}
143+
</ul>
144+
</section>
145+
{% endif %}
146+
147+
148+
149+
{% if tags %}
150+
<section>
151+
<h2>Tags</h2>
152+
<ul class="tags">
153+
{% for tag in tags %}
154+
<li><a href="{{instance_info.url}}/people#{{tag}}" target="_blank" class="tag">
155+
{{tag}}
156+
</a></li>
157+
{% endfor %}
158+
</ul>
159+
</section>
160+
{% endif %}
161+
162+
{% if links %}
163+
<section class="links">
164+
<h2>Links</h2>
165+
<ul>
166+
{% for link in links %}
167+
<li><a rel="me" href="{{link.url}}" target="_blank" class="link">
168+
{{link.label or link.url}}
169+
</a></li>
170+
{% endfor %}
171+
</ul>
172+
</section>
173+
{% endif %}
174+
175+
176+
{% if pages %}
177+
<section class="links">
178+
<h2>Pages</h2>
179+
<ul>
180+
{% for page in pages %}
181+
<li><a href="/{{page.slug}}" class="link">
182+
{{page.name or page.slug}}
183+
</a></li>
184+
{% endfor %}
185+
</ul>
186+
</section>
187+
{% endif %}
188+
</main>
189+
</body>
190+
191+
</html>

0 commit comments

Comments
 (0)