Code Monkey home page Code Monkey logo

colors's Introduction

Colors

This document defines the Zpm Color Standard.

Installation

Using zpm

Add zpm load zpm-zsh/colors into .zshrc

Using oh-my-zsh

Execute git clone https://github.com/zpm-zsh/colors ~/.oh-my-zsh/custom/plugins/colors. Add colors into plugins array in .zshrc

Using antigen

Add antigen bundle zpm-zsh/colors into .zshrc

Using zgen

Add zgen load zpm-zsh/colors into .zshrc

Note

Load this plugin before others otherwise plugins can't use it

Usage

echo $c[reset] Reset all
echo $c[default] Default text color $c[reset]
echo $c[bold] Bold text $c[reset]
echo $c[dim] Dim text $c[reset] # or $c[faint]
echo $c[coursive] Coursive text $c[reset] # or $c[italic]
echo $c[underline] Underlined text $c[reset]
echo $c[blink] Blink text $c[reset] "<- Blink"
echo $c[inverse] Inverse text $c[reset] # or $c[reverse]
echo $c[hidden] Hidden text $c[reset] "<- Hidden text" # or $c[conceal]
echo $c[strike] Strike text $c[reset] # or $c[strikethrough]
echo
echo $c[double_underline] Double underlined text $c[reset]
echo
echo $c[overline] Overlined text $c[reset]
echo
echo BASE COLOR $c[base1] BASE1 COLOR $c[base2] BASE2 COLOR $c[base3] BASE3 COLOR $c[base4] BASE4 COLOR
echo
echo $c[red] Red color $c[reset]
echo $c[orange] Orange color $c[reset]
echo $c[bg_red] Red background $c[reset]
echo $c[bg_orange] Orange background $c[reset]

Screenshot

Aviable modificators

  • Self-descriptive modificators: bold, dim, coursive, underline, blink, inverse, hidden, strike, double_underline, overline
  • Base colors: base1, base2, base3, base4
  • 6 base colors: red, green, blue, yellow, cyan, magenta
  • 6 additional colors: orange, chartreuse, springgreen, azure, violet, purple
  • 6 base background colors with bg_ prefix: bg_red, bg_green, bg_blue, bg_yellow, bg_cyan, bg_violet
  • 6 additional background colors with bg_ prefix: bg_orange, bg_chartreuse, bg_springgreen, bg_azure, bg_violet, bg_purple

Who we need this?

Many color schemes define very beautiful colors for your terminal emulator. But they have big issue: some CLI apps show output text with same color than your background. So, this text will be invisible.

Solution?

Set-up your terminal emulator colors

  1. Do not use Show bold text in bright colors, or something like this. Bold should be bold, bright should be bright. Do not mix these options.

  2. Your color distribution should be like this, from darker to lighter, or from lighter to darker: background, primary color (base1), lighter variant of primary (base2), secondary (base3), lighter variant of secondary (base4), foreground.

    Colors

  3. Set-up 6 terminal colors: red, green, blue, yellow, cyan, magenta, and lighter variant of them as 6 additional colors: orange, chartreuse, springgreen, azure, violet, purple. This will provide you possibility to set 24 colors, using $c[modificator]: 6 base colors + 6 additional colors, 12 colors with dim modification (color + dim).

colors's People

Contributors

grigorii-horos 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

Watchers

 avatar  avatar

colors's Issues

"plugins/colors/colors.plugin.zsh:5: unknown file attribute"

I've recently run into an issue where the plugin throws the following error on RHEL6:
"plugins/colors/colors.plugin.zsh:5: unknown file attribute"

Researching the issue it looks like the following line can't initialize the data object and populate it at the same time:
typeset -Ag c=(

Changing the above to this seemed to fix it:
typeset -Ag c; c=(

[Feature Request] Allow us to add own custom colours

Hello,

Give a look at the example of ohmyzsh/plugins/web-search and go to the end of README where ZSH_WEB_SEARCH_ENGINES allows us to add other search engine contexts.

I would do like:

autoload colors
colors

c=(
    skyblue_hex '%F{#87afdf}'
    piltover_hex '%F{#858569}'

    skyblue_ansi '�[38;2;15;161;166m'
    piltover_ansi '�[38;2;133;133;105m'
)

And it looks like:

echo $c[red] Red colour $c[default]and $c[piltover]Piltover‘s colour. $c[reset]
  • Mix of zpm-zsh's colors with colour functions:
    image

  • Using ZSH's colour hexadecimal codes, but it requires print -P. And using ANSI RGB code does not require print -P:

    image

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.