LibGfx: Make Color hashable

This commit is contained in:
Lucas CHOLLET 2024-05-14 12:21:52 -04:00 committed by Andreas Kling
parent 272cd30f17
commit 02e682950e
Notes: sideshowbarker 2024-07-17 02:42:21 +09:00

View File

@ -621,6 +621,15 @@ using Gfx::Color;
namespace AK {
template<>
class Traits<Color> : public DefaultTraits<Color> {
public:
static unsigned hash(Color const& color)
{
return int_hash(color.value());
}
};
template<>
struct Formatter<Gfx::Color> : public Formatter<StringView> {
ErrorOr<void> format(FormatBuilder&, Gfx::Color);