Skip to main content

Understand Static vs. Dynamic Coloring

Before writing color scripts, choose between two coloring modes:
ModePropertyBehavior
Dynamictask.taskColorOverrides the default blue color only. Progress-related colors (red for overdue, orange for delayed, gray for resolved) still apply.
Statictask.colorOverrides all coloring. No automatic progress-based colors. Requires gantt.config.show_progress_colors = false in the Gantt Config Script.
diagram

Default Color Legend

Out of the box, the Gantt chart uses these dynamic colors:
ColorMeaning
RedOverdue — end date in the past, still unresolved
OrangeDelayed — progress behind schedule, still unresolved
BlueOn track — unresolved, schedule looks optimistic
GrayResolved — work item completed
Light blueUnscheduled — no start date, defaults to today
GreenProject item — schedule derived from children

Case 1: Date-Based Dynamic Coloring

Highlight tasks starting after today in green while keeping progress colors for all other tasks. In Widget Parameters > Advanced > Item Script:
var today = new Date();
if(task.start_date.getTime() > today.getTime()){
    task.taskColor = "green";
}
This uses dynamic coloring (task.taskColor), so overdue and delayed tasks retain their red/orange indicators.

Case 2: Type and Status Static Coloring

Color tasks based on their work item type and status, overriding all automatic colors. In Widget Parameters > Advanced > Gantt Config Script:
gantt.config.show_progress_colors = false;
In Widget Parameters > Advanced > Item Script:
var today = new Date();
if(wi.getType().getId() === "workpackage" && wi.getStatus().getId() === "draft"){
    if(task.start_date.getTime() < today.getTime()){
        task.color = "green";
    }
}
If you set task.taskColor for tasks that already changed color due to progress (overdue, delayed), the dynamic color takes precedence. Switch to task.color with show_progress_colors = false for full control.

Case 3: Assignee-Based Coloring

Color tasks by their assigned user. This example uses dynamic coloring for a single-assignee scenario:
var assignee = null;
var aIterator = wi.getAssignees().iterator();
if(aIterator.hasNext()){
    assignee = aIterator.next();
    if(assignee && assignee.id === "yourAssigneeId"){
        task.taskColor = "#a9d08e";
    }
}
Both task.color and task.taskColor accept standard color names and HEX values like "#bfbfbf". Use HEX for precise brand or team colors.

Case 4: Overdue Highlighting Without Progress Colors

Show tasks with end dates in the past as red, with all other progress coloring disabled: In Gantt Config Script:
gantt.config.show_progress_colors = false;
In Item Script:
var tdate = new Date();
var edate = task.end_date;
var interval = tdate.getTime() - edate.getTime();
if(interval > 0){
    task.color = "red";
}
If your scripts use wi.type.id or wi.status.id, update them to wi.getType().getId() and wi.getStatus().getId() after upgrading to Polarion 2304+. See Migrate Scripts for Polarion 2304+.

Verify Your Changes

Save the page and reload the Gantt chart. You should now see task bars reflecting your custom color logic. Hover over individual tasks to confirm that the correct conditions trigger the expected colors.

See Also

KB ArticlesSupport TicketsSource Code
  • prod-gantt-src/com.nextedy.polarion.gantt.client/src/js/config.js
  • prod-gantt-src/com.nextedy.polarion.gantt.client/cypress/e2e/Aresource-view/ganttMarkersColorConfigValidation.cy.ts
  • prod-gantt-src/com.nextedy.polarion.gantt.client/cypress/e2e/view/markersStyles.cy.ts
  • prod-gantt-src/com.nextedy.polarion.gantt/src/com/nextedy/polarion/gantt/model/types/TypesConfig.java