This quickstart walks you through the essential building blocks of mapres — from the zero-setup global resolver right through to layered DataMaps and the built-in color and time utilities. By the end you will have a working resolution pipeline and a clear mental model of how all the pieces fit together.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/iFamishedX/mapres/llms.txt
Use this file to discover all available pages before exploring further.
Install and import mapres
Install the package from PyPI if you have not already done so, then import what you need:
Resolve strings with the global res() shortcut
The fastest way to use mapres requires zero configuration. The module-level
res() function wraps a default MapResolver with no layers and resolves {key} placeholders from keyword arguments you pass directly:The global
res() function uses a default resolver with no layers — pass values as keyword arguments. For layered DataMaps, syntax providers, or pipeline transforms, create a MapResolver instance directly (see the next steps).Define a typed DataMap
A DataMap is a regular Python dataclass decorated with The four available syntax styles are:
You can also use the decorator shortcut forms
@datamap. It carries its own placeholder syntax and exposes all its fields as a resolved key-value map via as_map(). Choose a syntax style per class using the built-in syntax constants:| Constant | Pattern | Example |
|---|---|---|
syntax.braces | {key} | {name} |
syntax.dollars | ${key} | ${name} |
syntax.angles | <key> | <name> |
syntax.percents | %key% | %name% |
@datamap.braces, @datamap.angles, @datamap.dollars, and @datamap.percents without passing arguments.Build a LayerStack and resolve with MapResolver
For real applications you will compose multiple DataMaps into a You can also pass
LayerStack, where each Layer has a priority — lower numbers are applied first, and higher-priority layers win when the same key exists in more than one layer. Pass the stack to a MapResolver and call resolver.res():extra_maps or override_maps at call-time without modifying the base stack:Use the built-in ColorMap and TimeMap
mapres ships two ready-made DataMaps. ColorMap — Minecraft § codes:TimeMap — live timestamps:Available time alias and maps namespace:The All color and time exports are also available through the
ColorMap uses <key> syntax and maps colour names to ANSI escape codes (or Minecraft § codes). TimeMap uses %key% syntax and dynamically provides live date and time values.ColorMap — terminal ANSI colours:TimeMap keys include: %hh%, %h%, %hh12%, %h12%, %ampm%, %mm%, %m%, %ss%, %s%, %ms%, %YYYY%, %MM%, %DD%, and %weekday%.strip_colors — remove all colour codes:strip_colors is a pre-built ColorMap instance where every colour name maps to an empty string. Use it to strip colour placeholders from a string without producing any ANSI or Minecraft codes:time export is an alias for the TimeMap class itself — both names refer to the same object:maps namespace object, which groups them for convenience:Next steps
Core Concepts
Deep-dive into DataMaps, LayerStack priority resolution, and the full MapResolver API.
Built-in Maps
Explore all ColorMap colour names, Minecraft colour codes, and the complete TimeMap token reference.
Pipeline Guide
Learn how to chain transform stages through the MapResolver pipeline to pre- or post-process resolved strings.