Expand description
Kits as packages (docs/kit-packages.md): a folder holding a kit’s
tokens, its fonts and its licence, read at run time or embedded in the
binary.
underline-tabs/
kit.yaml a DTCG token file, like a theme (`$extends`, tokens);
`kit.json` is read too
*.tokens.yaml optional: more tokens, one file per component
(`.tokens.json` is read too)
fonts/*.ttf|otf optional: faces for the families the tokens name
LICENSE optional: the kit's licence (and its fonts')
icons/ reserved: not read yetkit.yaml is a theme: its name is the folder’s, unless its manifest
($extensions."org.egui-pop.kit") gives one, and it extends pop-dark
unless it says otherwise. A face’s family and weight come from its
file name (Inter-SemiBold.ttf is Inter at 600), or from the
manifest when given:
$extends: "pop-dark"
$extensions:
org.egui-pop.kit:
name: "brand"
label: "Brand"
fonts:
- {file: "JetBrainsMono-Regular.ttf", family: "JetBrains Mono", weight: 400}A kit may hold both variants of its look, light and dark: the
manifest’s counterpart gives the other variant’s name, label and
tokens (a token tree, with its own $extends). It becomes a theme of
its own, each naming the other as its counterpart
(crate::VARIANT_OF_EXTENSION), so the light, dark or system
setting switches between them. kit.yaml’s own tokens are its
variant’s only; the other token files (*.tokens.yaml) and the faces
serve both.
$extends: "pop-dark"
$extensions:
org.egui-pop.kit:
name: "brand-dark"
label: "Brand Dark"
counterpart:
name: "brand-light"
label: "Brand Light"
tokens:
$extends: "pop-light"
surface: {panel: {$type: "color", $value: "#fafafa"}}
surface: {panel: {$type: "color", $value: "#101010"}}Reading a kit never fails: what is wrong (bad YAML or JSON, a term outside the
vocabulary, a font file missing) is in KitData::problems, and the
kit is still usable with fallbacks (a kit whose kit.yaml cannot be
read is pop-dark under the kit’s name).
let kit = egui_pop_tokens::kit::KitData::from_text(
"underline",
r#"
tab:
shape: {$type: "string", $value: "underline"}
"#,
);
assert!(egui_pop_tokens::kit::check(&kit).is_empty());
let mut themes = egui_pop_tokens::Themes::default();
themes.add_kit(&kit);
assert!(themes.get("underline").is_some());Structs§
- Embedded
- What
kit!embeds: the folder’s files, named as in the folder. - KitData
- A kit’s data: its tokens (a theme), its faces and its licence, with
what was wrong reading them. A kit with code adds its handlers
around it (
egui_pop_core::kit::KitSource). - KitFont
- A face a kit ships, for the families its tokens name.
- KitInfo
- A kit as a theme picker shows it.
- KitVariant
- A kit’s other variant (
KitData::counterpart): the manifest’scounterpart, with the kit’s other token files merged in.
Enums§
- Origin
- Where a kit was read from.
- Problem
- What is wrong with a kit. The kit is usable anyway: each problem says what is done instead.
Constants§
- COMPONENT_
TERMS - The terms that do not change with the state (
component.term), with their type. - DISTINCT_
GLYPHS - Glyph roles that must keep shapes of their own (
glyph.<role>), so that colour never carries a state alone: no two roles of a pair may name the same icon. The LEDs off, on, warning and error differ from each other, a busy LED from all but the on one (it pulses, or shows a still ring under reduced motion), and the four named flags from each other.checkreports a kit breaking it, and egui-pop draws its own shapes for those roles. - KIT_
EXTENSION - Where a kit’s manifest lives in
kit.yaml’s root$extensions. - KIT_
FILE - The file every kit folder has.
- KIT_
FILES - The names a kit folder’s
KIT_FILEmay have, the first found read. - STATES
- The six states (
docs/kit.md), in the order their boxes apply. - STATE_
TERMS - The terms a state gives (
component.state.term), with their type. - TOKEN_
FILE_ ENDINGS - The endings of a kit’s other token files.
- TONES
- The tones a component may give (
component.tone.<tone>.<term>andcomponent.tone.<tone>.<state>.<term>). - USER_
KITS_ DIR - The folder under an application’s configuration directory where the
user’s kits are found (
discover).
Functions§
- check
- Every problem of a kit: reading it, and resolving its theme over the
built-in ones. An application’s tests call it on the kits it embeds,
since
kit!checks nothing when compiling: - discover
- The kits found in a folder: each sub-folder holding a
kit.yaml, by name (anything else is not a kit and is skipped). An application’s user kits are in<config>/kits(USER_KITS_DIR); a folder that does not exist has none. - discover_
with discoverthrough a given cache (KitData::load_with).- kit_
file - A kit folder’s
KIT_FILE, under the first ofKIT_FILESfound. - same_
glyphs - The pairs of
DISTINCT_GLYPHSnaming the same icon in a resolved theme, with that icon’s name.
Type Aliases§
- Bytes
- A font file’s bytes: embedded in the binary or read at run time.