gt-extras
  • Get Started
  • API Reference
  1. Icons and Images
  2. fa_icon_repeat
  • API Reference
  • Plotting
    • gt_plt_bar
    • gt_plt_dot
    • gt_plt_conf_int
  • Colors
    • gt_highlight_cols
    • gt_hulk_col_numeric
    • gt_color_box
  • Themes
    • gt_theme_538
    • gt_theme_espn
    • gt_theme_guardian
    • gt_theme_nytimes
    • gt_theme_excel
    • gt_theme_dot_matrix
    • gt_theme_dark
    • gt_theme_pff
  • Icons and Images
    • fa_icon_repeat
    • gt_fa_rating
  • HTML Helpers
    • gt_hyperlink
    • with_tooltip

On this page

  • Parameters
  • Returns
  • Examples
  • Note
  1. Icons and Images
  2. fa_icon_repeat

fa_icon_repeat

fa_icon_repeat(
    name='star',
    repeats=1,
    fill='black',
    fill_opacity=1,
    stroke=None,
    stroke_width=None,
    stroke_opacity=None,
    height=None,
    width=None,
    margin_left='auto',
    margin_right='0.2em',
    position='relative',
    title=None,
    a11y='deco',
)

Create repeated FontAwesome SVG icons as HTML.

The fa_icon_repeat() function generates one or more FontAwesome SVG icons using the faicons package and returns them as a single HTML string.

Parameters

name : str = 'star'

The name of the FontAwesome icon to use (e.g., "star", "thumbs-up").

repeats : int = 1

The number of times to repeat the icon.

fill : str = 'black'

The fill color for the icon (e.g., "yellow", "#ffcc00"). If None, uses the default.

fill_opacity : int | str = 1

The opacity of the fill color (0.0 - 1.0).

stroke : str | None = None

The stroke color for the icon outline.

stroke_width : str | None = None

The width of the icon outline.

stroke_opacity : int | str | None = None

The opacity of the outline (0.0 - 1.0).

height : str | None = None

The height of the icon.

width : str | None = None

The width of the icon.

margin_left : str = 'auto'

The left margin for the icon.

margin_right : str = '0.2em'

The right margin for the icon.

position : str = 'relative'

The CSS position property for the icon (e.g., "absolute", "relative", etc).

title : str | None = None

The title (tooltip) for the icon.

a11y : Literal['deco', 'sem', 'none'] = 'deco'

Accessibility mode: "deco" for decorative, "sem" for semantic, "none" will result in no accessibility features.

Returns

: str

An HTML string containing the repeated SVG icons. If repeats = 0, this string will be empty.

Examples

import pandas as pd
from great_tables import GT
import gt_extras as gte

df = pd.DataFrame({
    "Name": ["Alice", "Bob", "Carol"],
    "Stars": [
        gte.fa_icon_repeat(repeats=3, fill="gold", fill_opacity=0.66),
        gte.fa_icon_repeat(repeats=2, stroke="red", stroke_width="3em"),
        gte.fa_icon_repeat(name="star-half", repeats=1, fill="orange"),
    ]
})

GT(df)
Name Stars
Alice
Bob
Carol

Note

See icon_svg() in the faicons package for further implementation details.

gt_theme_pff
gt_fa_rating