Scripting API

Scripting API

StyleSheetFiles

Class in Abyss.Core, from Abyss.Core.

A stylesheet's file: .css, CSS as a web page's is, read by bevy_flair. A UI document names the sheets it is styled by, and the project names a theme beneath them all in UiSettings; a rule selects an element by its type — button, text — its classes, its name, and its state — :hover, :active, :focus — and sets what it looks like and how it is laid out, with transitions and @keyframes.

public static class StyleSheetFiles

Remarks

An element's own values, as its document gives them, are beneath every rule: what a rule stops setting goes back to them, as the hover on a button ends.

Methods

Is

public static bool Is(string path)

Whether a path names a stylesheet, by its extension.

Parameters

  • path

ImagesNamedIn

public static IEnumerable<string> ImagesNamedIn(string css)

The images a stylesheet's rules name, as the sheet writes them: each url() or string naming an image, or a localized asset, outside its @font-face and @import rules, as background-image: url("panel.png"); and -bevy-image: "/ui/flag.localized"; do; StyleSheetFiles.Resolved gives the file each names. The engine reads each as it reads an image, its import in a built game's pack, so a build packs each with the sheet.

Parameters

  • css

Resolved

public static string Resolved(string sheet, string written)

The path under the asset root of the file a sheet at sheet names as written, as bevy_flair reads it and as a web page's sheet is read: from the root of the sheet's own files after a slash, /ui/panel.png; a package's, acme.demo://ui/panel.png, as it is; and otherwise from the sheet's folder, so a sheet in ui naming panel.png and ../fonts/a.ttf names ui/panel.png and fonts/a.ttf (bevy_flair_css_parser 0.9.0, src/utils.rs:9-17, from the sheet's folder; bevy_asset 0.20.1, src/path.rs:352-372). A package's sheet names its own package's files so.

Parameters

  • sheet: The sheet's path: ui/menu.css, or acme.demo://ui/menu.css for a package's.
  • written: What the sheet writes: panel.png.

Written

public static string Written(string sheet, string path, string like)

What a sheet at sheet writes to name path where it wrote like, as it wrote that: in the same folder, the same way with the new name; from the root after a slash where it was so; and otherwise from the sheet's folder. A file of another package's, or of the game's from a package's sheet, by its whole name.

Parameters

  • sheet: The sheet's path.
  • path: The file to name, under the asset root: ui/flag.localized.
  • like: What the sheet wrote naming the file it named before: flag.png.

BesideDocument

public static string BesideDocument(string document)

The sheet a document at document is made with beside it: the same name, .css for .ui.

Parameters

  • document

New

public static string New()

What Create's Style Sheet makes: a rule for each kind of thing a sheet says, written out as an example to change — a class, a button's states with a transition between them, and text.

Starter

public static string Starter()

The look of a document UiDocumentFiles.New makes, as the sheet beside it holds it — its title, and a button lit as the pointer is over it and darker as it is pressed — where the document keeps its layout.

Constants

Extension

public const string Extension = ".css"

The extension a stylesheet has.