1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:17:44 +00:00

LibDraw: Add Color::from_string(StringView)

This parses hex colors in either #RRGGBBAA or #RRGGBB format.
No other formats are supported at the moment.
This commit is contained in:
Andreas Kling 2019-08-03 11:32:37 +02:00
parent f511421aaa
commit e43b27a3fa
2 changed files with 43 additions and 1 deletions

View file

@ -1,6 +1,7 @@
#pragma once
#include <AK/AKString.h>
#include <AK/Optional.h>
#include <AK/Types.h>
typedef u32 RGBA32;
@ -132,6 +133,7 @@ public:
}
String to_string() const;
static Optional<Color> from_string(const StringView&);
private:
explicit Color(RGBA32 rgba)