from Css
fun fromCss(cssText: String, name: String, backgroundColor: Color? = null, defaultTextColor: Color? = null): HighlightTheme
Custom theme from raw Highlight.js CSS text.
Use this when you fetch or generate CSS at runtime rather than bundling it as an asset.
val css = // ... fetch from network or build programmatically
val theme = HighlightTheme.fromCss(
cssText = css,
name = "my-runtime-theme",
)Content copied to clipboard
Return
A HighlightTheme whose color map is lazily parsed from cssText.
Parameters
css Text
Raw Highlight.js-compatible CSS text.
name
Display name for the theme.
background Color
Optional explicit background color known ahead of time. When provided, this color is available immediately without waiting for CSS parsing.
default Text Color
Optional explicit default text color known ahead of time. When provided, this color is available immediately without waiting for CSS parsing.