From e6ecb8d7ff8824e44c40e4434e1f8037ec5dc6f7 Mon Sep 17 00:00:00 2001
From: Eryk Mika <eryk.mika@wpdesk.eu>
Date: Thu, 27 Feb 2025 13:18:45 +0100
Subject: [PATCH] feature: text color selector for odd rows

---
 src/FlexibleTable/FlexibleTable.jsx | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/src/FlexibleTable/FlexibleTable.jsx b/src/FlexibleTable/FlexibleTable.jsx
index 1ff228c..7ff2c36 100644
--- a/src/FlexibleTable/FlexibleTable.jsx
+++ b/src/FlexibleTable/FlexibleTable.jsx
@@ -44,6 +44,7 @@ export default function FlexibleTable({attributes, setAttributes, placeholders,
 		bodyBackground,
 		multipleBodyBackground,
 		bodyBackgroundOdd,
+		bodyTextColorOdd,
 		bodyTextColor,
 		bodyTextAlign,
 		bodyFontWeight,
@@ -235,13 +236,13 @@ export default function FlexibleTable({attributes, setAttributes, placeholders,
 				</PanelBody>
 				<PanelBody title={__('Body appearance', 'flexible-invoices-core')}>
 					<ColorSelector
-						label={__('Text Color', 'flexible-invoices-core')}
+						label={__('Text color', 'flexible-invoices-core')}
 						value={bodyTextColor}
 						enableAlpha={false}
 						onChange={(value) => setAttributes({bodyTextColor: value})}
 					/>
 					<ColorSelector
-						label={__('Background Color', 'flexible-invoices-core')}
+						label={__('Background color', 'flexible-invoices-core')}
 						value={bodyBackground}
 						enableAlpha={false}
 						onChange={(value) => setAttributes({bodyBackground: value})}
@@ -253,11 +254,23 @@ export default function FlexibleTable({attributes, setAttributes, placeholders,
 						onChange={(newValue) => setAttributes({multipleBodyBackground: newValue})}
 					/>
 
-					{multipleBodyBackground ? <ColorSelector
+					{multipleBodyBackground ?
+						<>
+							<ColorSelector
 						label={__('Background color (odd rows)', 'flexible-invoices-core')}
 						value={bodyBackgroundOdd}
 						onChange={(value) => setAttributes({bodyBackgroundOdd: value})}
-					/> : ''}
+					/>
+						<ColorSelector
+							label={__('Text color (odd rows)', 'flexible-invoices-core')}
+							value={bodyTextColorOdd}
+							enableAlpha={false}
+							onChange={(value) => setAttributes({bodyTextColorOdd: value})}
+						/>
+						</>
+						: ''
+
+					}
 
 					<NumberWithUnit
 						label={__('Font size', 'flexible-invoices-core')}
@@ -398,7 +411,7 @@ export default function FlexibleTable({attributes, setAttributes, placeholders,
 											key={index}
 											value={row}
 											style={{
-												color: bodyTextColor,
+												color: (multipleBodyBackground && index === 1) ? bodyTextColorOdd : bodyTextColor,
 												textAlign: bodyTextAlign,
 												fontStyle: bodyFontStyle,
 												fontSize: bodyFontSize,
-- 
GitLab