From a4a33675f106b01c0b352d76f610e679ac976e16 Mon Sep 17 00:00:00 2001 From: Andrew Minnich Date: Sat, 5 Mar 2016 16:38:15 -0500 Subject: [PATCH] Add outlines to boxes --- theme.lua | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/theme.lua b/theme.lua index 2318319..cdac708 100644 --- a/theme.lua +++ b/theme.lua @@ -4,11 +4,12 @@ local BASE = (...):match('(.-)[^%.]+$') local theme = {} theme.cornerRadius = 4 +theme.lineThickness = 1 theme.color = { - normal = {bg = { 66, 66, 66}, fg = {188,188,188}}, - hovered = {bg = { 50,153,187}, fg = {255,255,255}}, - active = {bg = {255,153, 0}, fg = {225,225,225}} + normal = {bg = { 66, 66, 66}, fg = {188,188,188}, outline = {188,188,188}}, + hovered = {bg = { 50,153,187}, fg = {255,255,255}, outline = {255,255,255}}, + active = {bg = {255,153, 0}, fg = {225,225,225}, outline = {255,255,255}} } @@ -21,9 +22,17 @@ end function theme.drawBox(x,y,w,h, opt, colors) local colors = colors or theme.getColorForState(opt) local cornerRadius = opt.cornerRadius or theme.cornerRadius + local lineThickness = opt.lineThickness or theme.lineThickness love.graphics.setColor(colors.bg) love.graphics.rectangle('fill', x,y, w,h, cornerRadius) + + if colors.outline then + love.graphics.setColor(colors.outline) + love.graphics.setLineWidth(lineThickness) + love.graphics.setLineStyle('smooth') + love.graphics.rectangle('line', x,y, w,h, cornerRadius) + end end function theme.getVerticalOffsetForAlign(valign, font, h)