Themes are a way to store badge configuration for repeated use. All the options (except for the theme option, obviously) that are needed by the badge can be stored by making a theme.
blue |
![]() |
cyan |
![]() |
green |
![]() |
magenta |
![]() |
red |
![]() |
yellow |
![]() |
You can also swap all themes, this means properties from label will be aplied to message and vice versa.
- red : Red Message Background
- green : Green Message Background
- blue : Blue Message Background
- yellow : Black Colored Message on Yellow Background
- cyan : Black Colored Message on Cyan Background
- magenta : Black Colored Message on Magenta Background
- success : ('Success') Message on Green Background
- failed : ('Failed') Message on Red Background
You can use the themes in various ways, passing an option theme
to badge:
badge('label', 'green', { theme: 'green' });
badge('label', 'magenta', { theme: 'magenta', swapTheme: true });
Or there are helper methods for ease of use:
badge.green('label', 'green');
badge.failed('theme', 'red');
You can also add you own themes:
badge.addTheme('donate', {
label: '❤️ donate',
});
badge('', 'ko-fi', { theme: 'donate' });
badge.donate('', 'ko-fi');
You can also send in a PR and suggest a new inbuilt theme :)
You can also swap all themes, this means properties from label will be aplied to message and vice versa.
badge.failed('theme', 'red');
badge.failed.swap('theme', 'red');
You can add your themes for review, just follow this simple steps:
- Add your theme config in file
themes.js
. - Send a PR and I will review the theme and hopefully add it 💪.