Class ColorSlug
--izc-<slug>, that a color reference becomes on the client (THEME-DESIGN.md section 4.2, ruling Q11).The slug is a pure function of the reference string, computed the same way here and in iz/prop/color.js (GColor.slug), so that the server's app block and the client's var() meet on one name without the name travelling on the wire: the module prefix Mod: becomes mod-, a leading /style/ is dropped, every / becomes -, the whole is lower-cased, and every other character outside a-z0-9 becomes -, runs collapsed, ends trimmed. Lib:/style/Brand/Primary is lib-brand-primary, /style/Brand/Primary is brand-primary, the role Accent is accent.
Two different paths can fold to one slug (Brand/Primary and brand-primary, or the same style-relative path in two modules). The generator of the app block (AppPaletteCSS) claims every slug in a ColorSlug.Table and refuses a colliding pair rather than letting one silently win.
- Author:
- Christopher Mindus
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThe slug table of one app block: every custom property name the block defines and what defines it, so that two definitions of one name are found rather than let the later one win.Field Summary
FieldsMethod Summary
Field Details
PREFIX
Method Details
of
Gets the slug of a color reference.- Parameters:
ref- The reference, without the leading%: a module-qualifiedMod:/style/A/B, a module-relative/style/A/B, or a bare name.- Returns:
- The slug, possibly empty for a reference of nothing but separators.
- Throws:
NullPointerException- Ifrefis null.
property
Gets the custom property of a color reference:PREFIXand the slug.- Parameters:
ref- The reference, as forof(String).- Returns:
- The custom property name, e.g.
--izc-lib-brand-primary.