prototype 1
This commit is contained in:
13
main.py
13
main.py
@@ -7,24 +7,11 @@ from modules.clocks import crt
|
||||
|
||||
app = flask.Flask(__name__)
|
||||
|
||||
clock = crt.CRTClock(R=((1, 0, 0), (0, 1, 0), (0, 0, 1)))
|
||||
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
return render_template("index.html")
|
||||
|
||||
|
||||
@app.route("/color")
|
||||
def get_color():
|
||||
global clock
|
||||
now = datetime.datetime.now()
|
||||
color = clock.transform(now)
|
||||
r = int(color[0] * 255)
|
||||
g = int(color[1] * 255)
|
||||
b = int(color[2] * 255)
|
||||
return flask.jsonify({"color": f"rgb({r}, {g}, {b})"})
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=True)
|
||||
|
||||
Reference in New Issue
Block a user