cli_badges
터미널에 배지를 출력합니다. 네, README에서 사용하는 그런 편리한 작은 것들인데, CLI 앱용으로요.
CLI 앱용 배지 생성을 위한 독특한 작은 dart 라이브러리입니다.
아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
https://vectr.com/kerff/ddbmvyZmm.svg?width=600&height=300&select=aNbKxciPh
Quirky little dart library for generating badges for your cli apps.
Print badges to the terminal. Yup, those nifty little thingies we use on readmes, but for CLI apps.
This is what it can do:
var failedBadge = Badge(label: 'failed', message: '2', theme: BadgeTheme.red);
var successBadge = Badge(label: 'success', message: '2').green();
var skippedBadge = Badge.yellow(label: 'skipped', message: '2');
print(
Badge.inline([
failedBadge,
skippedBadge,
successBadge
]),
);
The above would output something similar to the terminal:
https://github.com/nombrekeff/cli_badges_dart/blob/main/images/output-example.png
Usage is simple, import the package and start creating Badges!
import 'package:cli_badges/cli_badges.dart';
var failedBadge = Badge(label: 'failed', message: '2', theme: BadgeTheme.red);
print(failedBadge);
You could create a donate badge:
var donateBadge = Badge.cyan(label: '❤️ donate', message: 'please?');
print(donateBadge);
https://github.com/nombrekeff/cli_badges_dart/blob/main/images/donate-output-example.png
You can also only show the label:
var onlyLabel = Badge(
label: '❤️ donate',
labelColorCode: 169
);
print(onlyLabel);
Example output is a mock, console output will vary slightly from terminal to terminal.
A badge is conformed of a label and a message <label>:<message>. Each segment can be customized, by changing bg color, text color and style.
Themes are a way to store badge configuration for repeated use.
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 applied to message and vice versa.
This is the list of all available colors:
There are 3 main ways to create a themed badge:
Badge(
label: 'failed',
message: '2',
theme: BadgeTheme.red,
);
Badge.red(
label: 'failed',
message: '2',
);
Badge(...).red();
There is a complete example here
If you encounter any problems or fancy a feature to be added please head over to the GitHub repository and drop an issue.
cli-badges is also available in other languages:
I tend to open source anything I can, and love to help people that might need help with the project.
However, if you are using this project and are happy with it or just want to encourage me to continue creating stuff, there are few ways you can do so:
Thanks! ❤️