Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Pinax"
uuid = "e782a80a-1ac9-479e-ba2b-0f3433ef5b4f"
version = "0.1.7"
version = "0.1.8"
authors = ["sota shimozono <shimozono-sota631@g.ecc.u-tokyo.ac.jp>"]

[deps]
Expand Down
19 changes: 19 additions & 0 deletions src/themes/gallery.jl
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,25 @@ const _GALLERY_CSS = """
}
:root[data-theme="dark"]{$_DARK_TOKENS
}
/* A figure carries its own white, inside the SVG, where no stylesheet can reach it — and it
should: the axes and labels are dark ink, and taking the paper away would leave them on a dark
page unreadable. So the page does not take it away, it turns the lamp down. `brightness(.85)`
makes the paper #d9d9d9, which still reads as paper and stops being a light source.

Measured at that value: inside the figure, ink/paper 14.9, axis/paper 7.2, a plotted line
4.4 — all still clear (a line is a graphical object, which wants 3). Against the card it sits
on, 12.3. It is a mitigation and not a fix; the fix would be figures that are not drawn on
white in the first place, and that is the report author's to choose. */
@media (prefers-color-scheme:dark){
:root:not([data-theme="light"]) figure img,
:root:not([data-theme="light"]) .card-thumb img,
:root:not([data-theme="light"]) iframe.pinax-pdf,
:root:not([data-theme="light"]) .card-thumb-pdf{filter:brightness(.85)}
}
:root[data-theme="dark"] figure img,
:root[data-theme="dark"] .card-thumb img,
:root[data-theme="dark"] iframe.pinax-pdf,
:root[data-theme="dark"] .card-thumb-pdf{filter:brightness(.85)}
/* The control itself. Out of the flow, out of the way, and out of print.

Measured, and the measurement changed it. The pill's fill is --card on a --bg page: 1.04:1 in
Expand Down
8 changes: 7 additions & 1 deletion test/test_appearance.jl
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,13 @@ end
#
# It is loaded into the same document as the theme's own stylesheet, in both asset modes, so
# the tokens are in scope there. Nothing stopped it using them except that nobody had.
literals(css) = [m.match for m in eachmatch(r"#[0-9a-fA-F]{3,6}\b", css)]
# Comments first. A palette worth reading is a palette worth annotating, and a colour named in
# a `/* … */` — "brightness(.85) makes the paper #d9d9d9" — is not a colour the sheet draws
# with. Archeion's equivalent check learned this before this one did.
literals(css) = [
m.match for
m in eachmatch(r"#[0-9a-fA-F]{3,6}\b", replace(css, r"/\*.*?\*/"s => ""))
]

@test isempty(literals(Pinax._asset("pinax.css")))

Expand Down
Loading