def translate_icon(icon: str | None) -> str | None:
    """
    If you pass a name of an icon, like :dog:, translate it into the
    corresponding unicode character
    """
    if icon is None:
        return None

    if icon == "random":
        icon = get_random_emoji()
    elif icon.startswith(":") and icon.endswith(":") and ":material/" not in icon:
        icon = icon[1:-1]
        icon = get_icons().get(icon, icon)
    return icon
If you pass a name of an icon, like :dog:, translate it into the
corresponding unicode character
src/st_pages/__init__.py