API Reference

Creates a GitHub-style badge showing the score of a football match.

Functions:

football_badge(home_name, away_name, …[, …])

Creates a GitHub-style badge showing the score of a football match.

football_badge(home_name, away_name, home_score, away_score, home_colour, away_colour, *, elapsed_time=None, extra_time=None, title='Football Score', measurer=None)[source]

Creates a GitHub-style badge showing the score of a football match.

Parameters
  • home_name (str) – The 2- or 3-letter code representing the home team, to be displayed on the left of the badge.

  • away_name (str) – The 2- or 3-letter code representing the away team, to be displayed on the right of the badge.

  • home_score (int) – The score of the home team.

  • away_score (int) – The score of the away team.

  • home_colour (str) – The background colour for the home team.

  • away_colour (str) – The background colour for the away team.

  • elapsed_time (Optional[str]) – The elapsed time in the match. Default None.

  • extra_time (Union[int, str, None]) – The number of minutes of extra time. Default None.

  • title (str) – The title to set in the SVG file. See https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title. Default 'Football Score'.

  • measurer (Optional[TextMeasurer]) – A text_measurer.TextMeasurer that can be used to measure the width of left_text and right_text. Default None.

See also

https://liaison.reuters.com/tools/sports-team-codes for a list of team codes.

Return type

str