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

Function blend_colors

crates/opencode-tui/src/components/toast.rs:168–177  ·  view source on GitHub ↗
(from: Color, to: Color, alpha: f32)

Source from the content-addressed store, hash-verified

166}
167
168fn blend_colors(from: Color, to: Color, alpha: f32) -> Color {
169 let alpha = alpha.clamp(0.0, 1.0);
170 let (fr, fg, fb) = color_to_rgb(from);
171 let (tr, tg, tb) = color_to_rgb(to);
172 Color::Rgb(
173 mix_u8(fr, tr, alpha),
174 mix_u8(fg, tg, alpha),
175 mix_u8(fb, tb, alpha),
176 )
177}
178
179fn mix_u8(from: u8, to: u8, alpha: f32) -> u8 {
180 let from = from as f32;

Callers 1

renderMethod · 0.70

Calls 2

mix_u8Function · 0.85
color_to_rgbFunction · 0.70

Tested by

no test coverage detected