示例#1
0
	def POST(self):
		i = web.input(person=session.get("user").replace(" ", ""))
		t = reflux.Theme({
			"name": i.name,
			"author": i.person,
			"description": i.desc,
			"default": "dark"
		})
		t.set_colors({
			"border": i.bg_1,

			"control-2": i.control_2, #Run button border
			"control-3": i.control_3, #Run button fill, lang icon fill, share button fill, sidebar icon hover fill, file hover fill, start thread border

			"primary-1": i.primary, #Current file fill, sidebar icon outline

			"background-1": i.bg_1, #File bar, sidebar, console/shell (active) tab fill, top bar
			"background-2": i.bg_2, #console/shell (passive) tab fill
			"background-3": i.bg_3, #space between the sidebar/filebar, editor, and console/shell

			"foreground-1": i.fore_1, #active tab text (file tab, console/shell), hover text, repl name text, other element text
			"foreground-2": i.fore_2, #active file tab text, other file tab's text
		})
		ids = [0]
		for key in db:
			ids.append(int(key))
		ids.sort()
		id = ids[-1] + 1
		t.build(f"theme{str(id)}.min.js", "w+")
		f = open(f"theme{str(id)}.min.js")
		code = f.read()
		os.remove(f"theme{str(id)}.min.js")
		
		code2 = code.split('`')[1]
		db2[str(id)] = code2
		imgurl = requests.get(f'https://reflux-marketplace-counterapp.herokuapp.com/{id}').text
			
		db[id] = {
			"code": code,
			"imgurl": imgurl,
			"creator": i.person,
			"description": i.desc,
			"name": i.name,
			"verified": False,
			"config": {
				'controls_1': i.control_2,
				'controls_2': i.control_3,
				'primary': i.primary,
				'bg_1': i.bg_1,
				'bg_2': i.bg_2,
				'bg_3': i.bg_3,
				"fore_1": i.fore_1,
				"fore_2": i.fore_2
			}
		}

		raise web.seeother("/?code=2")
示例#2
0
import reflux

from reflux.values import COLORS

t = reflux.Theme({
    "name": "Jett-Black",
    "author": "frissyn",
    "description": "Lights out >:)",
    "default": "dark"
})

for n, v in COLORS["dark"].items():
    t.set_color(n, "black")

t.build("themes/jett-black/theme.min.js")
示例#3
0
import reflux

t = reflux.Theme({
    "name": "Blueberry",
    "author": "frissyn",
    "description": "Make your Repl IDE a blueberry color scheme!",
    "default": "dark"
})

t.set_colors({
    "border": "#00008b",
    "background-1": "#6495ed",
    "background-2": "#76a1ef",
    "background-3": "#87adf1",
    "primary-1": "#00008b",
    "primary-2": "#00009f",
    "primary-3": "#0000b2",
    "primary-4": "#0000c6",
    "positive-1": "#000077",
    "positive-2": "#00008b",
    "positive-3": "#00009f",
    "positive-4": "#0000b2",
    "foreground-1": "#590059",
    "foreground-2": "#450045",
    "foreground-3": "#320032",
    "foreground-4": "#1e001e",
    "positive-transparent-1": "rgba(0, 0, 139, 0.48)",
    "positive-transparent-2": "rgba(0, 0, 139, 0.24)",
    "positive-transparent-3": "rgba(0, 0, 139, 0.12)",
})
示例#4
0
import reflux

t = reflux.Theme({
    "name": "Cactus",
    "author": "frissyn",
    "description": "Coding Cactus' trademark theme!",
    "default": "dark"
})

t.set_colors({
    "border": "#32cd32",
    "control-1": "#0c2f0c",
    "control-2": "#103f10",
    "control-3": "#144f14",
    "foreground-1": "#cccccc",
    "foreground-2": "#c2c2c2",
    "foreground-3": "#b8b8b8",
    "foreground-4": "#adadad",
    "primary-1": "#eb8100",
    "primary-2": "#d87600",
    "primary-3": "#c46c00",
    "primary-4": "#b16100",
    "background-1": "#0f3f0f",
    "background-2": "#0c2f0c",
    "background-3": "#082008",
    "background-4": "#041004"
})

t.build("themes/cactus/theme.min.js", "w+")
示例#5
0
async def generate(ctx, *, args=""):
    if args == "":
        embed = discord.Embed(
            title="Generate a theme",
            url="https://reflux-marketplace.coolcodersj.repl.co/generator",
            color=0x0080ff)
        embed.set_author(name="SnowCoder")
        embed.add_field(
            name="Syntax",
            value=
            '` r!generate [name] | [author] | [description] | [controls color 1] | [controls color 2] | [primary color] | [bg color 1] | [bg color 2] | [bg color 3] | mode`\n\nAll values need to be hex colors, except for name, author, and desc (#000000 = black) ',
            inline=False)
        embed.add_field(name="Controls Color 1",
                        value="This is the run button's border",
                        inline=False)
        embed.add_field(
            name="Controls Color 2",
            value=
            "This is the run button's fill color, language icon fill color, share button fill color, sidebar icons fill on hover, Start thread button border.",
            inline=False)
        embed.add_field(
            name="Primary Color",
            value=
            "This is the current file tab fill, and the sidebar icon's outlines.",
            inline=False)

        embed.add_field(
            name="Background Color 1",
            value=
            "This is the file bar's fill color, the sidebar fill, the top bar fill, and current tab for console/shell. (The fill color for the tab you are currently on for console/shell)",
            inline=False)
        embed.add_field(
            name="Background Color 2",
            value=
            "This is the non-current tab for console/shell. (The fill color for the tab you are currently NOT on for console/shell)",
            inline=False)
        embed.add_field(
            name="Background Color 3",
            value=
            "This is the fill color for the space between the editor and top bar, and the space between all of the main elements. (Editor, sidebars, etc.)",
            inline=False)
        embed.add_field(
            name="Mode",
            value=
            "Can either be ` js ` or ` tms `. JS is the JS bookmarklet code, ` tms ` is the Tampermonkey Script.",
            inline=False)
        await ctx.send(embed=embed)
    else:
        args = args.split(" | ")
        t = reflux.Theme({
            "name": args[0],
            "author": args[1],
            "description": args[2],
            "default": "dark"
        })
        t.set_colors({
            "border": args[7],
            "control-1": args[3],
            "control-2": args[4],  #Run button border
            "control-3": args[
                4],  #Run button fill, lang icon fill, share button fill, sidebar icon hover fill, file hover fill, start thread border
            "primary-1": args[5],  #Current file fill, sidebar icon outline
            "primary-2": args[5],
            "primary-3": args[5],
            "primary-4": args[5],
            "background-1": args[
                6],  #File bar, sidebar, console/shell (active) tab fill, top bar
            "background-2": args[7],  #console/shell (passive) tab fill
            "background-3": args[
                8],  #space between the sidebar/filebar, editor, and console/shell
            "background-4": args[8]
        })
        conn = sqlite3.connect("database.db")
        db2 = conn.cursor()
        query = db2.execute("SELECT * from themes").fetchall()
        id = query[-1][0]
        id += 1
        t.build(f"theme{str(id)}.min.js", "w+")
        if args[9] == "js":
            file = discord.File(f"theme{str(id)}.min.js")
            user = await client.fetch_user(ctx.author.id)
            await user.send(file=file)
            os.remove(f"theme{str(id)}.min.js")
        else:
            code = open(f"theme{str(id)}.min.js").read()
            code = code.split("`")
            code = code[1]
            ts_script = """
			// ==UserScript==
		// @name         Reflux -- {{{NAME}}}
		// @namespace    http://reflux-marketplace.coolcodersj.repl.co/
		// @version      0.1
		// @description  {{{DESC}}}
		// @author       {{{AUTHOR}}}
		// @match        https://*.replit.com/*
		// @grant        none
		// ==/UserScript==

		(
		function () {
		let p1=document.getElementById("reflux-theme");
		let p2=document.getElementById("reflux-display");
		if (p1 && p2) {
			var go=confirm("There is a Reflux theme already running. Would you like to stop it?");
			if (go) {
				p1.remove();p2.remove();alert("This theme has been stopped.");
			} else {alert("This theme will continue running.");
					}
		}
		else {
			var go2="True"};
		if (go2 === "True") {
			var style=document.createElement("style");
			var head=document.getElementsByTagName("head")[0];
			var target=document.getElementsByClassName("jsx-2607100739")[0];
			style.setAttribute("id", "reflux-theme");
			style.appendChild(document.createTextNode(
				`{{{code}}}`
			)
								);
			if (true) {
				console.log(true);
			} else {
				alert("Reflux badge could not be applied. This theme will run silently.");
			}
			head.appendChild(style);
		}
		else {
			alert("Reflux operation cancelled.");
		}
		}
		)
		();
			"""
            ts_script = ts_script.replace("{{{NAME}}}", args[0])
            ts_script = ts_script.replace("{{{AUTHOR}}}", args[1])
            ts_script = ts_script.replace("{{{DESC}}}", args[2])
            ts_script = ts_script.replace("{{{code}}}", code)
            f = open(f"theme{str(id)}tms.min.js", "w")
            f.write(ts_script)
            file = discord.File(f"theme{str(id)}tms.min.js")
            user = await client.fetch_user(ctx.author.id)
            await user.send(file=file)
            os.remove(f"theme{str(id)}.min.js")
            os.remove(f"theme{str(id)}tms.min.js")

        await ctx.send("The generated code has been DM'd to you.")
示例#6
0
import reflux

t = reflux.Theme({
    "name": "Iris Flower",
    "author": "frissyn",
    "description": "A dark mix of purple and yellow.",
    "default": "dark"
})

t.set_colors({
    "border": "#7b16f0",
    "control-1": "#461c6a",
    "control-2": "#3c185b",
    "control-3": "#32144b",
    "primary-1": "#b98500",
    "primary-2": "#a57700",
    "primary-3": "#916900",
    "primary-4": "#7e5b00",
    "background-1": "#280551",
    "background-2": "#1f043e",
    "background-3": "#16032c",
    "background-4": "#0d0219"
})

t.build("themes/iris-flower/theme.min.js", "w+")
示例#7
0
import reflux

t = reflux.Theme({
    "name": "Candyland",
    "author": "frissyn",
    "description": "Turn your Repl IDE into a candy wonderland!",
    "default": "light"
})

t.set_colors({
    "border": "#32cd32",
    "background-1": "#ffc0cb",
    "background-2": "#ffacbb",
    "background-3": "#ff99ab",
    "primary-1": "#ff1493",
    "primary-2": "#ff289c",
    "primary-3": "#ff3ba5",
    "primary-4": "#ff4fae",
    "positive-1": "#ff1493",
    "positive-2": "#ff289c",
    "positive-3": "#ff3ba5",
    "positive-4": "#ff4fae",
    "foreground-1": "#006400",
    "foreground-2": "#005000",
    "foreground-3": "#003d00",
    "foreground-4": "#002900",
    "positive-transparent-1": "rgba(255, 20, 147, 0.48)",
    "positive-transparent-2": "rgba(255, 20, 147, 0.24)",
    "positive-transparent-3": "rgba(255, 20, 147, 0.12)",
})