The example below is wrong.
The reason ?
According to the common TH1 code for reports priority is a TEXT column with values 'Immediate' ... 'Zero'. The example on the other hand assumes priority to be INT in range 1 ... 5.

    SELECT
      CASE priority WHEN 1 THEN '#f2dcdc'
           WHEN 2 THEN '#e8e8bd'
           WHEN 3 THEN '#cfe8bd'
           WHEN 4 THEN '#cacae5'
           ELSE '#c8c8c8' END as 'bgcolor',
    ...
    FROM ticket

The code I am now using my ticket setup is

    CASE priority
       WHEN 'Immediate' THEN '#f2dcdc'
       WHEN 'High'      THEN '#e8e8bd'
       WHEN 'Medium'    THEN '#cfe8bd'
       WHEN 'Low'       THEN '#cacae5'
       ELSE                  '#c8c8c8'
       END as 'bgcolor',