Formatting Issues

How to Create SharePoint JSON Colors and Date-Based Row Formatting

Aamir Naveed AkramAamir Naveed Akram Oct 26, 2026 869 views

Question details

The user wants to identify SharePoint Modern formatting colors and apply specific row colors based on a calculation of the number of days before a Start Date.

How to Create SharePoint JSON Colors and Date-Based Row Formatting
Product
SharePoint
Device & OS
not provided
Scenario
Visualizing list data by highlighting upcoming tasks or events based on their start dates.
Observed behavior
The user needs to implement conditional row coloring and requires the correct methodology or JSON expressions to achieve this.
Before you start

Ensure you have the necessary permissions to edit list views and format columns in your SharePoint site before modifying JSON code.

Solution 1

Use Built-in Conditional Formatting

Use SharePoint's native column formatting tools for basic color rules without having to write JSON code.

1
Open column menu

Navigate to your SharePoint list and click on the column header you wish to format.

2
Access formatting settings

Select 'Column settings' from the dropdown, then click on 'Format this column'.

3
Manage rules

Choose 'Conditional formatting' and click on 'Manage rules' to define your basic date criteria.

Free Microsoft Office alternative

Manage Your Data Easily with WPS Office

While SharePoint lists require complex JSON coding for custom row formatting, you can manage, format, and visualize your date-based data effortlessly using WPS Spreadsheet as a powerful desktop alternative.

  1. 1. Open your data file: Launch WPS Spreadsheet and open your existing data tracking file.
  2. 2. Select conditional formatting: Highlight your date column, navigate to the 'Home' tab, and click 'Conditional Formatting'.
  3. 3. Set date rules: Choose 'Highlight Cells Rules', set your date logic (e.g., 'Less Than'), and select a custom color to instantly format your data.
Easily apply date-based conditional formatting using a graphical interface with zero coding required.Fully compatible with Microsoft Excel (.xlsx, .xls) file formats.Lightweight, fast, and highly intuitive for new and experienced users alike.Provides extensive offline capabilities to manage project timelines securely.
microsoft office alternative - wps office

Frequently Asked Questions

Where can I find standard SharePoint Modern formatting colors?

SharePoint provides standard theme colors in its default palette. For custom colors, you can use standard CSS hex codes (e.g., #FFFFFF) or RGB values directly in the 'style' attribute of your JSON formatting code.

Can I use JSON to format an entire row instead of just a single column?

Yes. By selecting 'Format current view' instead of 'Format this column', you can apply JSON styling to the rowFormatter element, which changes the appearance of the entire row based on conditions.

How do I calculate dates in SharePoint JSON?

You can use date operators in JSON to compare a specific date field (like [$StartDate]) to @now (the current date). To calculate specific days, you typically need to convert the difference into milliseconds (86400000 milliseconds per day) within your JSON expression.