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
4 changes: 2 additions & 2 deletions docs/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,400;0,500;1,400&amp;family=Schibsted+Grotesk:wght@400;500;600&amp;family=Besley:wght@400;500;600&amp;display=swap">
<link rel="stylesheet" href="assets/site.css">
<script src="assets/site.js" defer></script>
<link rel="stylesheet" href="assets/site.css?v=16ecc1ba1e">
<script src="assets/site.js?v=66727f1611" defer></script>
</head>
<body>
<header class="mobilebar">
Expand Down
4 changes: 2 additions & 2 deletions docs/blend-modes.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,400;0,500;1,400&amp;family=Schibsted+Grotesk:wght@400;500;600&amp;family=Besley:wght@400;500;600&amp;display=swap">
<link rel="stylesheet" href="assets/site.css">
<script src="assets/site.js" defer></script>
<link rel="stylesheet" href="assets/site.css?v=16ecc1ba1e">
<script src="assets/site.js?v=66727f1611" defer></script>
</head>
<body>
<header class="mobilebar">
Expand Down
4 changes: 2 additions & 2 deletions docs/examples.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,400;0,500;1,400&amp;family=Schibsted+Grotesk:wght@400;500;600&amp;family=Besley:wght@400;500;600&amp;display=swap">
<link rel="stylesheet" href="assets/site.css">
<script src="assets/site.js" defer></script>
<link rel="stylesheet" href="assets/site.css?v=16ecc1ba1e">
<script src="assets/site.js?v=66727f1611" defer></script>
</head>
<body>
<header class="mobilebar">
Expand Down
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,400;0,500;1,400&amp;family=Schibsted+Grotesk:wght@400;500;600&amp;family=Besley:wght@400;500;600&amp;display=swap">
<link rel="stylesheet" href="assets/site.css">
<script src="assets/site.js" defer></script>
<link rel="stylesheet" href="assets/site.css?v=16ecc1ba1e">
<script src="assets/site.js?v=66727f1611" defer></script>
</head>
<body>
<header class="mobilebar">
Expand Down
4 changes: 2 additions & 2 deletions docs/operations.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,400;0,500;1,400&amp;family=Schibsted+Grotesk:wght@400;500;600&amp;family=Besley:wght@400;500;600&amp;display=swap">
<link rel="stylesheet" href="assets/site.css">
<script src="assets/site.js" defer></script>
<link rel="stylesheet" href="assets/site.css?v=16ecc1ba1e">
<script src="assets/site.js?v=66727f1611" defer></script>
</head>
<body>
<header class="mobilebar">
Expand Down
Binary file modified docs/previews/brightness.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/previews/chaining.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/previews/color_burn.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/previews/color_dodge.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/previews/contrast.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/previews/curve_red.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/previews/curve_rgb.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/previews/darken.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/previews/grayscale.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/previews/hard_light.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/previews/hue.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/previews/lighten.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/previews/lightness.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/previews/linear_burn.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/previews/linear_dodge.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/previews/linear_light.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/previews/multiply.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/previews/overlay.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/previews/pin_light.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/previews/resize.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/previews/saturation.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/previews/screen.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/previews/soft_light.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/previews/vivid_light.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 19 additions & 2 deletions scripts/docs_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@

from __future__ import annotations

import hashlib
import html
import re
from dataclasses import dataclass
from functools import cache
from pathlib import Path

REPO_URL = "https://github.com/subwaymatch/layer-is-python"

Expand All @@ -37,6 +40,20 @@ class Page:
# The Layer.is logo (docs/assets/logo.svg), used in the sidebar and as favicon.
LOGO = "assets/logo.svg"

ASSETS_DIR = Path(__file__).resolve().parent.parent / "docs" / "assets"


@cache
def asset_url(name: str) -> str:
"""URL of a file in docs/assets/ with a hash of its contents appended.

GitHub Pages serves assets under fixed names with a 10-minute cache, so
without this a browser can pair a freshly built page with a stale
stylesheet. The hash gives every version of a file its own URL.
"""
digest = hashlib.sha256((ASSETS_DIR / name).read_bytes()).hexdigest()[:10]
return f"assets/{name}?v={digest}"

# GitHub's "mark-github" octicon (MIT licensed, github.com/primer/octicons).
GITHUB_ICON = (
'<svg viewBox="0 0 16 16" width="15" height="15" fill="currentColor" aria-hidden="true">'
Expand Down Expand Up @@ -266,8 +283,8 @@ def page(
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="{esc(FONTS_URL)}">
<link rel="stylesheet" href="assets/site.css">
<script src="assets/site.js" defer></script>
<link rel="stylesheet" href="{asset_url("site.css")}">
<script src="{asset_url("site.js")}" defer></script>
</head>
<body>
<header class="mobilebar">
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate_previews.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

import docs_layout as layout # noqa: E402 (sibling module in scripts/)

DEFAULT_SOURCE = REPO_ROOT / "docs" / "photos" / "gamcheon-village.jpg"
DEFAULT_SOURCE = REPO_ROOT / "docs" / "photos" / "hanbok-portrait.jpg"
PANEL_WIDTH = 480 # width of each before/after panel
GUTTER = 4 # white gap between the two panels
JPEG_QUALITY = 82
Expand Down
Loading