update UI

This commit is contained in:
2026-08-11 09:19:13 -07:00
parent 97a3f1be48
commit 4eda93cf24
31 changed files with 952 additions and 95 deletions
+13
View File
@@ -46,6 +46,9 @@ pub struct OverlaySettings {
pub danmaku_color: Option<String>,
#[serde(default = "default_font_scale")]
pub font_scale: u16,
/// Relative weight of theme borders, rules, and ornamental edge artwork.
#[serde(default = "default_decoration_line_weight")]
pub decoration_line_weight: u16,
pub show_danmaku: bool,
pub show_enter: bool,
pub show_gift: bool,
@@ -77,6 +80,7 @@ impl Default for OverlaySettings {
viewer_color: None,
danmaku_color: None,
font_scale: default_font_scale(),
decoration_line_weight: default_decoration_line_weight(),
show_danmaku: true,
show_enter: true,
show_gift: true,
@@ -104,6 +108,7 @@ impl OverlaySettings {
self.viewer_color = sanitize_optional_hex_color(self.viewer_color);
self.danmaku_color = sanitize_optional_hex_color(self.danmaku_color);
self.font_scale = self.font_scale.clamp(50, 300);
self.decoration_line_weight = self.decoration_line_weight.clamp(50, 300);
self.collapse_after_seconds = self.collapse_after_seconds.clamp(2, 120);
self.unfold_duration_ms = self.unfold_duration_ms.clamp(200, 5_000);
self.motion_intensity = self.motion_intensity.min(100);
@@ -128,6 +133,10 @@ fn default_font_scale() -> u16 {
140
}
fn default_decoration_line_weight() -> u16 {
160
}
fn default_unfold_duration_ms() -> u16 {
1_000
}
@@ -577,6 +586,7 @@ mod tests {
font_brightness: 1,
viewer_color: Some(" #a1b2c3 ".into()),
danmaku_color: Some("not-css".into()),
decoration_line_weight: 999,
max_visible: 99,
collapse_after_seconds: 1,
unfold_duration_ms: 9_000,
@@ -592,6 +602,7 @@ mod tests {
assert_eq!(settings.font_brightness, 70);
assert_eq!(settings.viewer_color.as_deref(), Some("#A1B2C3"));
assert_eq!(settings.danmaku_color, None);
assert_eq!(settings.decoration_line_weight, 300);
assert_eq!(settings.max_visible, 12);
assert_eq!(settings.collapse_after_seconds, 2);
assert_eq!(settings.unfold_duration_ms, 5_000);
@@ -618,6 +629,7 @@ mod tests {
object.remove("fontBrightness");
object.remove("viewerColor");
object.remove("danmakuColor");
object.remove("decorationLineWeight");
object.remove("unfoldDurationMs");
object.remove("particleCount");
object.remove("particleSpeed");
@@ -629,6 +641,7 @@ mod tests {
assert_eq!(settings.viewer_color, None);
assert_eq!(settings.danmaku_color, None);
assert_eq!(settings.font_scale, 140);
assert_eq!(settings.decoration_line_weight, 160);
assert_eq!(settings.unfold_duration_ms, 1_000);
assert_eq!(settings.particle_count, 8);
assert_eq!(settings.particle_speed, 100);