MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / with_color

Method with_color

crates/opencode-tui/src/components/spinner.rs:84–107  ·  view source on GitHub ↗
(base_color: Color)

Source from the content-addressed store, hash-verified

82 }
83
84 pub fn with_color(base_color: Color) -> Self {
85 let hold_start = DEFAULT_HOLD_START;
86 let hold_end = DEFAULT_HOLD_END;
87 let width = DEFAULT_WIDTH;
88 let knight_total_frames = width + hold_end + (width.saturating_sub(1)) + hold_start;
89 let trail_colors = derive_trail_colors(base_color, DEFAULT_TRAIL_STEPS);
90 let inactive_color = derive_inactive_color(base_color, 0.6);
91
92 Self {
93 width,
94 frame_index: 0,
95 knight_total_frames,
96 hold_start,
97 hold_end,
98 task_kind: TaskKind::default(),
99 mode: SpinnerMode::Braille,
100 base_color,
101 trail_colors,
102 inactive_color,
103 active: false,
104 frame_interval_ms: BRAILLE_FRAME_INTERVAL_MS,
105 tick_accumulator_ms: 0,
106 }
107 }
108
109 pub fn set_active(&mut self, active: bool) {
110 self.active = active;

Callers

nothing calls this directly

Calls 2

derive_trail_colorsFunction · 0.85
derive_inactive_colorFunction · 0.85

Tested by

no test coverage detected