From d0555f67ad14895f72e12b06ca0c114768bd5f4d Mon Sep 17 00:00:00 2001 From: Navaneeth Pk Date: Thu, 2 Sep 2021 11:46:26 +0530 Subject: [PATCH] Customisable font color for string cells (#671) * Customisable font color for string cells * Fallback colors --- .../src/Editor/Components/Table/Table.jsx | 14 ++++++++++--- .../src/Editor/Inspector/Components/Table.jsx | 21 ++++++++++++++----- frontend/src/_helpers/utils.js | 6 +++--- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/frontend/src/Editor/Components/Table/Table.jsx b/frontend/src/Editor/Components/Table/Table.jsx index e25ac49c38..2f4453d134 100644 --- a/frontend/src/Editor/Components/Table/Table.jsx +++ b/frontend/src/Editor/Components/Table/Table.jsx @@ -276,10 +276,18 @@ export function Table({ const cellValue = rowChangeSet ? rowChangeSet[column.name] || cell.value : cell.value; if (columnType === 'string' || columnType === undefined || columnType === 'default') { + + const textColor = resolveReferences(column.textColor, currentState, { cellValue }); + + const cellStyles = { + color: textColor === undefined ? darkMode === true ? '#fff' : 'black' : textColor + } + if (column.isEditable) { return ( { if (e.key === 'Enter') { if(e.target.defaultValue !== e.target.value) { @@ -297,7 +305,7 @@ export function Table({ /> ); } - return {cellValue}; + return {cellValue}; } if (columnType === 'text') { return