@@ 112,6 112,7 @@ impl Style {
mut self,
parameters: &[u16],
introducer: &ControlSequenceIntroducer,
+ truecolor: bool,
) -> Result<Style> {
match introducer {
ControlSequenceIntroducer::SelectGraphicRendition => {
@@ 120,24 121,26 @@ impl Style {
}
}
ControlSequenceIntroducer::PabloDraw24BitColor => {
- impl From<std::num::TryFromIntError> for Error {
- fn from(err: std::num::TryFromIntError) -> Self {
- Error::ParameterToColor(err)
+ if truecolor {
+ impl From<std::num::TryFromIntError> for Error {
+ fn from(err: std::num::TryFromIntError) -> Self {
+ Error::ParameterToColor(err)
+ }
}
- }
- match *parameters {
- [0, red, green, blue] => {
- self.background =
- Color::True(parse_color(red)?, parse_color(green)?, parse_color(blue)?)
- }
- [1, red, green, blue] => {
- self.foreground =
- Color::True(parse_color(red)?, parse_color(green)?, parse_color(blue)?)
+ match *parameters {
+ [0, red, green, blue] => {
+ self.background =
+ Color::True(parse_color(red)?, parse_color(green)?, parse_color(blue)?)
+ }
+ [1, red, green, blue] => {
+ self.foreground =
+ Color::True(parse_color(red)?, parse_color(green)?, parse_color(blue)?)
+ }
+ _ => Err(Error::UnknownPabloDraw24BitColorParameterFormat(
+ parameters.to_vec(),
+ ))?,
}
- _ => Err(Error::UnknownPabloDraw24BitColorParameterFormat(
- parameters.to_vec(),
- ))?,
}
}
_ => Err(Error::UnsupportedCsiForStyleParsing(introducer.clone()))?,
@@ 462,7 465,7 @@ where
}
ControlSequenceIntroducer::SelectGraphicRendition
| ControlSequenceIntroducer::PabloDraw24BitColor => {
- let new_brush = self.brush.clone().parse(¶meters, &introducer)?;
+ let new_brush = self.brush.clone().parse(¶meters, &introducer, self.truecolor)?;
if self.brush != new_brush {
let difference_params = new_brush.render_difference(