Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local gcolors = {}
- if term.isColor() then
- gcolors.header = colors.yellow
- gcolors.text = colors.white
- gcolors.redtext = colors.red
- gcolors.greentext = colors.green
- else
- gcolors.header = colors.gray
- gcolors.text = colors.white
- gcolors.redtext = colors.lightgray
- gcolors.greentext = colors.lightgray
- end
- local function printWithColor(s,c)
- local oc = term.getTextColor()
- term.setTextColor(c)
- print(s)
- term.setTextColor(oc)
- end
- function header(s) printWithColor(s,gcolors.header) end
- function text(s) printWithColor(s,gcolors.text) end
- function ctext(s,c)
- if c=="red" then printWithColor(s,gcolors.redtext) else if c=="green" then printWithColor(s,gcolors.greentext) else error("MRGUI: Invalid ctext color!",0) end end
- end
- function redtext(s) ctext(s,"red") end
- function greentext(s) ctext(s,"green") end
- function getColor(k)
- if k=="red" then return getColor("redtext") end
- if k=="green" then return getColor("greentext") end
- return gcolors[k]
- end
- function setColor(k,v)
- if k=="red" then setColor("redtext",v) end
- if k=="green" then setColor("greentext",v) end
- gcolors[k] = v
- end
Advertisement
Add Comment
Please, Sign In to add comment