<< lib/ui/SLThemeHint.sleela SLeeLa Standard Library Definition. Definition: SLThemeHint — reads the HINT a source document carries about the flavor it intends, and resolves it to one of the four standard flavors so the renderer can produce the beautiful design. The hint is a single word the program supplies from its own source (e.g. a `#theme blue` convention the app reads, a document-design keyword, or a user setting): "blue", "gray", "black", "white". Unknown/empty hints fall back deliberately to the default flavor rather than guessing, and the resolver always reports both the hint it was given and the flavor it chose -- honest, inspectable intent. Pure SLeeLa; checks + runs. The renderer takes the resolved SLStandardTheme (its role tokens) and draws the UI; it never has to parse the hint itself -- that is this class job. >> #sleela 2.5 material; < Family: ui. Source-hint resolution: a document intended flavor -> a theme. > class SLThemeHint { < ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- > << Eleven catalogued attributes with getter/setter pairs. >> String metaVersion = "1.0.0"; int metaId = 11622; String metaAuthor = "Kiro Agent"; String metaDate = "2026-10-25"; String metaCopyright = "SLeeLa project"; String metaTrademark = "none"; String metaCorporation = "none"; < metaOrigin: National | | International | Galactic > String metaOrigin = "International"; String metaBirthDate = "2026-10-25"; < metaScienceRating: maturity/robustness on a 1..10 scale > int metaScienceRating = 8; < metaNationalSchedule: a real, citable instrument or "none" > String metaNationalSchedule = "none"; String getMetaVersion() { return metaVersion; } void setMetaVersion(String v) { metaVersion = v; } int getMetaId() { return metaId; } void setMetaId(int v) { metaId = v; } String getAuthor() { return metaAuthor; } void setAuthor(String v) { metaAuthor = v; } String getDate() { return metaDate; } void setDate(String v) { metaDate = v; } String getCopyright() { return metaCopyright; } void setCopyright(String v) { metaCopyright = v; } String getTrademark() { return metaTrademark; } void setTrademark(String v) { metaTrademark = v; } String getCorporation() { return metaCorporation; } void setCorporation(String v) { metaCorporation = v; } String getOrigin() { return metaOrigin; } void setOrigin(String v) { metaOrigin = v; } String getBirthDate() { return metaBirthDate; } void setBirthDate(String v) { metaBirthDate = v; } int getScienceRating() { return metaScienceRating; } void setScienceRating(int v) { metaScienceRating = v; } String getNationalSchedule() { return metaNationalSchedule; } void setNationalSchedule(String v) { metaNationalSchedule = v; } < the flavor factory > SLThemeFlavor flavors; < the hint as given, the flavor chosen, and whether it was recognized > String hint; String chosen; int recognized; < the default flavor name when a hint is unknown/empty > String fallbackName; void create() { flavors = new SLThemeFlavor(); flavors.create(); hint = ""; chosen = ""; recognized = 0; fallbackName = "Black"; } < Set the default flavor used when a hint is unknown or empty. > void setFallback(String flavorName) { if (flavorName != null) { fallbackName = flavorName; } } < Resolve a source hint word to a standard theme. Records the hint and the > < chosen flavor, sets recognized, and returns the ready-to-render theme. An > < unknown/empty hint resolves to the fallback flavor (never null). > SLStandardTheme resolve(String sourceHint) { hint = (sourceHint == null) ? "" : sourceHint; SLStandardTheme t = flavors.byName(hint); if (t != null) { recognized = 1; chosen = t.getName(); return t; } < unknown/empty: fall back deliberately and say so > recognized = 0; SLStandardTheme fb = flavors.byName(fallbackName); if (fb == null) { fb = flavors.black(); } chosen = fb.getName(); return fb; } boolean wasRecognized() { return recognized == 1; } String getHint() { return hint; } String getChosen() { return chosen; } < A one-line account of what happened, for logs/inspection. > String report() { if (recognized == 1) { return "theme hint '" + hint + "' -> " + chosen; } return "theme hint '" + hint + "' not recognized -> fell back to " + chosen; } }