Formatting background colour based on result

1492725893
Aqua Alex
Pro
Sheet Author
Translator
Ok so i want to change the roll template so that the last row has different colours depending on result For instance in the code below I would like a Critical result have a Green background for the row, a Fumble must have a Red background, etc. Can I do this? And  what is the best way to do it? <rolltemplate class="sheet-rolltemplate-coc-attack">     <table>         <caption>{{name}}</caption>         <tr><td class="template_label">Value:</td><td class="template_value">{{success}}/{{hard}}/{{extreme}}</td></tr>         {{#malf}}             <tr><td class="template_label">Malf:</td><td class="template_value">{{malf}}</td></tr>         {{/malf}}         <tr><td class="template_label">Rolled:</td><td class="template_value">{{roll1}}</td></tr>         <tr style="background:#DFF0D8;">             <td class="template_label">Result:</td>                 <!-- 01 is always Critical -->                 {{#rollTotal() roll1 1}}                    <td class="template_value"><b>Critical</b></td>                 {{/rollTotal() roll1 1}}                  <!-- Is Success -->                 {{#rollBetween() roll1 2 success}}                   <!-- Is Standard -->                   {{#rollGreater() roll1 hard}}                     <td class="template_value">Success</td>                   {{/rollGreater() roll1 hard}}                   <!-- Is Hard or Extreme -->                   {{#rollBetween() roll1 2 hard}}                     <!-- Is Hard -->                     {{#rollGreater() roll1 extreme}}                       <td class="template_value">Hard</td>                     {{/rollGreater() roll1 extreme}}                     <!-- Is Extreme -->                     {{#rollBetween() roll1 2 extreme}}                       <td class="template_value"><b>Extreme</b></td>                     {{/rollBetween() roll1 2 extreme}}                   {{/rollBetween() roll1 2 hard}}                 {{/rollBetween() roll1 2 success}}                 <!-- Is Not Success -->                 {{#rollGreater() roll1 success}}                   <!-- Is skill >= 50 -->                   {{#rollGreater() success 49}}                     <!-- Is Fumble -->                     {{#rollTotal() roll1 100}}                        <td class="template_value"><b>Fumble</b></td>                     {{/rollTotal() roll1 100}}                      <!-- Is Fail -->                     {{#rollLess() roll1 100}}                       <td class="template_value">Fail</td>                     {{/rollLess() roll1 100}}                   {{/rollGreater() success 49}}                   <!-- Is skill < 50 -->                   {{#rollLess() success 50}}                     <!-- Is Fumble -->                     {{#rollGreater() roll1 95}}                       <td class="template_value"><b>Fumble</b></td>                     {{/rollGreater() roll1 95}}                     <!-- Is Fail -->                     {{#rollLess() roll1 96}}                       <td class="template_value">Fail</td>                     {{/rollLess() roll1 96}}                   {{/rollLess() success 50}}                 {{/rollGreater() roll1 success}}         </tr>         <tr> <td class="template_label">Dam:</td><td class="template_value">{{damage}}</td> </tr>     </table> </rolltemplate>
1492738562
Brian
Pro
Sheet Author
API Scripter
You look like you've already got the hang of using rollTotal, rollLess, rollGreater, and rollBetween to distinguish between crist/fumbles/neither in the template. Use the same logic to add an appropriate class to your <tr>.