engine/theme_intent library
Steering hints for generated themes (engine v4): a small, bounded, JSON-friendly description of the look a host wants ("playful greenery" → light, green and lime, vivid, analogous).
The package never sees the user's words. A host turns them into a ThemeIntent however it likes (an on-device model, mood chips, a keyword table) and the generator narrows its seeded draws to the intent. Every guardrail still runs, so an intent can change how a theme feels but never make its keys unreadable.
- ThemeIntent.parse / ThemeIntent.fromJson accept anything and never throw: unknown keys and values are dropped and reported.
- ThemeIntent.vocabulary is the field and value list as data, with a one-line description each; ThemeIntent.jsonSchema and ThemeIntent.promptFragment are generated from it.
- ThemeIntent.reportFor lists the hints a family cannot honour.
Pure Dart (no Flutter, no dart:math).
Classes
- IntentField
- One field of the intent vocabulary.
- IntentNote
- One hint a family cannot honour, from ThemeIntent.reportFor.
- IntentParseResult
- ThemeIntent.parse output: the intent plus what was dropped.
- IntentValue
- One allowed value of a vocabulary field.
- ThemeIntent
- Steering hints for generated themes. Every field is optional; an empty intent means an ordinary unsteered theme.
Enums
- IntentChroma
- How colourful a steered theme is.
- IntentColor
- A named colour a host (or its model) can ask for. Each maps to an OKLCH hue range; some also lean the theme dark, light or muted when the intent does not say otherwise.
- IntentFieldKind
- How a vocabulary field takes values.
Constants
- firstSteerableEngineVersion → const int
- The first engine version that understands a ThemeIntent.
-
harmonyWords
→ const Map<
HarmonyScheme, String> - Vocabulary words for the harmony schemes (stable).
-
steerableFamilies
→ const Set<
ThemeFamily> - The families that honour steering at the newest engine version: every enabled family (engine v5). ThemeIntent.reportFor lists the hints a family can't follow.
Functions
-
brightnessAllowed(
FamilyDefinition def, ThemeBrightness b) → bool -
Whether
defever drawsb. -
familySteerableAt(
ThemeFamily family, int engineVersion) → bool -
Whether
familyfollows an intent's colours atengineVersion(otherwise it takes only the name).