topmark.core.presentation¶
Semantic presentation primitives for human-facing rendering.
This module defines a small, stable vocabulary of semantic style roles and a lightweight enum base that can carry such roles.
The key goal is to keep core code free of any concrete presentation backend (ANSI, Rich, yachalk, etc.) while still allowing it to attach meaningful styling intent to domain concepts.
Core modules should depend only on:
StyleRole: semantic roles such as ERROR/WARNING/OK/CHANGED.StyledStrEnum: an enum whose.valueis a plainstrplus an attached semantic role via.role.
The CLI (or any other renderer) is responsible for mapping StyleRole values to actual presentation
(color, bold, icons, etc.).
Design notes
- Keep the
StyleRolevocabulary small and stable. - Prefer mapping richer domain concepts onto
StyleRolerather than introducing per-module style enums. - Keep enum values as plain strings for deterministic serialization.
StyleRole ¶
Bases: str, Enum
Semantic styling role for human-facing rendering.
StyleRole expresses meaning (severity, outcome, emphasis) without prescribing a concrete
presentation (color/bold). The CLI (or any other renderer) is responsible for mapping roles to
an actual style backend.
Notes
Keep this vocabulary small and stable. Prefer mapping richer domain concepts (e.g.,
DiagnosticLevel, Cluster, *Status) onto these roles rather than introducing per-module
style enums.
StyledStrEnum ¶
Bases: str, Enum
Enum whose value is a display string and that carries a semantic StyleRole.
This is a backend-agnostic enum helper: core code attaches semantic meaning (StyleRole)
without depending on any renderer. Core code can attach semantic meaning (e.g.,
ERROR/WARNING/OK) without importing terminal styling libraries. Renderers (CLI, rich,
etc.) can map StyleRole to concrete presentation.
Notes
Keep the enum value (.value) as a plain string for stable serialization.
The semantic role is exposed via .role.