From 6d8d7c10c6459b1a29db4f52790cf17c335eec66 Mon Sep 17 00:00:00 2001 From: Some1and2 <04x0xx@gmail.com> Date: Wed, 15 Oct 2025 21:08:04 -0300 Subject: [PATCH] Implemented `Hash` for `Color` struct --- src/color.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/color.rs b/src/color.rs index 52eb942..ae2f8d9 100644 --- a/src/color.rs +++ b/src/color.rs @@ -557,6 +557,15 @@ impl fmt::Display for Color { } } +impl std::hash::Hash for Color { + fn hash(&self, state: &mut H) { + self.r.to_bits().hash(state); + self.g.to_bits().hash(state); + self.b.to_bits().hash(state); + self.a.to_bits().hash(state); + } +} + impl FromStr for Color { type Err = ParseColorError;