Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jbrooksuk/laravel-colorize
A handy set of Stringable mixins for CLI text.
https://github.com/jbrooksuk/laravel-colorize
Last synced: about 12 hours ago
JSON representation
A handy set of Stringable mixins for CLI text.
- Host: GitHub
- URL: https://github.com/jbrooksuk/laravel-colorize
- Owner: jbrooksuk
- License: mit
- Created: 2021-05-21T21:51:48.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-05-24T15:04:30.000Z (over 3 years ago)
- Last Synced: 2024-05-02T00:19:22.243Z (5 months ago)
- Language: PHP
- Homepage: https://james.brooks.page
- Size: 12.7 KB
- Stars: 46
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
# Laravel Colorize
A mixin for Laravel's `Stringable` to easily apply colors and styles to CLI text.
[![Latest Version on Packagist](https://img.shields.io/packagist/v/jbrooksuk/laravel-colorize?style=flat-square)](https://packagist.org/packages/jbrooksuk/laravel-colorize)
![Test](https://github.com/jbrooksuk/laravel-colorize/workflows/Test/badge.svg)
[![Total Downloads](https://img.shields.io/packagist/dt/jbrooksuk/laravel-colorize?style=flat-square)](https://packagist.org/packages/jbrooksuk/laravel-colorize)## Installation
You can install the package via Composer:
```
composer require jbrooksuk/laravel-colorize
```## Usage
### `blink`
Make the text blink.
```php
Str::of('Hey Laravel')->blink();
```### `bold`
Make the text bold.
```php
Str::of('Hey Laravel')->bold();
```### `colorize`
Colorize the text. Foreground, Background.
```php
Str::of('Hey Laravel')->colorize('red', 'blue');
```### `conceal`
Make the text invisible.
```php
Str::of('Hey Laravel')->conceal();
```### `reverse`
Swap the foreground with the background and the background with the foreground.
```php
Str::of('Hey Laravel')->colorize('red', 'blue')->reverse();
```### `underscore`
Make the text underscored.
```php
Str::of('Hey Laravel')->underscore();
```## Chaining
Because Laravel Colorize uses `Stringable`, all of these methods can be chained together.
```php
Str::of('Hey Laravel')->colorize('red', 'yellow')->bold()->blink();
```