Skip to content

Commit 9440de3

Browse files
rdhyeeclaude
andauthored
Centralize SOURCE_COLORS palette; re-capture hero globe (fixes #113) (#114)
* Fix explorer cross-filter tests for Observable compatibility Observable Inputs.checkbox doesn't respond to programmatic clicks (force, dispatchEvent, or JS .click()) in headless Playwright. Skip the 3 interaction tests with clear reason. Keep: - Baseline count verification (SESAR > 4M) — passes - Parquet endpoint reachability — passes - Increase facet wait timeout to 60s for DuckDB-WASM init Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Centralize SOURCE_COLORS palette; re-capture hero globe Extracts the source color palette to a single module at assets/js/source-palette.js, imported by the Interactive Explorer, Progressive Globe tutorial, parquet_cesium_isamples_wide tutorial, and the hero globe capture page. The hero globe WebP (assets/isamples_globe.webp) had drifted to a Material Design palette while the tutorials used Google Charts Classic, so OpenContext appeared orange on the landing page but red in the explorer. Re-captured with the canonical palette. capture_globe_rotation.py now expects the server to be rooted at the repo (not tools/) so the relative ../assets/js/source-palette.js import resolves. Fixes #113 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2c6fe90 commit 9440de3

8 files changed

Lines changed: 41 additions & 42 deletions

_quarto.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
project:
22
type: website
33
output-dir: docs
4+
resources:
5+
- assets/js/source-palette.js
46

57
website:
68
title: "iSamples"

assets/isamples_globe.webp

563 KB
Loading

assets/js/source-palette.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Canonical iSamples source palette.
2+
// Keep in sync across hero globe, Interactive Explorer, and tutorials.
3+
// See issue #113 for history.
4+
5+
export const SOURCE_COLORS = {
6+
SESAR: '#3366CC',
7+
OPENCONTEXT: '#DC3912',
8+
GEOME: '#109618',
9+
SMITHSONIAN: '#FF9900',
10+
default: '#808080'
11+
};
12+
13+
export const SOURCE_NAMES = {
14+
SESAR: 'SESAR',
15+
OPENCONTEXT: 'OpenContext',
16+
GEOME: 'GEOME',
17+
SMITHSONIAN: 'Smithsonian'
18+
};

tools/capture_globe_rotation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
brew install webp ffmpeg # for img2webp and ffmpeg
1010
1111
Usage:
12-
# 1. Serve this directory locally:
13-
python -m http.server 8765 --directory tools/
12+
# 1. Serve the repo root locally (so /assets/js/source-palette.js resolves):
13+
python -m http.server 8765
1414
1515
# 2. Run the capture:
1616
python tools/capture_globe_rotation.py
@@ -35,7 +35,7 @@
3535

3636
async def capture_globe(num_frames=120, duration_sec=15, output_path="/tmp/isamples_globe.webp",
3737
width=800, height=500, quality=40,
38-
url="http://localhost:8765/globe_capture.html"):
38+
url="http://localhost:8765/tools/globe_capture.html"):
3939
from playwright.async_api import async_playwright
4040

4141
frame_dir = tempfile.mkdtemp(prefix="globe_frames_")
@@ -163,7 +163,7 @@ def main():
163163
parser.add_argument("--width", type=int, default=800, help="Width in pixels (default: 800)")
164164
parser.add_argument("--height", type=int, default=500, help="Height in pixels (default: 500)")
165165
parser.add_argument("--quality", type=int, default=40, help="WebP quality 0-100 (default: 40)")
166-
parser.add_argument("--url", default="http://localhost:8765/globe_capture.html", help="Page URL")
166+
parser.add_argument("--url", default="http://localhost:8765/tools/globe_capture.html", help="Page URL")
167167
args = parser.parse_args()
168168

169169
asyncio.run(capture_globe(

tools/globe_capture.html

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<div id="cesiumContainer"></div>
1818
<script type="module">
1919
import * as duckdb from 'https://cdn.jsdelivr.net/npm/@duckdb/duckdb-wasm@1.29.0/+esm';
20+
import { SOURCE_COLORS } from '../assets/js/source-palette.js';
2021

2122
// Ion token from progressive_globe.qmd
2223
Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIwNzk3NjkyMy1iNGI1LTRkN2UtODRiMy04OTYwYWE0N2M3ZTkiLCJpZCI6Njk1MTcsImlhdCI6MTYzMzU0MTQ3N30.e70dpNzOCDRLDGxRguQCC-tRzGzA-23Xgno5lNgCeB4';
@@ -92,13 +93,10 @@
9293
lon: Number(r.center_lng)
9394
}));
9495

95-
// Color by source
96-
const sourceColors = {
97-
SESAR: Cesium.Color.fromCssColorString("#2196F3"),
98-
OPENCONTEXT: Cesium.Color.fromCssColorString("#FF9800"),
99-
GEOME: Cesium.Color.fromCssColorString("#4CAF50"),
100-
SMITHSONIAN: Cesium.Color.fromCssColorString("#E91E63")
101-
};
96+
// Color by source (canonical palette — see issue #113)
97+
const sourceColors = Object.fromEntries(
98+
Object.entries(SOURCE_COLORS).map(([k, hex]) => [k, Cesium.Color.fromCssColorString(hex)])
99+
);
102100

103101
const points = new Cesium.PointPrimitiveCollection();
104102
viewer.scene.primitives.add(points);

tutorials/isamples_explorer.qmd

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,14 @@ cross_filter_url = "https://data.isamples.org/isamples_202601_facet_cross_filter
3737
// Facets file for on-the-fly multi-filter queries (63MB - URI strings, not BIGINT FKs)
3838
sample_facets_url = "https://data.isamples.org/isamples_202601_sample_facets_v2.parquet"
3939
40-
// Source color scheme (consistent with iSamples conventions)
41-
SOURCE_COLORS = ({
42-
'SESAR': '#3366CC', // Blue
43-
'OPENCONTEXT': '#DC3912', // Red
44-
'GEOME': '#109618', // Green
45-
'SMITHSONIAN': '#FF9900', // Orange
46-
'default': '#808080' // Gray
47-
})
40+
// Source color scheme — imported from canonical palette (issue #113)
41+
_palette = await import('../assets/js/source-palette.js')
42+
SOURCE_COLORS = _palette.SOURCE_COLORS
4843
4944
// Cesium colors
5045
function getCesiumColor(source) {
51-
const colors = {
52-
'SESAR': Cesium.Color.fromCssColorString('#3366CC'),
53-
'OPENCONTEXT': Cesium.Color.fromCssColorString('#DC3912'),
54-
'GEOME': Cesium.Color.fromCssColorString('#109618'),
55-
'SMITHSONIAN': Cesium.Color.fromCssColorString('#FF9900'),
56-
};
57-
return colors[source] || Cesium.Color.GRAY;
46+
const hex = SOURCE_COLORS[source];
47+
return hex ? Cesium.Color.fromCssColorString(hex) : Cesium.Color.GRAY;
5848
}
5949
```
6050

tutorials/parquet_cesium_isamples_wide.qmd

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,9 @@ viewof viewModeToggle = Inputs.radio(["clustered", "all points"], {
9595

9696
```{ojs}
9797
//| echo: false
98-
// Source color scheme for cluster coloring
99-
CLUSTER_COLORS = ({
100-
'SESAR': '#3366CC',
101-
'OPENCONTEXT': '#DC3912',
102-
'GEOME': '#109618',
103-
'SMITHSONIAN': '#FF9900',
104-
'default': '#808080'
105-
})
98+
// Source color scheme — imported from canonical palette (issue #113)
99+
_palette = await import('../assets/js/source-palette.js')
100+
CLUSTER_COLORS = _palette.SOURCE_COLORS
106101
107102
// H3 resolution based on camera height
108103
function getH3ResForHeight(height) {

tutorials/progressive_globe.qmd

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,10 @@ wide_url = `${R2_BASE}/isamples_202601_wide.parquet`
206206
facets_url = `${R2_BASE}/isamples_202601_sample_facets.parquet`
207207
facet_summaries_url = `${R2_BASE}/isamples_202601_facet_summaries.parquet`
208208
209-
SOURCE_COLORS = ({
210-
SESAR: '#3366CC', OPENCONTEXT: '#DC3912',
211-
GEOME: '#109618', SMITHSONIAN: '#FF9900'
212-
})
213-
SOURCE_NAMES = ({
214-
SESAR: 'SESAR', OPENCONTEXT: 'OpenContext',
215-
GEOME: 'GEOME', SMITHSONIAN: 'Smithsonian'
216-
})
209+
// Canonical palette — see issue #113
210+
_palette = await import('../assets/js/source-palette.js')
211+
SOURCE_COLORS = _palette.SOURCE_COLORS
212+
SOURCE_NAMES = _palette.SOURCE_NAMES
217213
218214
// === Source URL: resolve pid to original repository ===
219215
function sourceUrl(pid) {

0 commit comments

Comments
 (0)