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

Function blend_alpha

crates/opencode-tui/src/components/spinner.rs:378–386  ·  view source on GitHub ↗
(color: Color, alpha: f64)

Source from the content-addressed store, hash-verified

376}
377
378fn blend_alpha(color: Color, alpha: f64) -> Color {
379 let (r, g, b) = color_to_rgb(color);
380 let a = alpha.clamp(0.0, 1.0);
381 Color::Rgb(
382 ((r as f64) * a).round().clamp(0.0, 255.0) as u8,
383 ((g as f64) * a).round().clamp(0.0, 255.0) as u8,
384 ((b as f64) * a).round().clamp(0.0, 255.0) as u8,
385 )
386}
387
388fn color_to_rgb(color: Color) -> (u8, u8, u8) {
389 match color {

Callers 2

derive_trail_colorsFunction · 0.85
derive_inactive_colorFunction · 0.85

Calls 1

color_to_rgbFunction · 0.70

Tested by

no test coverage detected