Commit 4853a27 h
Pat Ambrosio · 26-09-06 09:36
Sit the theme control on the header line, without a box
Changes: 4 files
+82
-49
Changes (Side-by-Side)
share/jenny/layout/404.sh +19 -13
cat << _EOF_ |
| 73 |
.notfound .code { color: var(--text-muted); text-transform: uppercase; } |
73 |
.notfound .code { color: var(--text-muted); text-transform: uppercase; } |
| 74 |
.theme-toggle { |
74 |
.theme-toggle { |
| 75 |
position: absolute; |
75 |
position: absolute; |
| 76 |
top: 1em; |
| |
| |
76 |
/* On the header's line, centred on it. 2.25rem is the header's own top |
| |
77 |
(1.5rem, the body's margin plus padding) plus half its 1.5rem line, and |
| |
78 |
translateY(-50%) then centres the control on that line whatever size it |
| |
79 |
is. In rem rather than em on purpose: em scales with the control's own |
| |
80 |
font-size, so the same expression put it two pixels out at one size and |
| |
81 |
right at the other. */ |
| |
82 |
top: 2.25rem; |
| 77 |
right: 1em; |
83 |
right: 1em; |
| |
84 |
transform: translateY(-50%); |
| |
85 |
/* No border. The box around a small glyph was what read as oversized on a |
| |
86 |
phone, more than the glyph itself. The square keeps it a tap target. */ |
| 78 |
background: none; |
87 |
background: none; |
| 79 |
border: 1px solid var(--border); |
| |
| |
88 |
border: none; |
| 80 |
color: var(--text-primary); |
89 |
color: var(--text-primary); |
| 81 |
/* A geometric glyph reads smaller than a letter set at the same size, |
| |
| 82 |
and .9em left the control noticeably small against the type it |
| |
| 83 |
sits beside. Padding is square so the button does not come out |
| |
| 84 |
wider than it is tall around a round mark. */ |
| |
| 85 |
padding: .35em .45em; |
| |
| |
90 |
width: 1.5em; |
| |
91 |
height: 1.5em; |
| |
92 |
display: inline-flex; |
| |
93 |
align-items: center; |
| |
94 |
justify-content: center; |
| |
95 |
line-height: 1; |
| 86 |
cursor: pointer; |
96 |
cursor: pointer; |
| 87 |
font-size: 1.15em; |
97 |
font-size: 1.15em; |
| 88 |
line-height: 1; |
| |
| 89 |
text-decoration: none; |
98 |
text-decoration: none; |
| 90 |
text-transform: uppercase; |
99 |
text-transform: uppercase; |
| 91 |
} |
100 |
} |
| 92 |
.theme-toggle:hover { |
| |
| 93 |
background-color: var(--bg-primary); |
| |
| 94 |
opacity: 0.8; |
| |
| 95 |
} |
| |
| |
101 |
.theme-toggle:hover { opacity: .7; } |
| 96 |
/* Smaller on a phone. 1.15em is sized against the desktop measure, where |
102 |
/* Smaller on a phone. 1.15em is sized against the desktop measure, where |
| 97 |
the control sits alone in a wide margin; on a narrow screen it is |
103 |
the control sits alone in a wide margin; on a narrow screen it is |
| 98 |
beside the breadcrumb and reads as oversized. */ |
104 |
beside the breadcrumb and reads as oversized. */ |
| 99 |
@media (max-width: 735px) { |
105 |
@media (max-width: 735px) { |
| 100 |
.theme-toggle { font-size: .95em; padding: .3em .4em; } |
| |
| |
106 |
.theme-toggle { font-size: .95em; } |
| 101 |
} |
107 |
} |
| 102 |
</style> |
108 |
</style> |
| 103 |
<script> |
109 |
<script> |
share/jenny/layout/index.sh +21 -12
cat << _EOF_ |
| 205 |
header a.current { border-bottom: 1px solid var(--border); padding-bottom: .125em; } |
205 |
header a.current { border-bottom: 1px solid var(--border); padding-bottom: .125em; } |
| 206 |
.theme-toggle { |
206 |
.theme-toggle { |
| 207 |
position: absolute; |
207 |
position: absolute; |
| 208 |
top: 1em; |
| |
| |
208 |
/* On the header's line, centred on it. 2.25rem is the header's own top |
| |
209 |
(1.5rem, the body's margin plus padding) plus half its 1.5rem line, and |
| |
210 |
translateY(-50%) then centres the control on that line whatever size it |
| |
211 |
is. In rem rather than em on purpose: em scales with the control's own |
| |
212 |
font-size, so the same expression put it two pixels out at one size and |
| |
213 |
right at the other. */ |
| |
214 |
top: 2.25rem; |
| 209 |
right: 1em; |
215 |
right: 1em; |
| |
216 |
transform: translateY(-50%); |
| |
217 |
/* No border. The box around a small glyph was what read as oversized on a |
| |
218 |
phone, more than the glyph itself. The square keeps it a tap target. */ |
| 210 |
background: none; |
219 |
background: none; |
| 211 |
border: 1px solid var(--border); |
| |
| |
220 |
border: none; |
| 212 |
color: var(--text-primary); |
221 |
color: var(--text-primary); |
| 213 |
/* A geometric glyph reads smaller than a letter set at the same size, |
| |
| 214 |
and .9em left the control noticeably small against the type it |
| |
| 215 |
sits beside. Padding is square so the button does not come out |
| |
| 216 |
wider than it is tall around a round mark. */ |
| |
| 217 |
padding: .35em .45em; |
| |
| |
222 |
width: 1.5em; |
| |
223 |
height: 1.5em; |
| |
224 |
display: inline-flex; |
| |
225 |
align-items: center; |
| |
226 |
justify-content: center; |
| |
227 |
line-height: 1; |
| 218 |
cursor: pointer; |
228 |
cursor: pointer; |
| 219 |
font-size: 1.15em; |
229 |
font-size: 1.15em; |
| 220 |
line-height: 1; |
| |
| 221 |
text-decoration: none; |
230 |
text-decoration: none; |
| 222 |
text-transform: uppercase; |
231 |
text-transform: uppercase; |
| 223 |
} |
232 |
} |
| 224 |
.theme-toggle:hover { |
| |
| 225 |
background-color: var(--bg-secondary); |
| |
| 226 |
} |
| |
| |
233 |
/* Dimmed rather than filled: a background swatch behind a borderless glyph |
| |
234 |
reads as a stray block, not as the control lighting up. */ |
| |
235 |
.theme-toggle:hover { opacity: .7; } |
| 227 |
/* Smaller on a phone. 1.15em is sized against the desktop measure, where |
236 |
/* Smaller on a phone. 1.15em is sized against the desktop measure, where |
| 228 |
the control sits alone in a wide margin; on a narrow screen it is |
237 |
the control sits alone in a wide margin; on a narrow screen it is |
| 229 |
beside the breadcrumb and reads as oversized. */ |
238 |
beside the breadcrumb and reads as oversized. */ |
| 230 |
@media (max-width: 735px) { |
239 |
@media (max-width: 735px) { |
| 231 |
.theme-toggle { font-size: .95em; padding: .3em .4em; } |
| |
| |
240 |
.theme-toggle { font-size: .95em; } |
| 232 |
} |
241 |
} |
| 233 |
</style> |
242 |
</style> |
| 234 |
<script> |
243 |
<script> |
share/jenny/layout/page.sh +21 -12
cat << _EOF_ |
| 1036 |
header a { text-decoration: none; color: inherit; } |
1036 |
header a { text-decoration: none; color: inherit; } |
| 1037 |
.theme-toggle { |
1037 |
.theme-toggle { |
| 1038 |
position: absolute; |
1038 |
position: absolute; |
| 1039 |
top: 1em; |
| |
| |
1039 |
/* On the header's line, centred on it. 2.25rem is the header's own top |
| |
1040 |
(1.5rem, the body's margin plus padding) plus half its 1.5rem line, and |
| |
1041 |
translateY(-50%) then centres the control on that line whatever size it |
| |
1042 |
is. In rem rather than em on purpose: em scales with the control's own |
| |
1043 |
font-size, so the same expression put it two pixels out at one size and |
| |
1044 |
right at the other. */ |
| |
1045 |
top: 2.25rem; |
| 1040 |
right: 1em; |
1046 |
right: 1em; |
| |
1047 |
transform: translateY(-50%); |
| |
1048 |
/* No border. The box around a small glyph was what read as oversized on a |
| |
1049 |
phone, more than the glyph itself. The square keeps it a tap target. */ |
| 1041 |
background: none; |
1050 |
background: none; |
| 1042 |
border: 1px solid var(--border-breadcrumb); |
| |
| |
1051 |
border: none; |
| 1043 |
color: var(--text-primary); |
1052 |
color: var(--text-primary); |
| 1044 |
/* A geometric glyph reads smaller than a letter set at the same size, |
| |
| 1045 |
and .9em left the control noticeably small against the type it |
| |
| 1046 |
sits beside. Padding is square so the button does not come out |
| |
| 1047 |
wider than it is tall around a round mark. */ |
| |
| 1048 |
padding: .35em .45em; |
| |
| |
1053 |
width: 1.5em; |
| |
1054 |
height: 1.5em; |
| |
1055 |
display: inline-flex; |
| |
1056 |
align-items: center; |
| |
1057 |
justify-content: center; |
| |
1058 |
line-height: 1; |
| 1049 |
cursor: pointer; |
1059 |
cursor: pointer; |
| 1050 |
font-size: 1.15em; |
1060 |
font-size: 1.15em; |
| 1051 |
line-height: 1; |
| |
| 1052 |
text-decoration: none; |
1061 |
text-decoration: none; |
| 1053 |
text-transform: uppercase; |
1062 |
text-transform: uppercase; |
| 1054 |
} |
1063 |
} |
| 1055 |
.theme-toggle:hover { |
| |
| 1056 |
background-color: var(--bg-secondary); |
| |
| 1057 |
} |
| |
| |
1064 |
/* Dimmed rather than filled: a background swatch behind a borderless glyph |
| |
1065 |
reads as a stray block, not as the control lighting up. */ |
| |
1066 |
.theme-toggle:hover { opacity: .7; } |
| 1058 |
/* Smaller on a phone. 1.15em is sized against the desktop measure, where |
1067 |
/* Smaller on a phone. 1.15em is sized against the desktop measure, where |
| 1059 |
the control sits alone in a wide margin; on a narrow screen it is |
1068 |
the control sits alone in a wide margin; on a narrow screen it is |
| 1060 |
beside the breadcrumb and reads as oversized. */ |
1069 |
beside the breadcrumb and reads as oversized. */ |
| 1061 |
@media (max-width: 735px) { |
1070 |
@media (max-width: 735px) { |
| 1062 |
.theme-toggle { font-size: .95em; padding: .3em .4em; } |
| |
| |
1071 |
.theme-toggle { font-size: .95em; } |
| 1063 |
} |
1072 |
} |
| 1064 |
/* Tooltip styling for footnote and citation references. |
1073 |
/* Tooltip styling for footnote and citation references. |
| 1065 |
Rendered as real DOM elements so links remain interactive. |
1074 |
Rendered as real DOM elements so links remain interactive. |
share/jenny/layout/post.sh +21 -12
cat << _EOF_ |
| 857 |
header a { text-decoration: none; color: inherit; } |
857 |
header a { text-decoration: none; color: inherit; } |
| 858 |
.theme-toggle { |
858 |
.theme-toggle { |
| 859 |
position: absolute; |
859 |
position: absolute; |
| 860 |
top: 1em; |
| |
| |
860 |
/* On the header's line, centred on it. 2.25rem is the header's own top |
| |
861 |
(1.5rem, the body's margin plus padding) plus half its 1.5rem line, and |
| |
862 |
translateY(-50%) then centres the control on that line whatever size it |
| |
863 |
is. In rem rather than em on purpose: em scales with the control's own |
| |
864 |
font-size, so the same expression put it two pixels out at one size and |
| |
865 |
right at the other. */ |
| |
866 |
top: 2.25rem; |
| 861 |
right: 1em; |
867 |
right: 1em; |
| |
868 |
transform: translateY(-50%); |
| |
869 |
/* No border. The box around a small glyph was what read as oversized on a |
| |
870 |
phone, more than the glyph itself. The square keeps it a tap target. */ |
| 862 |
background: none; |
871 |
background: none; |
| 863 |
border: 1px solid var(--border-light); |
| |
| |
872 |
border: none; |
| 864 |
color: var(--text-primary); |
873 |
color: var(--text-primary); |
| 865 |
/* A geometric glyph reads smaller than a letter set at the same size, |
| |
| 866 |
and .9em left the control noticeably small against the type it |
| |
| 867 |
sits beside. Padding is square so the button does not come out |
| |
| 868 |
wider than it is tall around a round mark. */ |
| |
| 869 |
padding: .35em .45em; |
| |
| |
874 |
width: 1.5em; |
| |
875 |
height: 1.5em; |
| |
876 |
display: inline-flex; |
| |
877 |
align-items: center; |
| |
878 |
justify-content: center; |
| |
879 |
line-height: 1; |
| 870 |
cursor: pointer; |
880 |
cursor: pointer; |
| 871 |
font-size: 1.15em; |
881 |
font-size: 1.15em; |
| 872 |
line-height: 1; |
| |
| 873 |
text-decoration: none; |
882 |
text-decoration: none; |
| 874 |
text-transform: uppercase; |
883 |
text-transform: uppercase; |
| 875 |
} |
884 |
} |
| 876 |
.theme-toggle:hover { |
| |
| 877 |
background-color: var(--bg-secondary); |
| |
| 878 |
} |
| |
| |
885 |
/* Dimmed rather than filled: a background swatch behind a borderless glyph |
| |
886 |
reads as a stray block, not as the control lighting up. */ |
| |
887 |
.theme-toggle:hover { opacity: .7; } |
| 879 |
/* Smaller on a phone. 1.15em is sized against the desktop measure, where |
888 |
/* Smaller on a phone. 1.15em is sized against the desktop measure, where |
| 880 |
the control sits alone in a wide margin; on a narrow screen it is |
889 |
the control sits alone in a wide margin; on a narrow screen it is |
| 881 |
beside the breadcrumb and reads as oversized. */ |
890 |
beside the breadcrumb and reads as oversized. */ |
| 882 |
@media (max-width: 735px) { |
891 |
@media (max-width: 735px) { |
| 883 |
.theme-toggle { font-size: .95em; padding: .3em .4em; } |
| |
| |
892 |
.theme-toggle { font-size: .95em; } |
| 884 |
} |
893 |
} |
| 885 |
/* Tooltip styling for footnote and citation references. |
894 |
/* Tooltip styling for footnote and citation references. |
| 886 |
Rendered as real DOM elements so links remain interactive. |
895 |
Rendered as real DOM elements so links remain interactive. |
Raw
commit 4853a2701116ec0427f9d7d23a6b677b21f6df9a
Author: Pat Ambrosio <cp.ambrosio@gmail.com>
Date: Sun Sep 6 09:36:46 2026 +0800
Sit the theme control on the header line, without a box
It was positioned against the body at top: 1em, with no relationship to
the header it sits beside, so its centre landed eight pixels above the
header's. It is on the header's line now: 2.25rem is that line's own top
-- 1.5rem, the body's margin plus its padding -- plus half its 1.5rem
line-height, and translateY(-50%) centres the control on it whatever size
the control is.
In rem rather than em deliberately. em scales with the control's own
font-size, so the same expression put it right at one size and two pixels
out at the other; rem is fixed to the root and holds at both.
The border goes. That box around a small glyph was what read as oversized
on a phone rather than the glyph itself -- the sizes are unchanged, .95em
below 735px and 1.15em above. A square keeps it a tap target: 23px on a
phone, 28px on a desktop.
Two things followed from dropping it. The hover filled a background,
which behind a borderless glyph reads as a stray block rather than the
control lighting up, so it dims instead. And the phone override still set
a padding that only meant anything with a border.
Measured from the built pages at 390 and at 1440: aligned to the header
exactly at both.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WnSAstgnDYdKPwLGv1YZE5
diff --git a/share/jenny/layout/404.sh b/share/jenny/layout/404.sh
index 19a69ac..308a2f2 100755
--- a/share/jenny/layout/404.sh
+++ b/share/jenny/layout/404.sh
@@ -73,31 +73,37 @@ cat << _EOF_
.notfound .code { color: var(--text-muted); text-transform: uppercase; }
.theme-toggle {
position: absolute;
- top: 1em;
+ /* On the header's line, centred on it. 2.25rem is the header's own top
+ (1.5rem, the body's margin plus padding) plus half its 1.5rem line, and
+ translateY(-50%) then centres the control on that line whatever size it
+ is. In rem rather than em on purpose: em scales with the control's own
+ font-size, so the same expression put it two pixels out at one size and
+ right at the other. */
+ top: 2.25rem;
right: 1em;
+ transform: translateY(-50%);
+ /* No border. The box around a small glyph was what read as oversized on a
+ phone, more than the glyph itself. The square keeps it a tap target. */
background: none;
- border: 1px solid var(--border);
+ border: none;
color: var(--text-primary);
- /* A geometric glyph reads smaller than a letter set at the same size,
- and .9em left the control noticeably small against the type it
- sits beside. Padding is square so the button does not come out
- wider than it is tall around a round mark. */
- padding: .35em .45em;
+ width: 1.5em;
+ height: 1.5em;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ line-height: 1;
cursor: pointer;
font-size: 1.15em;
- line-height: 1;
text-decoration: none;
text-transform: uppercase;
}
- .theme-toggle:hover {
- background-color: var(--bg-primary);
- opacity: 0.8;
- }
+ .theme-toggle:hover { opacity: .7; }
/* Smaller on a phone. 1.15em is sized against the desktop measure, where
the control sits alone in a wide margin; on a narrow screen it is
beside the breadcrumb and reads as oversized. */
@media (max-width: 735px) {
- .theme-toggle { font-size: .95em; padding: .3em .4em; }
+ .theme-toggle { font-size: .95em; }
}
</style>
<script>
diff --git a/share/jenny/layout/index.sh b/share/jenny/layout/index.sh
index 05cee5a..a3acdf2 100755
--- a/share/jenny/layout/index.sh
+++ b/share/jenny/layout/index.sh
@@ -205,30 +205,39 @@ cat << _EOF_
header a.current { border-bottom: 1px solid var(--border); padding-bottom: .125em; }
.theme-toggle {
position: absolute;
- top: 1em;
+ /* On the header's line, centred on it. 2.25rem is the header's own top
+ (1.5rem, the body's margin plus padding) plus half its 1.5rem line, and
+ translateY(-50%) then centres the control on that line whatever size it
+ is. In rem rather than em on purpose: em scales with the control's own
+ font-size, so the same expression put it two pixels out at one size and
+ right at the other. */
+ top: 2.25rem;
right: 1em;
+ transform: translateY(-50%);
+ /* No border. The box around a small glyph was what read as oversized on a
+ phone, more than the glyph itself. The square keeps it a tap target. */
background: none;
- border: 1px solid var(--border);
+ border: none;
color: var(--text-primary);
- /* A geometric glyph reads smaller than a letter set at the same size,
- and .9em left the control noticeably small against the type it
- sits beside. Padding is square so the button does not come out
- wider than it is tall around a round mark. */
- padding: .35em .45em;
+ width: 1.5em;
+ height: 1.5em;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ line-height: 1;
cursor: pointer;
font-size: 1.15em;
- line-height: 1;
text-decoration: none;
text-transform: uppercase;
}
- .theme-toggle:hover {
- background-color: var(--bg-secondary);
- }
+ /* Dimmed rather than filled: a background swatch behind a borderless glyph
+ reads as a stray block, not as the control lighting up. */
+ .theme-toggle:hover { opacity: .7; }
/* Smaller on a phone. 1.15em is sized against the desktop measure, where
the control sits alone in a wide margin; on a narrow screen it is
beside the breadcrumb and reads as oversized. */
@media (max-width: 735px) {
- .theme-toggle { font-size: .95em; padding: .3em .4em; }
+ .theme-toggle { font-size: .95em; }
}
</style>
<script>
diff --git a/share/jenny/layout/page.sh b/share/jenny/layout/page.sh
index 2b3110c..7b80a02 100755
--- a/share/jenny/layout/page.sh
+++ b/share/jenny/layout/page.sh
@@ -1036,30 +1036,39 @@ cat << _EOF_
header a { text-decoration: none; color: inherit; }
.theme-toggle {
position: absolute;
- top: 1em;
+ /* On the header's line, centred on it. 2.25rem is the header's own top
+ (1.5rem, the body's margin plus padding) plus half its 1.5rem line, and
+ translateY(-50%) then centres the control on that line whatever size it
+ is. In rem rather than em on purpose: em scales with the control's own
+ font-size, so the same expression put it two pixels out at one size and
+ right at the other. */
+ top: 2.25rem;
right: 1em;
+ transform: translateY(-50%);
+ /* No border. The box around a small glyph was what read as oversized on a
+ phone, more than the glyph itself. The square keeps it a tap target. */
background: none;
- border: 1px solid var(--border-breadcrumb);
+ border: none;
color: var(--text-primary);
- /* A geometric glyph reads smaller than a letter set at the same size,
- and .9em left the control noticeably small against the type it
- sits beside. Padding is square so the button does not come out
- wider than it is tall around a round mark. */
- padding: .35em .45em;
+ width: 1.5em;
+ height: 1.5em;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ line-height: 1;
cursor: pointer;
font-size: 1.15em;
- line-height: 1;
text-decoration: none;
text-transform: uppercase;
}
- .theme-toggle:hover {
- background-color: var(--bg-secondary);
- }
+ /* Dimmed rather than filled: a background swatch behind a borderless glyph
+ reads as a stray block, not as the control lighting up. */
+ .theme-toggle:hover { opacity: .7; }
/* Smaller on a phone. 1.15em is sized against the desktop measure, where
the control sits alone in a wide margin; on a narrow screen it is
beside the breadcrumb and reads as oversized. */
@media (max-width: 735px) {
- .theme-toggle { font-size: .95em; padding: .3em .4em; }
+ .theme-toggle { font-size: .95em; }
}
/* Tooltip styling for footnote and citation references.
Rendered as real DOM elements so links remain interactive.
diff --git a/share/jenny/layout/post.sh b/share/jenny/layout/post.sh
index fd91be5..6934978 100755
--- a/share/jenny/layout/post.sh
+++ b/share/jenny/layout/post.sh
@@ -857,30 +857,39 @@ cat << _EOF_
header a { text-decoration: none; color: inherit; }
.theme-toggle {
position: absolute;
- top: 1em;
+ /* On the header's line, centred on it. 2.25rem is the header's own top
+ (1.5rem, the body's margin plus padding) plus half its 1.5rem line, and
+ translateY(-50%) then centres the control on that line whatever size it
+ is. In rem rather than em on purpose: em scales with the control's own
+ font-size, so the same expression put it two pixels out at one size and
+ right at the other. */
+ top: 2.25rem;
right: 1em;
+ transform: translateY(-50%);
+ /* No border. The box around a small glyph was what read as oversized on a
+ phone, more than the glyph itself. The square keeps it a tap target. */
background: none;
- border: 1px solid var(--border-light);
+ border: none;
color: var(--text-primary);
- /* A geometric glyph reads smaller than a letter set at the same size,
- and .9em left the control noticeably small against the type it
- sits beside. Padding is square so the button does not come out
- wider than it is tall around a round mark. */
- padding: .35em .45em;
+ width: 1.5em;
+ height: 1.5em;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ line-height: 1;
cursor: pointer;
font-size: 1.15em;
- line-height: 1;
text-decoration: none;
text-transform: uppercase;
}
- .theme-toggle:hover {
- background-color: var(--bg-secondary);
- }
+ /* Dimmed rather than filled: a background swatch behind a borderless glyph
+ reads as a stray block, not as the control lighting up. */
+ .theme-toggle:hover { opacity: .7; }
/* Smaller on a phone. 1.15em is sized against the desktop measure, where
the control sits alone in a wide margin; on a narrow screen it is
beside the breadcrumb and reads as oversized. */
@media (max-width: 735px) {
- .theme-toggle { font-size: .95em; padding: .3em .4em; }
+ .theme-toggle { font-size: .95em; }
}
/* Tooltip styling for footnote and citation references.
Rendered as real DOM elements so links remain interactive.