Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
LeshaInc

Rainbow API: Colored Output

Recommended Posts

HE0meKY.png
 
Rainbow
 
Sometimes you need to write colored strings in terminal. It isn't easy in some cases, so i wrote library for colored output.
 
Download
You can download this library using this command: pastebin get J9nAzYai

Also this library can be found in my oppm repository, just navigate to rainbow folder.

 

Example

local color = require("rainbow")
 
local buf = color.buffer{
  colors_ext = {
    foreground = {
      cool = 0x735184
    }
  },
  patterns = {
    progress = function (self, info, now, max)
      return self.fg_white(info) .. "  " .. 
             self.fg_red("[" .. now .. "/" .. max .. "]") .. "\n" ..
             self.bg_black(self.fg_white(""))
    end
  }
}
 
local mycoolcolor = buf.colorize(0xDEAD00, true)
buf(true, "progress", mycoolcolor("i am progress"), buf.fg_red(30), buf.fg_cool(100))
buf("i am text\n")
color.core(
  "i am ", 
  color.core.bg_red("core"), 
  color.core.fg_white(color.core.bg_black(" text\n"))
)

 

Documentation

... will be here soon. Just wait. ;)

 

Enjoy!

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.