Extension reference

class flask_favicon.FlaskFavicon(app=None)[source]
__init__(app=None)[source]

Constructor function for FlaskFavicon. It will call FlaskFavicon.init_app() automatically if the app parameter is provided.

Parameters:

app (flask.Flask) -- A Flask application.

init_app(app)[source]

Initializes the extension.

Parameters:

app (flask.Flask) -- A Flask application.

register_favicon(favicon_source_path=None, favicon_name='default', background_color=None, theme_color=None)[source]

Registers an image to be used as a favicon.

Parameters:
  • favicon_source_path (str) -- A path to the image asset.

  • favicon_name (str) -- An identifier for the favicon.

  • background_color (str) -- Hex formatted background color to be used for asset generation. It overrides FAVICON_DEFAULT_BACKGROUND_COLOR configuration.

  • theme_color (str) -- Hex formatted theme color to be used for asset generation. It overrides FAVICON_DEFAULT_THEME_COLOR configuration.

flask_favicon.flask_integration.use_favicon(favicon_name)[source]

Function decorator to override the default favicon on a specific route.

Parameters:

favicon_name (str) -- The identifier of the favicon to be used.