-
public class StyleEngine
-
-
Field Summary
Fields Modifier and Type Field Description public final static StyleEngineINSTANCE
-
Method Summary
Modifier and Type Method Description final TextStyleapplyTextStyle(TextStyle base, TextStyleConfig config)Apply TextStyleConfig to a Compose TextStyle. final ModifierapplyContainerStyle(Modifier $self, ElementStyleConfig style)Apply ElementStyleConfig as Modifier extensions. final ModifierapplyBlockContainerStyle(Modifier $self, Map<String, Object> fieldConfig)SPEC-401-A R9 — universal block-container styling, ported from iOS ContentBlockTypes.swift:744-786 applyBlockContainerStyle.final ColorparseColor(String hex)Parse a hex color string to Compose Color. -
-
Method Detail
-
applyTextStyle
final TextStyle applyTextStyle(TextStyle base, TextStyleConfig config)
Apply TextStyleConfig to a Compose TextStyle.
-
applyContainerStyle
final Modifier applyContainerStyle(Modifier $self, ElementStyleConfig style)
Apply ElementStyleConfig as Modifier extensions.
-
applyBlockContainerStyle
@Composable() final Modifier applyBlockContainerStyle(Modifier $self, Map<String, Object> fieldConfig)
SPEC-401-A R9 — universal block-container styling, ported from iOS
ContentBlockTypes.swift:744-786 applyBlockContainerStyle.iOS applies this modifier to EVERY ContentBlock at
ContentBlockRendererView.swift:67(.applyBlockContainerStyle(block)) so any block type — text/image/row/input/etc. — can opt into a container background, blur effect, border, and corner radius viafield_configkeys:blur_background: Bool→ frosted-glass effectcontainer_bg_color: Stringcontainer_opacity: Double(preferred) orbackground_opacity(legacy)container_border_width: Doublecontainer_border_color: Stringcontainer_corner_radius: Double
Previously Android only honoured these on the
rowblock, so any authored container styling on a non-row block silently dropped.Opt-in: if blur is off, container_bg_color is empty/white/transparent, AND no visible border, this returns
thisunchanged. Same opt-in gate as iOS to avoid phantom backgrounds from stale color-picker defaults.Blur caveat: Compose's
Modifier.blur(...)(API 31+) blurs the MODIFIER's content, not the content BEHIND it the way iOS.ultraThinMaterialdoes. Without a HazeChild library we approximate frosted-glass with a translucent white layer; the effect on solid backgrounds is similar enough for parity.
-
parseColor
final Color parseColor(String hex)
Parse a hex color string to Compose Color.
Byte order matches iOS
Color(hex:)inPaywalls/PaywallHelperViews.swift:6-char → RGB, alpha = 0xFF
8-char → RGBA (R, G, B, A — NOT Compose's default ARGB long form)
"transparent" / "clear" → Color.Transparent
any other / parse failure → Color.Transparent (matches iOS fallback
(0, 0, 0, 0))
SPEC-070-A A.2 — fixes the prior
Color(colorLong)ARGB interpretation that rotated channels for every console-saved RGBA color.
-
-
-
-