How to Create SharePoint JSON Colors and Date-Based Row Formatting
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.

- 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.
Ensure you have the necessary permissions to edit list views and format columns in your SharePoint site before modifying JSON code.
Use Built-in Conditional Formatting
Use SharePoint's native column formatting tools for basic color rules without having to write JSON code.
Navigate to your SharePoint list and click on the column header you wish to format.
Select 'Column settings' from the dropdown, then click on 'Format this column'.
Choose 'Conditional formatting' and click on 'Manage rules' to define your basic date criteria.
Apply Custom JSON Formatting for Date-Based Rows
Write custom JSON scripts to calculate the number of days before a Start Date and apply specific hex colors to the entire row.
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. Open your data file: Launch WPS Spreadsheet and open your existing data tracking file.
- 2. Select conditional formatting: Highlight your date column, navigate to the 'Home' tab, and click 'Conditional Formatting'.
- 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.

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.





