From e6fa67801dd66339db0eb05837db49ba96697767 Mon Sep 17 00:00:00 2001 From: Michael Freno Date: Wed, 15 Oct 2025 23:07:58 -0400 Subject: [PATCH] theme text color as default --- FlexLove.lua | 30 ++++++++++++++++++++++++++++-- themes/metal.lua | 2 +- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/FlexLove.lua b/FlexLove.lua index eccee11..2aa5d15 100644 --- a/FlexLove.lua +++ b/FlexLove.lua @@ -2759,7 +2759,19 @@ function Element.new(props) self.z = props.z or 0 - self.textColor = props.textColor or Color.new(0, 0, 0, 1) + -- Set textColor with priority: props > theme text color > black + if props.textColor then + self.textColor = props.textColor + else + -- Try to get text color from theme + local themeToUse = self.theme and themes[self.theme] or Theme.getActive() + if themeToUse and themeToUse.colors and themeToUse.colors.text then + self.textColor = themeToUse.colors.text + else + -- Fallback to black + self.textColor = Color.new(0, 0, 0, 1) + end + end -- Track if positioning was explicitly set if props.positioning then @@ -2876,7 +2888,21 @@ function Element.new(props) self.z = props.z or self.parent.z or 0 end - self.textColor = props.textColor or self.parent.textColor + -- Set textColor with priority: props > parent > theme text color > black + if props.textColor then + self.textColor = props.textColor + elseif self.parent.textColor then + self.textColor = self.parent.textColor + else + -- Try to get text color from theme + local themeToUse = self.theme and themes[self.theme] or Theme.getActive() + if themeToUse and themeToUse.colors and themeToUse.colors.text then + self.textColor = themeToUse.colors.text + else + -- Fallback to black + self.textColor = Color.new(0, 0, 0, 1) + end + end props.parent:addChild(self) end diff --git a/themes/metal.lua b/themes/metal.lua index a8b1875..b59f2a9 100644 --- a/themes/metal.lua +++ b/themes/metal.lua @@ -56,7 +56,7 @@ return { colors = { primary = Color.new(), secondary = Color.new(), - text = Color.new(), + text = Color.new(0.1, 0.1, 0.1), textDark = Color.new(), },