Report templatesFunctions
cellBackground
Apply conditional cell background color based on value matching
Usage
The cellBackground function returns a cell background color style when the input matches a target value.
Syntax
{input | cellBackground:target:color}Parameters
input(any): The value to checktarget(any): The value to match againstcolor(string): Hex color code to apply if values match
Returns
- An object with
cellBackgroundproperty if input matches target nullif values don't match or any parameter is null
Examples
Basic color application
{"Active" | cellBackground:"Active":"#00ff00"}
// Returns: { cellBackground: "#00ff00" }Non-matching values
{"Inactive" | cellBackground:"Active":"#00ff00"}
// Returns: nullStatus indicators
{project.status | cellBackground:"Complete":"#28a745"}
// Applies green background if project is completeNumber matching
{score | cellBackground:100:"#ffd700"}
// Gold background for perfect scoresRisk level coloring
{finding.priority | cellBackground:"P1":"#ff0000"}
// Red background for P1 priority findingsUse Cases
- Conditional formatting in report tables
- Status-based cell highlighting
- Performance indicator coloring
- Priority-based visual cues
- Dynamic table styling based on data values