summaryrefslogtreecommitdiffstats
path: root/alacritty_terminal/src/term/color.rs
diff options
context:
space:
mode:
Diffstat (limited to 'alacritty_terminal/src/term/color.rs')
-rw-r--r--alacritty_terminal/src/term/color.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/alacritty_terminal/src/term/color.rs b/alacritty_terminal/src/term/color.rs
index 104fcfe5..8626cda5 100644
--- a/alacritty_terminal/src/term/color.rs
+++ b/alacritty_terminal/src/term/color.rs
@@ -1,5 +1,5 @@
use std::fmt::{self, Display, Formatter};
-use std::ops::{Index, IndexMut, Mul};
+use std::ops::{Add, Index, IndexMut, Mul};
use std::str::FromStr;
use log::trace;
@@ -75,6 +75,18 @@ impl Mul<f32> for Rgb {
}
}
+impl Add<Rgb> for Rgb {
+ type Output = Rgb;
+
+ fn add(self, rhs: Rgb) -> Rgb {
+ Rgb {
+ r: self.r.saturating_add(rhs.r),
+ g: self.g.saturating_add(rhs.g),
+ b: self.b.saturating_add(rhs.b),
+ }
+ }
+}
+
/// Deserialize an Rgb from a hex string.
///
/// This is *not* the deserialize impl for Rgb since we want a symmetric