]> git.lizzy.rs Git - nothing.git/blobdiff - src/color.c
Implement chop_background_layer
[nothing.git] / src / color.c
index b0fc3728ceb0e8b39b5eddec55e3b4eef7c08f32..eb03f55f928a573b9a11d547e136b1efd5d0fbe4 100644 (file)
@@ -83,6 +83,17 @@ Color hexstr(const char *hexstr)
         1.0f);
 }
 
+Color hexs(String input)
+{
+    if (input.count < 6) return COLOR_BLACK;
+
+    return rgba(
+        parse_color_component(input.data) / 255.0f,
+        parse_color_component(input.data + 2) / 255.0f,
+        parse_color_component(input.data + 4) / 255.0f,
+        1.0f);
+}
+
 SDL_Color color_for_sdl(Color color)
 {
     const SDL_Color result = {