Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local c = {colors.green, colors.brown, colors.black, colors.pink, colors.yellow, colors.orange, colors.magenta, colors.purple, colors.cyan, colors.red, colors.white, colors.lightBlue, colors.lightGray, colors.gray, colors.lime, colors.blue}
- local theme = {}
- term.setBackgroundColor(colors.white)
- term.clear()
- term.setTextColor(c[11])
- w,h = term.getSize()
- paintutils.drawLine(1,1,w,1,c[13])
- term.setCursorPos(1,1)
- write("LuaIDE Theme Editor")
- term.setBackgroundColor(c[11])
- term.setTextColor(c[3])
- term.setCursorPos(w/2-5,2)
- print("Menu Colors")
- print("Background")
- print("\nBackground Highlight")
- print("\nButton Color")
- print("\nPrompt Color")
- print("\nError Color")
- print("\nError Highlight")
- term.setCursorPos(w/2-3,h-1)
- write("1/3")
- function drawColor(tableStart)
- for y=3,13,2 do
- for x=1,16 do
- paintutils.drawPixel(x+22,y,c[x])
- end
- term.setCursorPos(33,y)
- term.setBackgroundColor(c[11])
- term.setTextColor(c[13])
- write("#")
- term.setCursorPos(40,y)
- term.setTextColor(c[3])
- write("Selected:")
- end
- term.setBackgroundColor(c[13])
- term.setTextColor(c[11])
- term.setCursorPos(w-7,h-1)
- write(" Next ")
- local valid tc = true
- while true do
- local _,_,x,y = os.pullEvent("mouse_click")
- if x>=w-7 and x<=w-1 and y==h-1 then
- for i=tableStart+1,tableStart+6 do
- if not theme[i] then tc = false end
- end
- if tc == true then return true end
- end
- if x<22 or y>13 or x>38 or y<3 then
- valid = false
- end
- for i=4,13,2 do
- if y == i then
- valid = false
- end
- end
- if valid == false then break end
- paintutils.drawPixel(49,y,c[x-22])
- if x==33 then
- term.setTextColor(c[13])
- term.setCursorPos(49,y)
- write("#")
- end
- theme[tableStart+math.floor(y/2)] = c[x-22]
- end
- term.setTextColor(c[3])
- if valid == false then
- drawColor(tableStart)
- end
- end
- drawColor(0)
- term.setBackgroundColor(c[11])
- term.clear()
- paintutils.drawLine(1,1,w,1,c[13])
- term.setCursorPos(1,1)
- term.setTextColor(c[11])
- write("LuaIDE Theme Editor")
- term.setBackgroundColor(c[11])
- term.setTextColor(c[3])
- term.setCursorPos(w/2-6,2)
- print("Editor Colors")
- print("Background")
- print("\nLine Highlight")
- print("\nLine Number Color")
- print("\nLine Number Highlight")
- print("\nError Color")
- print("\nError Highlight")
- term.setCursorPos(w/2-3,h-1)
- write("2/3")
- drawColor(6)
- term.setBackgroundColor(c[11])
- term.clear()
- paintutils.drawLine(1,1,w,1,c[13])
- term.setCursorPos(1,1)
- term.setTextColor(c[11])
- write("LuaIDE Theme Editor")
- term.setBackgroundColor(c[11])
- term.setTextColor(c[3])
- term.setCursorPos(w/2-6,2)
- print("Syntax Colors")
- print("Text Color")
- print("\nConditions")
- print("\nConstants")
- print("\nFunctions")
- print("\nStrings")
- print("\nComments")
- term.setCursorPos(w/2-3,h-1)
- write("3/3")
- drawColor(12)
- term.setBackgroundColor(c[11])
- term.clear()
- paintutils.drawLine(1,1,w,1,c[13])
- term.setCursorPos(1,1)
- term.setTextColor(c[11])
- write("LuaIDE Theme Editor")
- term.setBackgroundColor(c[11])
- term.setTextColor(c[3])
- term.setCursorPos(w/2-5,2)
- print("Save Theme")
- print("Writing to file.")
- print("Do not change your LuaIDE Theme in settings, or your custom theme will be erased!")
- local mark = {}
- for i=0, #theme do
- local t = theme[i]
- if t==1 then mark[i] = "white" end
- if t==2 then mark[i] = "orange" end
- if t==4 then mark[i] = "magenta" end
- if t==8 then mark[i] = "lightBlue" end
- if t==16 then mark[i] = "yellow" end
- if t==32 then mark[i] = "lime" end
- if t==64 then mark[i] = "pink" end
- if t==128 then mark[i] = "gray" end
- if t==256 then mark[i] = "lightGray" end
- if t==512 then mark[i] = "cyan" end
- if t==1024 then mark[i] = "purple" end
- if t==2048 then mark[i] = "blue" end
- if t==4096 then mark[i] = "brown" end
- if t==8192 then mark[i] = "green" end
- if t==16384 then mark[i] = "red" end
- if t==32768 then mark[i] = "black" end
- end
- fs.delete("./.luaide_theme")
- local file = fs.open("./.luaide_theme","w")
- file.writeLine("background="..mark[1])
- file.writeLine("backgroundHighlight="..mark[2])
- file.writeLine("prompt="..mark[3])
- file.writeLine("promptHighlight="..mark[4])
- file.writeLine("err="..mark[5])
- file.writeLine("errHighlight="..mark[6])
- file.writeLine("")
- file.writeLine("editorBackground="..mark[7])
- file.writeLine("editorLineHightlight="..mark[8])
- file.writeLine("editorLineNumbers="..mark[9])
- file.writeLine("editorLineNumbersHighlight="..mark[10])
- file.writeLine("editorError="..mark[11])
- file.writeLine("editorErrorHighlight="..mark[12])
- file.writeLine("")
- file.writeLine("textColor="..mark[13])
- file.writeLine("conditional="..mark[14])
- file.writeLine("constant="..mark[15])
- file.writeLine("function="..mark[16])
- file.writeLine("string="..mark[17])
- file.writeLine("comment="..mark[18])
- file.close()
- term.setCursorPos(w/2-6,8)
- write("Press any key")
- os.pullEvent("mouse_click")
- term.setBackgroundColor(c[3])
- term.setTextColor(c[11])
- term.setCursorPos(1,1)
- term.clear()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement