composeui.core.webstyle¶
The look of the web app: its colors, shapes and font, and stylesheets of its own.
Pass a WebStyle to composeui.core.application.run as web_style. The other backends
ignore it. Each value is checked as it is set: a color that doesn’t parse, or a text color
that a reader can’t tell from its background, raises ValueError.
- class composeui.core.webstyle.Palette[source]¶
Bases:
objectThe colors of a theme, light or dark, each
#rrggbboroklch(L C H).A color left out keeps ComposeUI’s. A
*_contentcolor is the text on its color, e.g. a primary button’s text onprimary;base_contentis the text on the page.- __init__(*, base_100=None, base_200=None, base_300=None, base_content=None, primary=None, primary_content=None, secondary=None, secondary_content=None, accent=None, accent_content=None, neutral=None, neutral_content=None, info=None, info_content=None, success=None, success_content=None, warning=None, warning_content=None, error=None, error_content=None)¶
Method generated by attrs for class Palette.
- Parameters:
base_100 (str | None)
base_200 (str | None)
base_300 (str | None)
base_content (str | None)
primary (str | None)
primary_content (str | None)
secondary (str | None)
secondary_content (str | None)
accent (str | None)
accent_content (str | None)
neutral (str | None)
neutral_content (str | None)
info (str | None)
info_content (str | None)
success (str | None)
success_content (str | None)
warning (str | None)
warning_content (str | None)
error (str | None)
error_content (str | None)
- Return type:
None
- class composeui.core.webstyle.Theme[source]¶
Bases:
objectThe colors of the web app, light and dark, its shapes and its font.
The header’s Theme menu still picks light, dark, or the browser’s preference. A value left out keeps ComposeUI’s. Where a palette sets a text color or its background, the two must keep a contrast of 4.5:1 (WCAG AA), ComposeUI’s color standing in for the one left out.
- font: str | None¶
The text’s font, e.g.
'"Inter", sans-serif': a font the browser has, or one that a stylesheet of theWebStyledeclares with@font-face.
- __init__(*, light=NOTHING, dark=NOTHING, radius_field=None, radius_box=None, radius_selector=None, border=None, font=None)¶
Method generated by attrs for class Theme.
- class composeui.core.webstyle.WebStyle[source]¶
Bases:
objectThe look of the web app: its
theme, thenstylesheetsof its own.The web server serves
folderat/_composeui/style/files/: the stylesheets, and the fonts and images they name by a relativeurl(...). Its hidden files, and any file outside it, are not served. The stylesheets load after ComposeUI’s, in their order, so their rules win over its. They select the parts of the page by theirdata-cuiattribute, such as[data-cui="header"]: ComposeUI’s classes are not part of the API. The server checks them as it starts. A missing file, an@import, or aurl(...)that names an address or a file the folder doesn’t serve stops it: the page’s policy would block them.