Convert hex color string to SDL Color
Rather than breaking the string into substrings, then converting each individually from a hex string to an integer, I'd probably convert the entire string at once, then use bit shifting to get the pieces you care about.

SDL_Color hex2sdl(std::string input) {

    if (input[0] == '#')
        input.erase(0, 1);

    unsigned long value = stoul(input, nullptr, 16);

    SDL_Color color;

    color.a = (value &gt;&gt; 24) &amp; 0xff;
    color.r = (value &gt;&gt; 16) &amp; 0xff;
    color.g = (value &gt;&gt; 8) &amp; 0xff;
    color.b = (value &gt;&gt; 0) &amp; 0xff;
    return color;
}


This simplifies the code quite a bit, and at least in my mind makes it rather easier to read.

Another point to consider (when/if your compiler supports it) would be to use an std::string_view instead of a std::string for the input. A string_view is something like a pointer/length, so (when needed) it can trim the # from the beginning without copying all the data like an actual string normally will. Even if your compiler supports string_view itself, however, it may easily not support passing a string_view to std::stoul, which kind of ruins the idea (for now).