Skip to content

dj.Diagram theme: make the font configurable, and reconcile the tier palette with DataJoint brand colors #1539

Description

@dimitri-yatsenko

Two theme gaps surfaced by putting a dj.Diagram figure through a brand review (dj-thought PR #55/#57, where the generated diagram is published in a blog essay). Both are in src/datajoint/diagram.py; both would improve every DataJoint diagram, which is why they belong here rather than in a post-process downstream.

1. 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 the house typeface has no way to ask for it — the only options are patching or post-processing the SVG. Proposal: add fontname to _DIAGRAM_THEMES (defaulting to "Helvetica", no behavior change) and read it at both sites. Small and mechanical.

Motivation: DataJoint brand typography is Roboto (body) / Roboto Slab (headings), and brand-produced versions of the same figure use them. A theme key lets published figures match without leaving the generator.

2. The tier palette and the brand palette have diverged

Brand-produced art for the same schema uses different values from _DIAGRAM_THEMES["light"]:

Tier Library today (fill / stroke) Brand-produced version
Manual #E7F3EC / #2F7D5B #DCEFDA / #171C39
Lookup #F2F4F7 / #A9B1BD #F1F2F6 / #171C39
Imported #E2ECFA / #2A5FA5 #D6EDF9 / #171C39
Computed #FBEAEC / #B23A48 #FFE7DB / #171C39
Part #FFFFFF / #9AA6B8 #FFFFFF / #171C39

Two real differences, not just drift:

  • Computed reads peach in the brand version, red/pink in ours.
  • The brand version uses one uniform stroke (#171C39 navy) for every tier and carries tier in the fill alone; the library varies stroke per tier.

The fills are a straightforward "which values win" question for the brand owner. The uniform-stroke choice deserves argument before adoption: per-tier stroke is doing accessibility work. It keeps tiers distinguishable in grayscale and print, and gives a second channel beyond hue for readers with color-vision deficiency, where near-pastel fills alone are weak. I'd keep per-tier strokes unless there's a reason I'm missing, and reconcile only the fills.

Also unused-but-present: the brand palette has an accent cyan #00A0DF with no counterpart in the theme.

Not proposed

Per-table icons appear in the brand-produced version (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.

Suggested split

(1) is uncontroversial and unblocks downstream users now. (2) needs a call from whoever owns the brand palette; happy to open (1) as a PR on its own.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions