GithubHelp home page GithubHelp logo

dahlia-lib / dahlia-rs Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 1.0 66 KB

Dahlia — a simple text formatting package, inspired by the game Minecraft.

Home Page: https://docs.rs/dahlia/1.1.0/dahlia

License: MIT License

Rust 100.00%
rust ansi cli color dahlia terminal text-formatting

dahlia-rs's Introduction

Dahlia.rs

A Rust port of Dahlia — a simple text formatting package, inspired by the game Minecraft.

Text is formatted in a similar way to in the game. With Dahlia, it is formatted by typing a marker (& by default in the original implementation) followed by a format code and finally the text to be formatted.

Usage

Add this to your Cargo.toml:

[dependencies]
dahlia = "1.1"

The documentation is available at docs.rs.

License

dahlia-rs is licensed under the MIT License.

Reference

Color Format Codes

Each digit/letter corresponds to a hex value (dependent on the color depth). The coloring can be applied to the background if a ~ is inserted between & and the code.

Color 3-bit 8-bit 24-bit
0 #000000 #000000 #000000
1 #000080 #0000af #0000aa
2 #008000 #00af00 #00aa00
3 #008080 #00afaf #00aaaa
4 #800000 #af0000 #aa0000
5 #800080 #af00af #aa00aa
6 #808000 #ffaf00 #ffaa00
7 #c0c0c0 #a8a8a8 #aaaaaa
8 #000000 #585858 #555555
9 #000080 #afafff #5555ff
a #008000 #5fff5f #55ff55
b #000080 #5fffff #55ffff
c #800000 #ff5f5f #ff5555
d #800080 #ff5fff #ff55ff
e #808000 #ffff5f #ffff55
f #c0c0c0 #ffffff #ffffff
g #808000 #d7d700 #ddd605

Formatting Codes

Code Result
l Bold
m Strikethrough
n Underline
o Italic
r Reset formatting

Custom Colors

For colors by hex code, use square brackets containing the hex code inside of it.

  • Foreground: &[#xxxxxx]
  • Background: &~[#xxxxxx]

xxxxxx represents the hex value of the color.

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.