GithubHelp home page GithubHelp logo

code-translation / colorstyle Goto Github PK

View Code? Open in Web Editor NEW
7.0 0.0 2.0 48 KB

colorStyle is a library of styles for command-line text write in Rust.

Home Page: https://crates.io/crates/colorstyle

License: GNU General Public License v3.0

Rust 100.00%
colorstyle rust-cli color text-style cli-color text-color terminal-color

colorstyle's Introduction

crates.io Released API docs GPL3 licensed Downloads of Crates.io Lines of code Build Languages

colorStyle is a library of styles for command-line text.

Inspired by flylog/colorstyle (golang)

Example

  let text = colorstyle::green("green");
  println!("a {} text", text);

  let text = colorstyle::blue("Blue");
  println!("a {} text\n", text);

  let text = colorstyle::CSS::new().color_red().sprint("red");
  println!("a {} text",text);

  colorstyle::CSS::new().style_italic().color_red().bg_yellow().println("a italic red bgYellow text:  Hello 世界!");

  colorstyle::CSS::new().style_bold().println("a bold text: Hello 世界!");

  colorstyle::CSS::new().style_italic().println("a italic text: Hello 世界!");

  colorstyle::CSS::new().color_magenta().println("a magenta text: Hello 世界!");

  colorstyle::CSS::new().bg_cyan().println("a background color cyan text: Hello 世界!");

  colorstyle::CSS::new().bg_cyan().println("a background color cyan text");
  
  let mut css = colorstyle::CSS::new();
  css.style_strikethrough().println("删除线文本");

  css.style_underline().println("下划线文本");

  css.style_reverse().println("反显文本");

Doc

See this document at API documentation

Todo

  • 增加sprintf()宏支持可变数量的参数,参考标准的println!()

Screen

colorstyle's People

Contributors

wandercn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

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.