Skip to content

cellBackground

The cellBackground function returns a cell background color style when the input matches a target value.

{input | cellBackground:target:color}
  • input (any): The value to check
  • target (any): The value to match against
  • color (string): Hex color code to apply if values match
  • An object with cellBackground property if input matches target
  • null if values don’t match or any parameter is null
{"Active" | cellBackground:"Active":"#00ff00"}
// Returns: { cellBackground: "#00ff00" }
{"Inactive" | cellBackground:"Active":"#00ff00"}
// Returns: null
{project.status | cellBackground:"Complete":"#28a745"}
// Applies green background if project is complete
{score | cellBackground:100:"#ffd700"}
// Gold background for perfect scores
{finding.priority | cellBackground:"P1":"#ff0000"}
// Red background for P1 priority findings
  • Conditional formatting in report tables
  • Status-based cell highlighting
  • Performance indicator coloring
  • Priority-based visual cues
  • Dynamic table styling based on data values