dj.Diagram theme: make the font configurable
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 76/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- python
- Área
- data-visualization
Línea de trabajo
Comienza en src/datajoint/diagram.py localizando los dos sitios actuales donde se usa Helvetica e inspecciona _DIAGRAM_THEMES después de las recientes reescrituras de diagramas. Añade la configuración de tema opt-in conservando Helvetica de forma predeterminada, asegúrate de que ambos sitios la usen y verifica que los diagramas sin una sobrescritura conserven su diseño existente; actualiza las indicaciones sobre la fuente para mencionar el opt-in explícito y la salvedad sobre el diseño.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Narrowed 2026-09-09. This issue originally carried two theme gaps. The second — reconciling the tier palette with the brand palette — was split into #1543 and shipped in 2.3.3 via #1544. Only the
fontnamehalf below remains open. See the closing note for what was decided on the palette.Amended 2026-09-10. The motivation below originally stated the brand typefaces the wrong way round, and proposed the theme key without acknowledging that diagram themes deliberately do not carry fonts. Both are corrected in place.
Surfaced by putting a dj.Diagram figure through a brand review, where the generated diagram is published in a blog essay. In src/datajoint/diagram.py; it would improve every DataJoint diagram, which is why it belongs here rather than in a post-process downstream.
fontname is hardcoded
node.set_fontname("Helvetica") # ~line 1596
fontname="Helvetica", # schema label in a sans font ~line 1696
Two hardcoded sites, so a caller who wants a different typeface has no way to ask for it. Proposal: add fontname to _DIAGRAM_THEMES, defaulting to "Helvetica", and read it at both sites. Small and mechanical, and no behavior changes for anyone who does not set it.
Note the line numbers above predate the 2.3.3 diagram work (#1534, #1544, #1545), which rewrote much of this file — locate the two Helvetica sites rather than trusting them.
Why the default has to stay Helvetica
Graphviz sizes node boxes using the face it actually finds on the machine doing the rendering. A fontname the environment lacks does not fall back gracefully: it changes text metrics, and therefore node dimensions and layout. That is why the shipped themes change colors only, never fonts, and why this proposal is opt-in rather than a new default.
It also means the two mechanisms are not interchangeable:
- Setting
fontnameaffects layout. It is correct only where the caller controls the rendering environment and knows the face is installed. - Restyling the emitted SVG — applying a CSS
font-familystack to an inlined SVG — is display-only and cannot disturb layout, provided the substitute is metrically close to Helvetica. For DataJoint-controlled surfaces publishing a figure, this remains the safer route, and it is what docs and published figures use today.
So this issue asks for a caller-controlled escape hatch, not a replacement for SVG restyling. If the theme key lands, the guidance that themes do not change fonts needs amending to say "except by explicit opt-in, with the layout caveat above."
Motivation
DataJoint brand typography assigns Roboto to titles and headings, Roboto Slab to body and paragraphs, and Source Code Pro to code. Diagram node and cluster labels are body-tier text rather than headings, so a brand-aligned caller would set Roboto Slab — not Roboto. Whether Roboto Slab is the right weight for a short label inside a shape is a separate question: the weight is specified against continuous prose, and a diagram label is neither prose nor a heading.
Stating this because the earlier text had the two faces reversed, and a fontname default chosen from it would have pointed at the wrong face.
Not proposed
Per-table icons appear in hand-designed versions of the same figure (a person for Subject, a test tube for Sample, and so on). They read well, but nothing in a schema derives them — they would need a hand-maintained table→icon map, which reintroduces exactly the drift that generating the figure exists to prevent. Better left to hand-made cover art.
Monospace labels. Table names are code identifiers, but diagram text is proportional by design: a docs diagram should look like the one the reader just generated locally. Source Code Pro does not belong in a diagram, whatever fontname allows.
- Lenguaje dominante
- Python
- Estrellas
- 197
- Forks
- 98
- Merge medio
- 6 d 10 h
- PR fusionados (30 d)
- 4
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de datajoint/datajoint-python
-
dj.Diagram SVG output is not byte-reproducible: set iteration order leaks into node emission order Abiertobug
Dificultad 3/5 1-2 días Aptitud para principiantes 78/100
datajoint/datajoint-python#1551 ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
datajoint/datajoint-python#1550 ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
datajoint/datajoint-python#1547 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
datajoint/datajoint-python#1546 · 1 comentario ·
-
Make key_source restrict-only: add key_source_restriction, deprecate parent-redefining overrides Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
datajoint/datajoint-python#1523 · 1 comentario ·
Todos los issues de datajoint/datajoint-python
Issues similares
-
bug ci good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
documentation
Dificultad 2/5 Medio día Aptitud para principiantes 62/100
inmanta/inmanta-core#10835 ·
-
sponsored
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
opensubtitlescom: moviehash never sent when opensubtitles (.org) is not in the provider list Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
Diaoul/subliminal#1382 ·