# Icons


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

## Media Type Icon Mapping

Maps file types to Lucide icon names for consistent iconography across
the gallery.

``` python
# Test icon mapping
assert MEDIA_TYPE_ICONS[FileType.AUDIO] == "file-music"
assert MEDIA_TYPE_ICONS[FileType.VIDEO] == "file-video-camera"
assert MEDIA_TYPE_ICONS[FileType.IMAGE] == "image"
assert MEDIA_TYPE_ICONS[FileType.DOCUMENT] == "file-text"
assert MEDIA_TYPE_ICONS[FileType.OTHER] == "file"

# Verify all FileTypes have an icon
for file_type in FileType:
    assert file_type in MEDIA_TYPE_ICONS, f"Missing icon for {file_type}"

print("MEDIA_TYPE_ICONS tests passed!")
```

    MEDIA_TYPE_ICONS tests passed!

## Gallery UI Icons

Icons used in the gallery UI controls and preview modal.

``` python
# Test gallery icons
assert GALLERY_ICONS["grid_view"] == "grid-3x3"
assert GALLERY_ICONS["list_view"] == "list"
assert GALLERY_ICONS["play"] == "play"
assert GALLERY_ICONS["close"] == "x"
assert GALLERY_ICONS["prev"] == "chevron-left"
assert GALLERY_ICONS["next"] == "chevron-right"

print("GALLERY_ICONS tests passed!")
```

    GALLERY_ICONS tests passed!

## Media Type Colors

Semantic colors for file type badges and icons.

``` python
# Test badge colors
assert "badge-info" in MEDIA_TYPE_BADGE_COLORS[FileType.AUDIO]
assert "badge-primary" in MEDIA_TYPE_BADGE_COLORS[FileType.VIDEO]
assert "badge-success" in MEDIA_TYPE_BADGE_COLORS[FileType.IMAGE]

# Verify all FileTypes have a badge color
for file_type in FileType:
    assert file_type in MEDIA_TYPE_BADGE_COLORS, f"Missing badge color for {file_type}"

print("MEDIA_TYPE_BADGE_COLORS tests passed!")
```

    MEDIA_TYPE_BADGE_COLORS tests passed!

``` python
# Test text colors
assert "text-info" in MEDIA_TYPE_TEXT_COLORS[FileType.AUDIO]
assert "text-primary" in MEDIA_TYPE_TEXT_COLORS[FileType.VIDEO]
assert "text-success" in MEDIA_TYPE_TEXT_COLORS[FileType.IMAGE]

print("MEDIA_TYPE_TEXT_COLORS tests passed!")
```

    MEDIA_TYPE_TEXT_COLORS tests passed!

## Icon Helper Functions

Convenience functions for rendering icons with appropriate styling.

------------------------------------------------------------------------

### get_media_type_icon

``` python

def get_media_type_icon(
    file_type:FileType, # File type to get icon for
    size:int=4, # Icon size (Tailwind scale)
    with_color:bool=True, # Apply semantic color
)->Any: # Lucide icon component

```

*Get the appropriate icon for a file type.*

``` python
from fasthtml.common import to_xml

# Test get_media_type_icon
audio_icon = get_media_type_icon(FileType.AUDIO)
html = to_xml(audio_icon)
assert "<svg" in html.lower()
assert "text-info" in html  # Color applied

video_icon = get_media_type_icon(FileType.VIDEO, size=6)
html = to_xml(video_icon)
assert "text-primary" in html

# Test without color
icon_no_color = get_media_type_icon(FileType.IMAGE, with_color=False)
html = to_xml(icon_no_color)
assert "text-success" not in html

print("get_media_type_icon tests passed!")
```

    get_media_type_icon tests passed!

------------------------------------------------------------------------

### get_gallery_icon

``` python

def get_gallery_icon(
    icon_key:str, # Key from GALLERY_ICONS
    size:int=4, # Icon size (Tailwind scale)
    cls:str='', # Additional CSS classes
)->Any: # Lucide icon component

```

*Get a gallery UI icon by key.*

``` python
from cjm_fasthtml_tailwind.utilities.typography import text_color

# Test get_gallery_icon
grid_icon = get_gallery_icon("grid_view")
html = to_xml(grid_icon)
assert "<svg" in html.lower()

play_icon = get_gallery_icon("play", size=6, cls=str(text_color.white))
html = to_xml(play_icon)
assert "text-white" in html

# Test fallback for unknown key
unknown_icon = get_gallery_icon("unknown_key")
html = to_xml(unknown_icon)
assert "<svg" in html.lower()  # Falls back to circle-question-mark

print("get_gallery_icon tests passed!")
```

    get_gallery_icon tests passed!
