diff --git a/src/render.rs b/src/render.rs index 1dac33f86..a4b6eb952 100644 --- a/src/render.rs +++ b/src/render.rs @@ -90,7 +90,7 @@ pub fn render_vnode<'a>( VNode::Element(el) => { let area = Rect::new(*x as u16, *y as u16, *width as u16, *height as u16); - let new_style = node.block_style.merge(*style); + let mut new_style = node.block_style.merge(*style); node.block_style = new_style; // the renderer will panic if a node is rendered out of range even if the size is zero @@ -98,6 +98,8 @@ pub fn render_vnode<'a>( frame.render_widget(WidgetWithContext::new(node, cfg), area); } + // do not pass background color to children + new_style.bg = None; for el in el.children { render_vnode(frame, layout, layouts, vdom, el, &new_style, cfg); } diff --git a/src/style.rs b/src/style.rs index ffe3aa568..ee0ca6595 100644 --- a/src/style.rs +++ b/src/style.rs @@ -26,8 +26,6 @@ impl RinkColor { } else { if self.alpha == 0.0 { other - } else if other == Color::Reset { - self.color } else { let [sr, sg, sb] = to_rgb(self.color); let [or, og, ob] = to_rgb(other); @@ -228,7 +226,7 @@ impl FromStr for RinkColor { }) } else if color.starts_with("rgb(") { let color_values = color[4..].trim_end_matches(')'); - if color.matches(',').count() == 4 { + if color.matches(',').count() == 3 { let (alpha, rgb_values) = color_values.rsplit_once(',').ok_or(ParseColorError)?; if let Ok(a) = alpha.parse() { @@ -324,7 +322,6 @@ fn to_rgb(c: Color) -> [u8; 3] { let r = ((v as u16 / 36) * 255 + 3) / 6; let g = (((v as u16 % 36) / 6) * 255 + 3) / 6; let b = ((v as u16 % 6) * 255 + 3) / 6; - let vals = [v / 36, (v % 36) / 6, v % 6]; [r as u8, g as u8, b as u8] } 232..=255 => { @@ -334,6 +331,7 @@ fn to_rgb(c: Color) -> [u8; 3] { // rink will never generate these colors, but they might be on the screen from another program _ => [0, 0, 0], }, + Color::Reset => [0, 0, 0], _ => todo!("{c:?}"), } }