Neon-style
Style definitions for nice terminal layouts in rust applications. Built with TUIs in mind.
To render the text like rendering CSS on the front-end. This one example.
use Style;
use Hue;
Inline formatting:
Formatting of the strings done in the same line. Things like bold, italics, strikethrough is part of inline styling.
let inline_style = new_style
.bold
.italic
.faint
.blink
.strikethrough
.underline
.reverse;let padding_style = new_style
.padding_top
.padding_bottom
.padding_left
.padding_right;
Block level formatting
Things includes things like padding and margins..
// Padding
let padding_style = new_style
.padding_top
.padding_bottom
.padding_left
.padding_right;
// margin
let margin_style = new_style
.margin_top
.margin_bottom
.margin_left
.margin_right;
Shorthand form for block level formatting.
// Same padding on all sides.
let padding_style = new_style.padding;
// Padding for top and bottom
let padding_style = new_style.padding;
// Padding on top, sides and bottom. Padidng is top=3, left & right = 4, bottom=5
let padding_style = new_style.padding;
// Padding for all sides in the order -> Top, right, bottom, left
let padding_style = new_style.padding;
// Same margin on all sides. Margin=5
let margin_style = new_style.margin;
// Setting top and bottom margin. Top=3 & bottom=5.
let margin_style = new_style.margin;
//Setting top, sides and bottom. Top=3, right & left=6, bottom=5.
let margin_style = new_style.margin;
// Margin for all sides in the order -> Top, right, bottom, left.
let margin_style = new_style.margin;
Text alignment
use ;
let margin_style = new_style
.align // Align horizontally center.
.align // Align horizontally left.
.align; // Align horizontally right. This is the final selection.
// In order to set the horizontal and vertical alignment together.
// Horizontally center and and vertically left aligned.
let margin_style = new_style.align;
Text width and height
User can set the min height and width using the below format.
use Hue
let s = new_style
.width // Setting the width
.height // Setting the height
.foreground // Setting color using true color.
.set_string;
println!;
To set the max height and width the user may use the following. NOTE: While setting the max height and width the string may be truncated if it goes beyond the specified width or height.
use Hue
let s = new_style
.max_width // Setting the max width
.max_height // Setting the max height
.foreground // Setting color using true color.
.set_string;
println!;