feat: Reworked configuration

- Added colors.aliases table
- Colors can also be defined with aliases
- Event color is calculated with priorities
- Added paths table
- Renamed log_path as paths.logs
- Renamed colors.background_text as colors.text
- Added colors.fallback field
- Default values are now taken from source config.toml on compilation
This commit is contained in:
Alexey 2026-04-10 18:54:19 +03:00
commit ba7bc67b6c
13 changed files with 347 additions and 256 deletions

View file

@ -2,42 +2,4 @@ export global Palette {
in-out property<color> background: gray;
in-out property<color> timeline: darkgray;
in-out property<color> background-text: black;
// Note: these colors were almost randomly picked
in-out property<[color]> event-colors: [
#97f9f9,
#a4def9,
#c1e0f7,
#cfbae1,
#c59fc9,
#4e3d42,
#c9d5b5,
#2d82b7,
#556f44,
#772e25,
#c44536,
#7c6a0a,
#babd8d,
#ffdac6,
#fa9500,
#eb6424
];
in-out property <[color]> event-text: [
#000000,
#000000,
#000000,
#000000,
#000000,
#ffffff,
#000000,
#000000,
#000000,
#ffffff,
#000000,
#000000,
#000000,
#000000,
#000000,
#000000
];
}

View file

@ -6,7 +6,8 @@ export struct TimelineEvent {
duration: int,
finished: bool,
label: string,
color-id: int,
background-color: color,
text-color: color,
}
export struct TimelineState {
@ -69,7 +70,7 @@ export component Timeline inherits Rectangle {
visible: self.width > 0 && self.real-x < parent.width;
border-color: black;
border-width: 1px;
background: Palette.event-colors[event.color-id];
background: event.background-color;
Text {
x: 0;
@ -87,7 +88,7 @@ export component Timeline inherits Rectangle {
visible: timeline-event.visible &&
(self.width * 2 < timeline-event.width ||
(!end-txt.visible && self.width < timeline-event.width));
color: Palette.event-text[event.color-id];
color: event.text-color;
}
end-txt := Text {
x: timeline-event.width - self.width;
@ -96,7 +97,7 @@ export component Timeline inherits Rectangle {
TimeString.from(event.start + event.duration) :
TimeString.from(visible-offset);
visible: timeline-event.visible && timeline-event.width - self.width * 2 > 0;
color: Palette.event-text[event.color-id];
color: event.text-color;
}
}
@children