Giter VIP home page Giter VIP logo

peterdavehello / colorechoforshell Goto Github PK

View Code? Open in Web Editor NEW
109.0 3.0 18.0 225 KB

Make ๐Ÿš(shell) 's ๐Ÿ’ฌ (`echo`) to be ๐ŸŽจ easily โœจ Support โœ… sh โž• bash โž• zsh โž• ksh โž• ๐ŸŸ One simple command for vibrant text output! ๐Ÿ’ซ

License: GNU General Public License v2.0

Shell 100.00%
echo ksh fish bash color zsh sh shell shellscript script

colorechoforshell's Introduction

ColorEchoForShell

Build Status License badge

ColorEchoForShell brings life to your shell scripts by making text output colorful and meaningful. Whether you're debugging, displaying warnings, or showcasing errors, ColorEchoForShell enhances readability and helps you quickly identify messages in various shell environments.

Quick Start

  1. Download the appropriate script for your shell (e.g., bash, sh, fish, ksh, zsh).

  2. Source the script in your shell:

    . ./ColorEcho.bash # For bash

    Replace ColorEcho.bash with the appropriate filename for your shell.

  3. Try a colorful echo:

    echo.Cyan "Hello, colorful world!"

Features

  • Versatile Compatibility: Works with bash, sh, fish, ksh, and zsh.
  • Easy to Use: Simple syntax for applying styles and colors.
  • Customizable: Supports various styles including bold, italic, underline, blink, and strikethrough.
  • Environment-Dependent Colors: Please note that certain colors may vary depending on the terminal and environment settings.

Table of Contents

Installation

To utilize ColorEchoForShell in your shell scripts, first download the appropriate script for your specific shell from the dist directory. Then, include the ColorEchoForShell script at the beginning of your script by sourcing it:

source ./ColorEcho.bash

Replace ./ColorEcho.bash with the relative path to the downloaded ColorEchoForShell script.

This inclusion will enable all the features of ColorEchoForShell within your script.

Usage

Use the echo.StyleColor syntax to print colorful text. In ksh/sh, omit the . dot symbol. You can combine up to two styles, and the order doesn't matter.

Examples

  • echo.Cyan: Prints text in cyan color.
  • echo.ICyan: Prints text in italic cyan.
  • echo.ULCyan: Prints text in underline cyan.
  • echo.BLCyan: Prints text in blinking cyan.
  • echo.STCyan: Prints text with strikethrough in cyan.
  • echo.BoldCyan: Prints text in bold cyan.
  • echo.BoldULCyan: Prints text in bold underline cyan.
  • echo.ULBoldCyan: Prints text in underline bold cyan.

Supported Shells

Supported Styles

  • Bold: Bold
  • Italic: I
  • Underline: UL
  • Blink: BL
  • Strikethrough: ST

Supported Colors

  • Refer to the color table.
  • Use the Light keyword for lighter versions of standard colors (coded in range 0~7), e.g., LightYellow.

Additional Features

  • Rainbow Output: If you have lolcat, try echo.Rainbow.

Community Contribution

We welcome contributions, bug reports, and suggestions. Feel free to open an issue or submit a pull request.

Screenshots

Screenshot

Demo

Demo

License

GPL-2.0 (GNU GENERAL PUBLIC LICENSE Version 2)

Author

Peter Dave Hello, @Twitter, @GitHub, @GitLab

colorechoforshell's People

Contributors

peterdavehello avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

colorechoforshell's Issues

Fish shell interactive use

Not really an issue, just a snippet to use interactively as the dist file contains multiple function declarations, we can't use native Fish autoloading mechanism and need to extract the functions

Fetch the dist script for fish

curl --location --output $__fish_config_dir/functions/ColorEcho.fish https://raw.githubusercontent.com/PeterDaveHello/ColorEchoForShell/master/dist/ColorEcho.fish

Extract the functions, one per file to leverage autoloading

functions \
	| grep echo. \
	| while read line; \
		funcsave $line --directory $__fish_config_dir/functions/echo-colored/; \
	end

Tell Fish where we extracted the functions, so he can look there too

echo 'set --append fish_function_path $HOME/.config/fish/functions/echo-colored' >> $__fish_config_dir/config.fish

Preview

Open a new shell and try it

echo-colored.webm.mov

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.