favorite-icon-badge
v1.2.2
Published
Small library for manipulating the favicon, in particular adding alert bubbles and changing images
Downloads
16
Readme
📛 Favorite Icon Badge
Small library for badge manipulating with desktop favicon.
Desktop browser support
- Chrome: ✅
- Edge: ✅
- Firefox: ✅
- Opera: ✅
- IE: ❌
- Safari: ❌ (Safari hides favicons)
Installation
npm install favorite-icon-badge
Demo
Using
import { FaviconBadge } from 'favorite-icon-badge';
const badge = new FaviconBadge();
badge.set(count);
Advanced settings
import { FaviconBadge } from 'favorite-icon-badge';
const badge = new FaviconBadge({
backgroundColor: '#ff0000',
fontFamily: 'arial, sans-serif',
fontStyle: 'normal',
strokeColor: '#000',
textColor: '#fff',
faviconSrc: '/my-icon.png',
maxCount: 99,
size: Favicon.size,
links: Favicon.icons,
positionX: 'right',
positionY: 'bottom'
});
badge.set(count);
API
.set(count: number)
Set the favicon with the badge.
import { FaviconBadge } from 'favorite-icon-badge';
const badge = new FaviconBadge();
badge.set(count);
.reset()
Reset the favicon.
import { FaviconBadge } from 'favorite-icon-badge';
const badge = new FaviconBadge();
// ...
badge.reset();
License
MIT License