Quintiq file version 2.0
#parent: #root
Method ColorBackgroundBasedOnSeverity (
  internal[DrawElementInfo] drawinfo,
  Real severity,
  Number position
) id:Method_LibOpt_GlobalState_ColorBackgroundBasedOnSeverity
{
  #keys: '[151132.0.18024267]'
  Body:
  [*
    // Color an image based on the given "severity".
    
    if( severity > 0.0 )
    {
      rel_severity := sqr( severity ) / sqr( LibOpt_Issue::Severity_5_Max() );
      
      color := Color::Color( LibOpt_GlobalState.MaxColorValue(),                                                      // red
                                              [Number] ( LibOpt_GlobalState.MaxColorValue() * ( 1 - rel_severity ) ), // green
                                              [Number] ( LibOpt_GlobalState.MaxColorValue() * ( 1 - rel_severity ) ), // blue
                                              0.42 // opacity
                                            );
      drawinfo.Image( position, 'EXCLAMATION', color );
    }
  *]
  Declarative: true
}
