From 08a8089529f7839d3c52d46dcaefe60f7d68eb98 Mon Sep 17 00:00:00 2001 From: mat ess Date: Wed, 14 Sep 2022 23:37:16 -0400 Subject: [PATCH] Color tweaks --- ants/main.lua | 5 ++--- life/main.lua | 5 +++-- wireworld/main.lua | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ants/main.lua b/ants/main.lua index 8802217..ac62e9c 100644 --- a/ants/main.lua +++ b/ants/main.lua @@ -42,9 +42,8 @@ local function initScreen() WIDTH, HEIGHT = round2even(width), round2even(height) CANVAS = love.graphics.newCanvas(WIDTH, HEIGHT) CANVAS:renderTo(function() - local color = COLORS[1].rgba - color[4] = 0.9 - love.graphics.setColor(color) + local c = COLORS[1].rgba + love.graphics.setColor({ c[1], c[2], c[3], 0.9 }) love.graphics.rectangle("fill", 0, 0, WIDTH, HEIGHT) end) end diff --git a/life/main.lua b/life/main.lua index b6aaea8..0027afc 100644 --- a/life/main.lua +++ b/life/main.lua @@ -17,12 +17,13 @@ local function initColors() local scheme = colorbrewer.random(2) ON = scheme[1] OFF = scheme[2] + OFF_BG = { OFF[1], OFF[2], OFF[3], 0.9 } end local function initScreen() local width, height = love.graphics.getDimensions() WIDTH, HEIGHT = round2even(width), round2even(height) - love.graphics.setBackgroundColor(OFF[1], OFF[2], OFF[3], 0.9) + love.graphics.setBackgroundColor(OFF_BG) end local function initFont() @@ -167,7 +168,7 @@ function love.draw() if on then love.graphics.setColor(ON) else - love.graphics.setColor(OFF) + love.graphics.setColor(OFF_BG) end love.graphics.rectangle("fill", x, y, UNITS, UNITS) end diff --git a/wireworld/main.lua b/wireworld/main.lua index 8f74ed3..04d86f1 100644 --- a/wireworld/main.lua +++ b/wireworld/main.lua @@ -3,15 +3,15 @@ require "util" local function initColors() local colorbrewer = require("colorbrewer") COLORS = colorbrewer.random(4) + local c = COLORS[#COLORS] + BG = { c[1], c[2], c[3], 0.9 } BLACK = { 0, 0, 0, 1 } end local function initScreen() local width, height = love.graphics.getDimensions() WIDTH, HEIGHT = round2even(width), round2even(height) - local color = COLORS[#COLORS] - color[4] = 0.9 - love.graphics.setBackgroundColor(color) + love.graphics.setBackgroundColor(BG) end local function initFont()