패키지, 저장소 및 앱 카테고리 검색

GitHub 저장소nombrekeff/cli_badges_dart

cli_badges_dart

CLI 앱용 배지 생성을 위한 독특한 작은 dart 라이브러리입니다.

cli_badges_dart 프로젝트 이미지
스타
8
포크
1
최근 푸시(UTC)
2022. 6. 10.
프로젝트 상태
활성

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

Quirky little dart library for generating badges for your cli apps.

Pub Version


Print badges to the terminal. Yup, those nifty little thingies we use on readmes, but for CLI apps.

Features

  • Easy to use
  • Inbuilt themes
  • Customizable

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:

Usage

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);
Some more examples:

You could create a donate badge:

var donateBadge = Badge.cyan(label: '❤️ donate', message: 'please?');

print(donateBadge);

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.

Badge Structure

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

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.

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
  • warning : ('Failed') Message on yellow Background
  • info : ('Info') Message on blue Background
Colors

This is the list of all available colors:

  • red
  • black
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white
  • brightRed
  • brightBlack
  • brightGreen
  • brightYellow
  • brightBlue
  • brightMagenta
  • brightCyan
  • brightWhite
Using themes

There are 3 main ways to create a themed badge:

1 - Passing in the theme directly to the Badge constructor:
Badge(
    label: 'failed', 
    message: '2', 
    theme: BadgeTheme.red,
);
2 - Using named constructors:
Badge.red(
    label: 'failed', 
    message: '2', 
);
3 - Or by calling the predefined theme methods:
Badge(...).red();

Additional info

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.

Want badges for some other environment or language?

cli-badges is also available in other languages:

Support the project

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:

  • Starring and sharing the project 🚀
  • Reporting bugs 🐛
  • Sending feedback
  • Or even coding :P

Thanks! ❤️

Manolo Edge GitHub avatar
GitHub 작성자

Manolo Edge ↗

Castellón, Spain공식 웹사이트 ↗
언어Dart

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 2 개

  • test개발 의존성—
  • lints개발 의존성^1.0.0

프로젝트에 맞는 저장소를 선택하려면?

사용 목적에 따라 검색하고 개발 활동을 비교한 뒤 원본 저장소에서 요구 사항을 확인하세요.

  1. 이름, 작성자 또는 설명으로 검색하고 기술 주제로 범위를 좁힙니다.
  2. 스타, 포크, 최근 푸시를 함께 비교하세요. 스타는 관심의 지표이며 품질을 보장하지 않습니다.
  3. 사용하기 전에 GitHub에서 README, 라이선스, Issues를 확인하세요.

출처 및 관리

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗