Skip to content

Latest commit

 

History

History
76 lines (52 loc) · 2.37 KB

themes.md

File metadata and controls

76 lines (52 loc) · 2.37 KB

Themes

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.

All themes

blue theme-blue cyan theme-cyan
green theme-green magenta theme-magenta
red theme-red yellow theme-yellow

You can also swap all themes, this means properties from label will be aplied to message and vice versa.

Inbuilt Themes

  • 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

Using Themes

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');

Adding a theme

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 :)

Swap Properties

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');

Contributing 💕

You can add your themes for review, just follow this simple steps:

  1. Add your theme config in file themes.js.
  2. Send a PR and I will review the theme and hopefully add it 💪.