1#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
5pub enum Tier {
6 Reference,
9 System,
11 Component,
13}
14
15impl Tier {
16 pub fn name(self) -> &'static str {
17 match self {
18 Tier::Reference => "reference",
19 Tier::System => "system",
20 Tier::Component => "component",
21 }
22 }
23}
24
25#[derive(Clone, Copy, Debug, PartialEq, Eq)]
27pub struct Required {
28 pub path: &'static str,
29 pub ty: &'static str,
31 pub tier: Tier,
32 pub description: &'static str,
33}
34
35const fn sys(path: &'static str, ty: &'static str, description: &'static str) -> Required {
36 Required {
37 path,
38 ty,
39 tier: Tier::System,
40 description,
41 }
42}
43
44pub(crate) const fn comp(
45 path: &'static str,
46 ty: &'static str,
47 description: &'static str,
48) -> Required {
49 Required {
50 path,
51 ty,
52 tier: Tier::Component,
53 description,
54 }
55}
56
57const CORE: &[Required] = &[
60 sys(
61 "transparent",
62 "color",
63 "nothing painted (a part that shows what is behind it)",
64 ),
65 sys(
66 "scrim",
67 "color",
68 "what a backdrop dims the interface with (at opacity.scrim)",
69 ),
70 sys(
71 "shadow.popup.offset-x",
72 "dimension",
73 "a menu's or popover's shadow: offset to the right",
74 ),
75 sys(
76 "shadow.popup.offset-y",
77 "dimension",
78 "a menu's or popover's shadow: offset down",
79 ),
80 sys(
81 "shadow.popup.blur",
82 "dimension",
83 "a menu's or popover's shadow: penumbra width",
84 ),
85 sys(
86 "shadow.popup.spread",
87 "dimension",
88 "a menu's or popover's shadow: growth on every side",
89 ),
90 sys(
91 "shadow.popup.color",
92 "color",
93 "a menu's or popover's shadow: colour",
94 ),
95 sys(
96 "shadow.window.offset-x",
97 "dimension",
98 "a dialog's or palette's shadow: offset to the right",
99 ),
100 sys(
101 "shadow.window.offset-y",
102 "dimension",
103 "a dialog's or palette's shadow: offset down",
104 ),
105 sys(
106 "shadow.window.blur",
107 "dimension",
108 "a dialog's or palette's shadow: penumbra width",
109 ),
110 sys(
111 "shadow.window.spread",
112 "dimension",
113 "a dialog's or palette's shadow: growth on every side",
114 ),
115 sys(
116 "shadow.window.color",
117 "color",
118 "a dialog's or palette's shadow: colour",
119 ),
120 sys(
121 "shadow.side.offset-x",
122 "dimension",
123 "the shadow of a side area lying over the centre: offset towards the centre",
124 ),
125 sys(
126 "shadow.side.offset-y",
127 "dimension",
128 "the shadow of a side area lying over the centre: offset down",
129 ),
130 sys(
131 "shadow.side.blur",
132 "dimension",
133 "the shadow of a side area lying over the centre: penumbra width",
134 ),
135 sys(
136 "shadow.side.spread",
137 "dimension",
138 "the shadow of a side area lying over the centre: growth on every side",
139 ),
140 sys(
141 "shadow.side.color",
142 "color",
143 "the shadow of a side area lying over the centre: colour",
144 ),
145 sys(
146 "surface.canvas",
147 "color",
148 "behind documents, images and graphs",
149 ),
150 sys(
151 "surface.panel",
152 "color",
153 "panels and side bars, the default background",
154 ),
155 sys("surface.raised", "color", "controls at rest"),
156 sys("surface.hover", "color", "a control under the pointer"),
157 sys(
158 "surface.active",
159 "color",
160 "a control being pressed or dragged",
161 ),
162 sys(
163 "surface.overlay",
164 "color",
165 "windows, menus, popups and dialogs",
166 ),
167 sys("surface.sunken", "color", "text fields and wells"),
168 sys("text.default", "color", "ordinary text"),
169 sys("text.muted", "color", "secondary text, hints"),
170 sys(
171 "text.strong",
172 "color",
173 "titles, emphasis, text under the pointer",
174 ),
175 sys("text.on-accent", "color", "text on an accent fill"),
176 sys(
177 "border.default",
178 "color",
179 "decorative outlines and separators",
180 ),
181 sys("border.strong", "color", "outlines that must be seen"),
182 sys(
183 "accent.default",
184 "color",
185 "primary actions, checked states, links",
186 ),
187 sys("accent.hover", "color", "the accent under the pointer"),
188 sys("accent.active", "color", "the accent being pressed"),
189 sys("accent.subtle", "color", "a quiet accent background"),
190 sys("danger", "color", "errors and destructive actions"),
191 sys("warning", "color", "warnings"),
192 sys("success", "color", "success"),
193 sys("info", "color", "information"),
194 sys("focus.ring", "color", "the keyboard focus outline"),
195 sys("selection", "color", "selected text and items"),
196 sys(
197 "palette.category.0",
198 "color",
199 "the first series of a chart (categorical palette)",
200 ),
201 sys("palette.category.1", "color", "a chart's second series"),
202 sys("palette.category.2", "color", "a chart's third series"),
203 sys("palette.category.3", "color", "a chart's fourth series"),
204 sys("palette.category.4", "color", "a chart's fifth series"),
205 sys("palette.category.5", "color", "a chart's sixth series"),
206 sys("palette.category.6", "color", "a chart's seventh series"),
207 sys("palette.category.7", "color", "a chart's eighth series"),
208 sys("palette.category.8", "color", "a chart's ninth series"),
209 sys("palette.category.9", "color", "a chart's tenth series"),
210 sys(
211 "palette.log.trace",
212 "color",
213 "a log line at the trace level (readable as text)",
214 ),
215 sys(
216 "palette.log.debug",
217 "color",
218 "a log line at the debug level (readable as text)",
219 ),
220 sys(
221 "palette.log.info",
222 "color",
223 "a log line at the info level (readable as text)",
224 ),
225 sys(
226 "palette.log.warn",
227 "color",
228 "a log line at the warn level (readable as text)",
229 ),
230 sys(
231 "palette.log.error",
232 "color",
233 "a log line at the error level (readable as text)",
234 ),
235 sys(
236 "palette.log.critical",
237 "color",
238 "a log line at the critical level, past error (readable as text)",
239 ),
240 sys(
241 "palette.axis.x",
242 "color",
243 "the X axis of a view or a gizmo (a red)",
244 ),
245 sys(
246 "palette.axis.y",
247 "color",
248 "the Y axis of a view or a gizmo (a green)",
249 ),
250 sys(
251 "palette.axis.z",
252 "color",
253 "the Z axis of a view or a gizmo (a blue)",
254 ),
255 sys("radius.widget", "dimension", "corner radius of controls"),
256 sys(
257 "radius.window",
258 "dimension",
259 "corner radius of windows and menus",
260 ),
261 sys("space.xs", "dimension", "hairline gaps"),
262 sys("space.s", "dimension", "inside controls"),
263 sys("space.m", "dimension", "between items"),
264 sys("space.l", "dimension", "padding of windows and dialogs"),
265 sys("space.xl", "dimension", "between sections"),
266 sys(
267 "space.inline",
268 "dimension",
269 "by intent: between items on one line",
270 ),
271 sys(
272 "space.group",
273 "dimension",
274 "by intent: between related groups",
275 ),
276 sys("space.section", "dimension", "by intent: before a section"),
277 sys(
278 "space.page",
279 "dimension",
280 "by intent: around a page's content",
281 ),
282 sys(
283 "size.control.height",
284 "dimension",
285 "height of one-line controls",
286 ),
287 sys(
288 "size.row.height",
289 "dimension",
290 "height of a row of a list, a tree or a property panel",
291 ),
292 sys(
293 "size.icon.inline",
294 "dimension",
295 "icons in text and controls",
296 ),
297 sys("size.icon.toolbar", "dimension", "icons in toolbars"),
298 sys("size.icon.panel", "dimension", "icons in panel strips"),
299 sys("size.dialog.width", "dimension", "width of dialogs"),
300 sys("size.toast.width", "dimension", "width of toasts"),
301 sys(
302 "size.magnet",
303 "dimension",
304 "how close a dragged palette snaps to an edge",
305 ),
306 sys(
307 "opacity.scrim",
308 "number",
309 "how much a backdrop behind a modal hides (0 to 1)",
310 ),
311 sys(
312 "size.title-bar.height",
313 "dimension",
314 "height of a window's own title bar",
315 ),
316 sys(
317 "size.window-button.width",
318 "dimension",
319 "width of a title bar's window buttons",
320 ),
321 sys(
322 "size.frame.grip",
323 "dimension",
324 "width of a window's own resize edges",
325 ),
326 sys(
327 "font.size.xs",
328 "dimension",
329 "the size scale's smallest step",
330 ),
331 sys("font.size.s", "dimension", "the size scale's small step"),
332 sys(
333 "font.size.m",
334 "dimension",
335 "the size scale's middle step (body text)",
336 ),
337 sys("font.size.l", "dimension", "the size scale's large step"),
338 sys("font.size.xl", "dimension", "the size scale's largest step"),
339 sys(
340 "font.text-style.small",
341 "dimension",
342 "egui's small text: captions and small print",
343 ),
344 sys("font.text-style.body", "dimension", "egui's body text"),
345 sys(
346 "font.text-style.button",
347 "dimension",
348 "egui's button labels",
349 ),
350 sys("font.text-style.heading", "dimension", "egui's headings"),
351 sys(
352 "font.text-style.monospace",
353 "dimension",
354 "egui's monospace text: numbers and code",
355 ),
356 sys("text-role.title.size", "dimension", "a title: its size"),
357 sys("text-role.title.color", "color", "a title: its colour"),
358 sys("text-role.title.weight", "number", "a title: its weight"),
359 sys(
360 "text-role.section.size",
361 "dimension",
362 "a section's title: its size",
363 ),
364 sys(
365 "text-role.section.color",
366 "color",
367 "a section's title: its colour",
368 ),
369 sys(
370 "text-role.section.weight",
371 "number",
372 "a section's title: its weight",
373 ),
374 sys(
375 "text-role.body.size",
376 "dimension",
377 "ordinary text: its size",
378 ),
379 sys("text-role.body.color", "color", "ordinary text: its colour"),
380 sys(
381 "text-role.body.weight",
382 "number",
383 "ordinary text: its weight",
384 ),
385 sys(
386 "text-role.strong.size",
387 "dimension",
388 "inline emphasis: its size",
389 ),
390 sys(
391 "text-role.strong.color",
392 "color",
393 "inline emphasis: its colour",
394 ),
395 sys(
396 "text-role.strong.weight",
397 "number",
398 "inline emphasis: its weight",
399 ),
400 sys(
401 "text-role.muted.size",
402 "dimension",
403 "secondary text: its size",
404 ),
405 sys(
406 "text-role.muted.color",
407 "color",
408 "secondary text: its colour",
409 ),
410 sys(
411 "text-role.muted.weight",
412 "number",
413 "secondary text: its weight",
414 ),
415 sys(
416 "text-role.meta.size",
417 "dimension",
418 "small print about an item: its size",
419 ),
420 sys(
421 "text-role.meta.color",
422 "color",
423 "small print about an item: its colour",
424 ),
425 sys(
426 "text-role.meta.weight",
427 "number",
428 "small print about an item: its weight",
429 ),
430 sys("font.family.ui", "fontFamily", "interface text"),
431 sys("font.family.mono", "fontFamily", "numbers and code"),
432 sys(
433 "font.baseline-offset.ui",
434 "number",
435 "interface text: how far its glyphs sit below their place, a share of the size",
436 ),
437 sys(
438 "font.baseline-offset.mono",
439 "number",
440 "numbers and code: how far their glyphs sit below their place, a share of the size",
441 ),
442 sys(
443 "font.numeric",
444 "string",
445 "how values line their digits up: \"mono\" or \"ui\"",
446 ),
447 sys(
448 "motion.duration",
449 "duration",
450 "length of animations, 0 for none",
451 ),
452 sys(
453 "motion.spinner.delay",
454 "duration",
455 "how long work runs before a busy indicator shows",
456 ),
457 sys(
458 "motion.spinner.min",
459 "duration",
460 "how long a busy indicator stays once shown",
461 ),
462 sys("motion.spinner.turn", "duration", "one turn of a spinner"),
463 sys(
464 "motion.submenu.delay",
465 "duration",
466 "how long the pointer rests on a submenu item before its submenu opens",
467 ),
468 sys(
469 "motion.progress.travel",
470 "duration",
471 "an indeterminate bar's segment crossing its track",
472 ),
473 sys(
474 "motion.skeleton.shimmer",
475 "duration",
476 "a skeleton's shimmer crossing it",
477 ),
478 sys(
479 "motion.pulse.period",
480 "duration",
481 "one pulse of a busy LED or of a mark calling attention",
482 ),
483 sys(
484 "motion.pulse.count",
485 "number",
486 "how many times a mark calling attention pulses",
487 ),
488 sys(
489 "motion.toast.slide",
490 "duration",
491 "a toast sliding in from its corner's side and out again",
492 ),
493 comp(
494 "palette.magnet",
495 "dimension",
496 "how close a palette snaps to an edge or another palette",
497 ),
498 comp(
499 "palette.group.gap",
500 "dimension",
501 "the room between the palettes stacked in a group",
502 ),
503 comp(
504 "palette.min-width",
505 "dimension",
506 "the narrowest a palette is resized to",
507 ),
508 comp(
509 "palette.min-height",
510 "dimension",
511 "the lowest a palette is resized to",
512 ),
513 comp(
514 "palette.max-width",
515 "dimension",
516 "the widest a palette is resized to",
517 ),
518 comp(
519 "palette.max-height",
520 "dimension",
521 "the highest a palette is resized to",
522 ),
523 comp(
524 "palette.grip",
525 "dimension",
526 "the width of a palette's resize edges",
527 ),
528 comp(
529 "viewport.background",
530 "color",
531 "around the image in a viewport",
532 ),
533 comp("viewport.backdrop", "color", "under an image not drawn yet"),
534 comp("viewport.frame", "color", "the image's outline"),
535 comp("viewport.grid", "color", "the pixel grid at high zoom"),
536 comp("viewport.guide", "color", "overlay shapes and guides"),
537 comp("viewport.handle", "color", "a handle at rest"),
538 comp(
539 "viewport.handle-hover",
540 "color",
541 "a handle under the pointer",
542 ),
543 comp(
544 "viewport.handle-outline",
545 "color",
546 "the ring around a handle",
547 ),
548 comp(
549 "histogram.background",
550 "color",
551 "behind a histogram's curves",
552 ),
553 comp("histogram.grid", "color", "a histogram's quarter lines"),
554 comp(
555 "histogram.clip-shadows",
556 "color",
557 "the marker of clipped shadows",
558 ),
559 comp(
560 "histogram.clip-highlights",
561 "color",
562 "the marker of clipped highlights",
563 ),
564 comp("curve.background", "color", "behind a curve editor's graph"),
565 comp("curve.grid", "color", "a curve editor's quarter lines"),
566 comp(
567 "curve.identity",
568 "color",
569 "the diagonal where output equals input",
570 ),
571 comp("curve.line", "color", "the curve"),
572 comp("curve.point", "color", "a curve's point"),
573 comp(
574 "curve.point-selected",
575 "color",
576 "the selected or picked point",
577 ),
578 comp("curve.pick", "color", "the value picked under the pointer"),
579 comp("wheel.ring", "color", "a colour wheel's outline"),
580 comp("wheel.puck", "color", "a colour wheel's puck"),
581 comp(
582 "wheel.puck-outline",
583 "color",
584 "the ring around a wheel's puck",
585 ),
586 comp(
587 "navigator.background",
588 "color",
589 "behind a navigator's image",
590 ),
591 comp("navigator.frame", "color", "the part of the image in view"),
592 comp(
593 "navigator.veil",
594 "color",
595 "over the part of the image out of view",
596 ),
597 comp(
598 "cursor.fill",
599 "color",
600 "a tool cursor's strokes, a brush outline",
601 ),
602 comp(
603 "cursor.outline",
604 "color",
605 "the ring around a cursor's strokes",
606 ),
607 comp(
608 "loupe.background",
609 "color",
610 "around the loupe's picture, behind its readout",
611 ),
612 comp("loupe.frame", "color", "the loupe's outline"),
613 comp("loupe.grid", "color", "the loupe's pixel grid"),
614 comp("loupe.marker", "color", "the loupe's centre pixel"),
615 comp("graph.background", "color", "the node graph's canvas"),
616 comp("graph.grid", "color", "the node graph's grid lines"),
617 comp("graph.node", "color", "a node's body"),
618 comp("graph.node-header", "color", "a node's title bar"),
619 comp("graph.node-border", "color", "a node's outline"),
620 comp("graph.node-selected", "color", "a selected node's outline"),
621 comp("graph.wire", "color", "a wire whose type has no colour"),
622 comp("graph.wire-preview", "color", "the wire being drawn"),
623 comp("graph.wire-refused", "color", "a wire a port refuses"),
624 comp(
625 "graph.wire-hover.color",
626 "color",
627 "what a hovered wire's colour is lightened toward",
628 ),
629 comp(
630 "graph.wire-hover.width",
631 "dimension",
632 "a hovered wire's stroke",
633 ),
634 comp(
635 "graph.wire-selected.color",
636 "color",
637 "a selected wire, its handles and its ports' rings",
638 ),
639 comp(
640 "graph.wire-selected.width",
641 "dimension",
642 "a selected wire's stroke",
643 ),
644 comp(
645 "graph.wire-selected.glow",
646 "color",
647 "the glow under a selected wire",
648 ),
649 comp(
650 "graph.wire-selected.glow-width",
651 "dimension",
652 "the glow's width",
653 ),
654 comp(
655 "graph.wire-selected.glow-opacity",
656 "number",
657 "the glow's opacity, 0 to 1",
658 ),
659 comp("graph.group", "color", "behind a group of nodes"),
660 comp("graph.group-border", "color", "a group's outline"),
661 comp("graph.band", "color", "the rubber band selecting nodes"),
662 comp("graph.type-1", "color", "a port type's colour (1 of 6)"),
663 comp("graph.type-2", "color", "a port type's colour (2 of 6)"),
664 comp("graph.type-3", "color", "a port type's colour (3 of 6)"),
665 comp("graph.type-4", "color", "a port type's colour (4 of 6)"),
666 comp("graph.type-5", "color", "a port type's colour (5 of 6)"),
667 comp("graph.type-6", "color", "a port type's colour (6 of 6)"),
668 comp("editor.gutter", "color", "behind an editor's line numbers"),
669 comp("editor.line-number", "color", "a line number"),
670 comp(
671 "editor.line-number-active",
672 "color",
673 "the cursor line's number",
674 ),
675 comp(
676 "editor.current-line",
677 "color",
678 "the cursor line's background",
679 ),
680 comp("editor.selection", "color", "selected text's background"),
681 comp("editor.cursor", "color", "the text cursor"),
682 comp("editor.indent-guide", "color", "indentation guides"),
683 comp(
684 "editor.bracket",
685 "color",
686 "a matching bracket pair's outline",
687 ),
688 comp("editor.match", "color", "a search match's background"),
689 comp(
690 "editor.match-current",
691 "color",
692 "the current search match's outline",
693 ),
694 comp("editor.fold", "color", "fold arrows"),
695 comp("editor.breakpoint", "color", "a breakpoint marker"),
696 comp("editor.error", "color", "an error marker"),
697 comp("editor.warning", "color", "a warning marker"),
698 comp("editor.info", "color", "an information marker"),
699 comp("editor.diff-added", "color", "a line added"),
700 comp("editor.diff-modified", "color", "a line changed"),
701 comp("editor.diff-removed", "color", "lines removed"),
702 comp("syntax.plain", "color", "code with no kind"),
703 comp("syntax.keyword", "color", "keywords"),
704 comp("syntax.string", "color", "string literals"),
705 comp("syntax.number", "color", "numeric literals"),
706 comp("syntax.constant", "color", "other constants"),
707 comp("syntax.escape", "color", "escapes in strings"),
708 comp("syntax.comment", "color", "comments"),
709 comp("syntax.function", "color", "function names"),
710 comp("syntax.type", "color", "type names"),
711 comp("syntax.macro", "color", "macros and attributes"),
712 comp("syntax.tag", "color", "markup tags"),
713 comp("syntax.operator", "color", "operators"),
714 comp("syntax.punctuation", "color", "punctuation"),
715 comp("syntax.invalid", "color", "text the grammar rejects"),
716 comp(
717 "terminal.foreground",
718 "color",
719 "a terminal's text in the default colour",
720 ),
721 comp(
722 "terminal.bold",
723 "color",
724 "a terminal's bold text in the default colour",
725 ),
726 comp("terminal.cursor", "color", "a terminal's cursor"),
727 comp(
728 "terminal.selection",
729 "color",
730 "a terminal's selected text's background",
731 ),
732 comp("terminal.link", "color", "a link's underline in a terminal"),
733 comp("terminal.ansi.0", "color", "ANSI colour 0 (black)"),
734 comp("terminal.ansi.1", "color", "ANSI colour 1 (red)"),
735 comp("terminal.ansi.2", "color", "ANSI colour 2 (green)"),
736 comp("terminal.ansi.3", "color", "ANSI colour 3 (yellow)"),
737 comp("terminal.ansi.4", "color", "ANSI colour 4 (blue)"),
738 comp("terminal.ansi.5", "color", "ANSI colour 5 (magenta)"),
739 comp("terminal.ansi.6", "color", "ANSI colour 6 (cyan)"),
740 comp("terminal.ansi.7", "color", "ANSI colour 7 (white)"),
741 comp("terminal.ansi.8", "color", "ANSI colour 8 (bright black)"),
742 comp("terminal.ansi.9", "color", "ANSI colour 9 (bright red)"),
743 comp("terminal.ansi.10", "color", "ANSI colour 10 (bright green)"),
744 comp(
745 "terminal.ansi.11",
746 "color",
747 "ANSI colour 11 (bright yellow)",
748 ),
749 comp("terminal.ansi.12", "color", "ANSI colour 12 (bright blue)"),
750 comp(
751 "terminal.ansi.13",
752 "color",
753 "ANSI colour 13 (bright magenta)",
754 ),
755 comp("terminal.ansi.14", "color", "ANSI colour 14 (bright cyan)"),
756 comp("terminal.ansi.15", "color", "ANSI colour 15 (bright white)"),
757];
758
759pub const CONTRACT_VERSION: u64 = 1;
768
769#[derive(Clone, Copy, Debug, PartialEq, Eq)]
772pub struct Renamed {
773 pub from: &'static str,
775 pub to: &'static str,
777 pub contract: u64,
780 pub since: &'static str,
784}
785
786pub const RENAME_WINDOW: u64 = 2;
792
793impl Renamed {
794 pub fn expired_at(&self, version: &str) -> Option<bool> {
800 let (since_major, since_minor) = major_minor(self.since)?;
801 let (major, minor) = major_minor(version)?;
802 let releases = if major == since_major {
803 minor.checked_sub(since_minor)?
804 } else if major > since_major {
805 (major - since_major) + minor
808 } else {
809 return None;
810 };
811 Some(releases > RENAME_WINDOW)
812 }
813}
814
815fn major_minor(version: &str) -> Option<(u64, u64)> {
817 let mut parts = version.split(['.', '-', '+']);
818 let major = parts.next()?.parse().ok()?;
819 let minor = parts.next()?.parse().ok()?;
820 Some((major, minor))
821}
822
823pub const RENAMED: &[Renamed] = &[];
829
830mod kit;
831
832pub const CATEGORY: [&str; 10] = [
839 "palette.category.0",
840 "palette.category.1",
841 "palette.category.2",
842 "palette.category.3",
843 "palette.category.4",
844 "palette.category.5",
845 "palette.category.6",
846 "palette.category.7",
847 "palette.category.8",
848 "palette.category.9",
849];
850
851pub const LOG_LEVELS: [&str; 6] = [
858 "palette.log.trace",
859 "palette.log.debug",
860 "palette.log.info",
861 "palette.log.warn",
862 "palette.log.error",
863 "palette.log.critical",
864];
865
866pub fn contract() -> impl Iterator<Item = &'static Required> {
871 CORE.iter().chain(kit::GROUPS.iter().flat_map(|g| g.iter()))
872}
873
874pub fn kit_contract() -> impl Iterator<Item = &'static Required> {
878 kit::GROUPS.iter().flat_map(|g| g.iter())
879}
880
881pub fn required(path: &str) -> Option<&'static Required> {
883 contract().find(|r| r.path == path)
884}