@Contract(pure = true)
  static @Nullable ShadowColor fromHexString(@Pattern("#[0-9a-fA-F]{8}") final @NotNull String hex) {
    if (hex.length() != 9) return null;
    if (!hex.startsWith("#")) return null;

    try {
      final int r = Integer.parseInt(hex.substring(1, 3), 16);
      final int g = Integer.parseInt(hex.substring(3, 5), 16);
      final int b = Integer.parseInt(hex.substring(5, 7), 16);
      final int a = Integer.parseInt(hex.substring(7, 9), 16);
      return new ShadowColorImpl((a << 24) | (r << 16) | (g << 8) | b);
    } catch (final NumberFormatException ignored) {
      return null;
    }
  }
Attempt to parse a shadow colour from a {@code #}-prefixed hex string.

<p>This string must be in the format {@code #RRGGBBAA}</p>

@param hex the input value
@return a shadow color if possible, or null if any components are invalid
@since 4.18.0
api/src/main/java/net/kyori/adventure/text/format/ShadowColor.java