Skip to content

Commit b119bf4

Browse files
authored
Update theme to be more Pythonic (#58)
Instead of the grey color scheme, use Python colors from the python.org website (eg blue and yellow). Add Python logo, favicon, and og image.
1 parent db52364 commit b119bf4

7 files changed

Lines changed: 179 additions & 0 deletions

File tree

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
/* Python look for the site: python.org's blue and yellow instead of
2+
PaperMod's greys, the font stacks from python-docs-theme, and a wider page
3+
than PaperMod's default. */
4+
5+
:root {
6+
/* Page width: PaperMod defaults are 720px (content) and 1024px (header). */
7+
--main-width: 1080px;
8+
--nav-width: 1080px;
9+
10+
/* python.org palette. */
11+
--py-blue: #3776ab;
12+
--py-blue-dark: #306998;
13+
--py-blue-deep: #2b5b84;
14+
--py-yellow: #ffd43b;
15+
16+
/* Fonts from python-docs-theme. */
17+
--py-font: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui,
18+
helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif;
19+
--py-mono: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace;
20+
21+
/* PaperMod's color variables, tinted blue and yellow instead of grey. */
22+
--theme: #fff;
23+
--entry: #fff;
24+
--primary: #1d2733;
25+
--secondary: #4a5b6c;
26+
--tertiary: #eaf2fa;
27+
--content: #1d2733;
28+
--code-bg: #fff6d5;
29+
--border: #cfe0ef;
30+
31+
--py-link: var(--py-blue-dark);
32+
--py-link-visited: #6363bb;
33+
--py-link-hover: var(--py-blue-deep);
34+
--py-header-bg: #13263d;
35+
--py-header-text: #fff;
36+
}
37+
38+
:root[data-theme="dark"] {
39+
--theme: #15202c;
40+
--entry: #1b2836;
41+
--primary: rgba(255, 255, 255, 0.9);
42+
--secondary: #a9bacb;
43+
--tertiary: #243649;
44+
--content: rgba(255, 255, 255, 0.87);
45+
--code-bg: #3a3320;
46+
--border: #2f4560;
47+
48+
--py-link: #8cc4ff;
49+
--py-link-visited: #c3a6ff;
50+
--py-link-hover: var(--py-yellow);
51+
--py-header-bg: #0f1822;
52+
--py-header-text: rgba(255, 255, 255, 0.92);
53+
}
54+
55+
body {
56+
font-family: var(--py-font);
57+
}
58+
59+
code,
60+
pre,
61+
kbd,
62+
tt {
63+
font-family: var(--py-mono);
64+
}
65+
66+
/* PaperMod gives list pages (home, Monthly Updates, Projects, ...) a grey
67+
background; use the plain page color instead. */
68+
.list,
69+
[data-theme="dark"] .list {
70+
background: var(--theme);
71+
}
72+
73+
/* Header: a deep navy bar with a yellow rule. Navy rather than Python blue,
74+
so the blue in the logo stays visible. */
75+
.header {
76+
background: var(--py-header-bg);
77+
border-bottom: 4px solid var(--py-yellow);
78+
}
79+
80+
.header .logo a,
81+
.header #menu a,
82+
.header .theme-toggle,
83+
.header .logo-switches {
84+
color: var(--py-header-text);
85+
}
86+
87+
.header #menu .active,
88+
.header #menu a:hover {
89+
color: var(--py-yellow);
90+
}
91+
92+
/* Cards on the home page and in lists: yellow left edge, blue on hover. */
93+
.post-entry {
94+
border-left: 4px solid var(--py-yellow);
95+
}
96+
97+
.post-entry:hover,
98+
.post-entry:focus-within {
99+
border-color: var(--py-blue);
100+
border-left-color: var(--py-yellow);
101+
}
102+
103+
/* Links in page content. */
104+
.md-content a,
105+
.post-content a,
106+
.project-meta a,
107+
.project-refs td a,
108+
.project-table a.project-title,
109+
.entry-content a {
110+
color: var(--py-link);
111+
box-shadow: none;
112+
text-decoration: underline 1px;
113+
text-underline-offset: 0.15em;
114+
}
115+
116+
.md-content a:visited,
117+
.post-content a:visited,
118+
.project-meta a:visited,
119+
.project-refs td a:visited,
120+
.project-table a.project-title:visited {
121+
color: var(--py-link-visited);
122+
}
123+
124+
.md-content a:hover,
125+
.post-content a:hover,
126+
.project-meta a:hover,
127+
.project-refs td a:hover,
128+
.project-table a.project-title:hover {
129+
color: var(--py-link-hover);
130+
}
131+
132+
/* Heading anchors keep a muted color, like a.headerlink in the docs. */
133+
.md-content a.anchor {
134+
color: var(--secondary);
135+
text-decoration: none;
136+
}
137+
138+
/* Table header cells in light blue, with dark blue text. */
139+
.md-content table th,
140+
.md-content .project-table-wrap table.project-table th {
141+
background: var(--tertiary);
142+
color: var(--primary);
143+
}
144+
145+
/* Horizontal rules in the pale blue border color. */
146+
.md-content hr {
147+
background: var(--border);
148+
}
149+
150+
/* Blockquotes: a Python blue bar instead of PaperMod's near-black one. */
151+
.md-content blockquote {
152+
border-inline-start-color: var(--py-blue);
153+
}

‎hugo.yaml‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,18 @@ params:
4242
ShowPageNums: true
4343
ShowToc: true
4444

45+
# Python logo (from python-docs-theme) in the header and as the favicon.
46+
# The PNG favicons and apple-touch-icon.png in static/ use PaperMod's
47+
# default file names, so they need no setting here.
48+
label:
49+
icon: "py.svg"
50+
iconHeight: 24
51+
assets:
52+
favicon: "py.svg"
53+
54+
# Default image for link previews (Open Graph and Twitter cards).
55+
images: ["og-image.png"]
56+
4557
homeInfoParams:
4658
Title: "Python Docs Editorial Board"
4759
Content: >

‎static/apple-touch-icon.png‎

6.12 KB
Loading

‎static/favicon-16x16.png‎

555 Bytes
Loading

‎static/favicon-32x32.png‎

1.14 KB
Loading

‎static/og-image.png‎

79.1 KB
Loading

‎static/py.svg‎

Lines changed: 14 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)