legacy-icons/famfamfam-silk
Legacy FamFamFam Silk icon set packaged for modern Laravel/PHP projects. Provides easy access to the classic 16x16 silk PNG icons for menus, toolbars, and admin UIs, with simple publishing/asset integration for quick drop-in use.
Installation
composer require legacy-icons/famfamfam-silk
Add the package's CSS to your resources/css/app.css (or equivalent):
@import 'legacy-icons/famfamfam-silk/silk';
First Use Case Use the icon in Blade:
<span class="silk-icon silk-icon-{{ icon-name }}"></span>
Example:
<span class="silk-icon silk-icon-page_white_text"></span>
Where to Look
resources/vendor/legacy-icons/famfamfam-silk/silk.pngresources/vendor/legacy-icons/famfamfam-silk/silk.css (contains all icon classes)Dynamic Icon Rendering Use a helper function in a Blade directive or PHP:
// In AppServiceProvider's boot()
Blade::directive('silk', function ($icon) {
return "<span class='silk-icon silk-icon-{$icon}'></span>";
});
Usage:
@silk('page_white_text')
Icon Sets in Components Create a reusable component (Laravel 8+):
php artisan make:component SilkIcon
// app/View/Components/SilkIcon.php
public $name;
public function render() {
return view('components.silk-icon', ['name' => $this->name]);
}
<!-- resources/views/components/silk-icon.blade.php -->
<span class="silk-icon silk-icon-{{ $name }}"></span>
Usage:
<x-silk-icon name="page_white_text" />
Integration with Tailwind CSS
Extend your tailwind.config.js to include Silk icons as custom classes:
module.exports = {
corePlugins: {
prefix: false, // Disable default Tailwind prefix
},
safelist: [
{
pattern: /silk-icon-.*/,
},
],
};
Icon Mapping for Localization
Store icon names in a config file (config/silk-icons.php) and map them to user-friendly keys:
return [
'dashboard' => 'page_white_text',
'settings' => 'wrench_orange',
];
Usage:
config('silk-icons.dashboard'); // Returns 'page_white_text'
Icon Naming Confusion
page_white_text), not hyphens (page-white-text).Sprite Sheet Limitations
CSS Specificity Conflicts
!important or increase specificity:
.silk-wrapper .silk-icon {
background-image: url('silk.png') !important;
}
Missing Icons
Inspect the Sprite Sheet Use browser dev tools to verify the sprite sheet path:
.silk-icon-page_white_text {
background-image: url('silk.png') !important;
}
If broken, check:
vendor/legacy-icons/famfamfam-silk.public/vendor/legacy-icons/famfamfam-silk/silk.png (may need to publish assets).Fallback for Missing Icons Add a default icon class to avoid broken icons:
.silk-icon {
display: inline-block;
width: 16px;
height: 16px;
background-image: url('silk.png');
background-position: 0 0;
}
.silk-icon-missing {
background-position: -16px -16px; /* Fallback icon */
}
Custom Sprite Sheets Override the default sprite sheet by publishing the package assets:
php artisan vendor:publish --tag=silk-icons
Then replace silk.png in public/vendor/legacy-icons/famfamfam-silk/.
Dynamic Icon Loading Lazy-load icons for performance:
// Using Alpine.js
<span x-data="{ loaded: false }" x-on:mouseover="loaded = true">
<span x-show="!loaded" class="silk-icon silk-icon-loading"></span>
<span x-show="loaded" class="silk-icon silk-icon-page_white_text"></span>
</span>
Dark Mode Support Add a dark-mode variant by duplicating the sprite sheet and adjusting CSS:
.dark .silk-icon-dark {
background-image: url('silk-dark.png') !important;
}
How can I help you explore Laravel packages today?