pd4d10 / Tiza
Licence: mit
Console styling for browsers
Stars: ✭ 74
Programming Languages
typescript
32286 projects
Projects that are alternatives of or similar to Tiza
log-utils
Basic logging utils: colors, symbols and timestamp.
Stars: ✭ 24 (-67.57%)
Mutual labels: console, color, style
leeks.js
Simple ANSI styling for your terminal
Stars: ✭ 12 (-83.78%)
Mutual labels: console, color, style
Gradient String
🌈 Beautiful color gradients in terminal output
Stars: ✭ 476 (+543.24%)
Mutual labels: console, color
Konsul
A react renderer for browser's dev console
Stars: ✭ 605 (+717.57%)
Mutual labels: console, browser
Closestx11color
Find the closest xterm-256 colors (between 0 and 255) to an arbitrary HTML hexa color (e.g. #ABCDEF)
Stars: ✭ 13 (-82.43%)
Mutual labels: console, color
Mordant
Full-featured text styling for Kotlin command-line applications
Stars: ✭ 382 (+416.22%)
Mutual labels: console, color
Phpinsights
🔰 Instant PHP quality checks from your console
Stars: ✭ 4,442 (+5902.7%)
Mutual labels: console, style
Console.md
Ever dreamed of rendering Markdown in the console? No. Neither had I.
Stars: ✭ 24 (-67.57%)
Mutual labels: console, browser
ColorPick.js
A simple and minimal jQuery color picker plugin for the modern web.
Stars: ✭ 48 (-35.14%)
Mutual labels: color, style
Colorette
Easily set the color and style of text in the terminal.
Stars: ✭ 1,047 (+1314.86%)
Mutual labels: console, browser
Crossterm
Cross platform terminal library rust
Stars: ✭ 1,023 (+1282.43%)
Mutual labels: console, color
Nord Highlightjs
An arctic, north-bluish clean and elegant highlight.js theme.
Stars: ✭ 49 (-33.78%)
Mutual labels: style, color
Snazzy
Format JavaScript Standard Style as Stylish (i.e. snazzy) output
Stars: ✭ 381 (+414.86%)
Mutual labels: style, browser
Theme Ui
Build consistent, themeable React apps based on constraint-based design principles
Stars: ✭ 4,150 (+5508.11%)
Mutual labels: style, color
Colorful
Terminal string styling done right, in Python 🐍 🎉
Stars: ✭ 456 (+516.22%)
Mutual labels: console, style
Rang
A Minimal, Header only Modern c++ library for terminal goodies 💄✨
Stars: ✭ 1,080 (+1359.46%)
Mutual labels: console, color
color-console
A lightweight header-only C++ library to bring colors to your Windows console with a very-easy-to-use API.
Stars: ✭ 97 (+31.08%)
Mutual labels: console, color
terminal-style
🎨 Return your terminal message in style! Change the text style, text color and text background color from the terminal, console or shell interface with ANSI color codes. Support for Laravel and Composer.
Stars: ✭ 16 (-78.38%)
Mutual labels: color, style
Tiza
Tiza is a JavaScript library for browsers' console styling.
View demo here: https://tiza.js.org
Installation
NPM
npm install --save tiza
Then import it:
import tiza from 'tiza'
// or via require if you are using commonjs
const tiza = require('tiza').default
UMD bundle
Add script tag to your HTML file:
<script src="https://unpkg.com/tiza/dist/tiza.min.js"></script>
Usage
import tiza from 'tiza'
tiza
.color('#fff') // Set color, all CSS colors are supported
.bgColor('purple') // Set background color
.bold() // Set bold font
.italic() // Set italic font
.size(20) // Set font size
// Support custom styles too!
.style(`padding: 4px; border-radius: 2px;`)
// After styles done right, it's time to add text now
.text('Hey, I have styling now!')
.space(8) // Add spaces
.text('Hey, I am far away from previous one')
.newline(2) // Add newline
.reset() // Reset all styles set before
.text('I lost my styles, because `reset` is called')
.log() // log all texts above to console
Always remember to call log
method at last.
Styles reusing
To reuse styles, just make them nested like this:
const error = tiza.color('red').text
const info = tiza.bold().bgColor('yellow').text
tiza.log(
error('I am some error'),
'I am some normal message',
error('I am some error again!'),
info('I am some info', error('I am still some error!')),
)
Notice that inside texts will not extend outside texts' styles.
For more detail see API
How does it work?
Styling console output with CSS
Who's using Tiza
API
Method | Description |
---|---|
tiza.color('#f00') |
Set font color, support all CSS colors |
tiza.bgColor('#f00') |
Set background color, support all CSS colors |
tiza.bold() |
Set font weight to bold |
tiza.italic() |
Set font style to italic |
tiza.size(14) |
Set font size, number will be converted to px
|
tiza.style('color:#f00') |
Set custom style, using inline style format |
tiza.reset() |
Reset styles set before |
tiza.text(...args: string[]) |
Add text(s), support multiple arguments. Every text added here will be styled with styles set previously. Notice that every argument will be converted to string, and there will be no space between them(This behaviour is different with console.log ). If you want to add a space, use text('a').space().text('b')
|
tiza.space(count?: number) |
Add space. The default count is 1 |
tiza.newline(count?: number) |
Add newline. The default count is 1 |
tiza.log() |
Log all texts to console with console.log . Always remember to call log at last. Arguments are also supported, log(...args) equals to text(...args).log()
|
tiza.info() |
The same as tiza.log , but output with console.info
|
tiza.warn() |
The same as tiza.log , but output with console.warn
|
tiza.error() |
The same as tiza.log , but output with console.error
|
License
MIT
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].