Skip to content

Icon

🛈 DocStrings

Represents a font icon with all its context.

Source code in src/pycons/font_providers/models.py
@dataclass
class Icon:
    """Represents a font icon with all its context."""

    character: str  # The actual Unicode character
    provider: str  # The provider name (e.g. "fontawesome-regular")
    prefix: str  # The provider prefix (e.g. "fa")
    name: str  # The icon name (e.g. "home")
    ttf_path: Path  # Path to the font file

    @property
    def css_class(self) -> str:
        """CSS class to use for this icon."""
        return f"icon-{self.prefix}"

    @property
    def font_family(self) -> str:
        """Font family name for CSS."""
        # This might need to be mapped from provider to actual font family name
        return self.provider

css_class property

css_class: str

CSS class to use for this icon.

font_family property

font_family: str

Font family name for CSS.

:fa-brands-github: Show source on GitHub