diff --git a/aleksis/apps/chronos/templates/chronos/partials/lesson.html b/aleksis/apps/chronos/templates/chronos/partials/lesson.html
index 5b7ceb6c511f43087f2f76af5429967131682d92..523b3c62a6885f8dbc06def6daeda62246cb241e 100644
--- a/aleksis/apps/chronos/templates/chronos/partials/lesson.html
+++ b/aleksis/apps/chronos/templates/chronos/partials/lesson.html
@@ -1,12 +1,20 @@
 {% load i18n %}
 
 <div style="
+        {% with sub=lesson_period.get_substitution %}
         {# Display background color only if lesson is not cancelled and it is not the old room #}
-        {% if not lesson_period.get_substitution.cancelled and not lesson_period.get_substitution.cancelled_for_teachers %}
+        {% if not smart %}
+          {% include "chronos/partials/subject_colour.html" with subject=lesson_period.lesson.subject %}
+        {% elif not sub.cancelled and not lesson_period.get_substitution.cancelled_for_teachers %}
           {% if not type.value == "room" or lesson_period.room == lesson_period.get_room or lesson_period.get_room == el %}
-            {% include "chronos/partials/subject_colour.html" with subject=lesson_period.lesson.subject %}
+            {% if sub and sub.subject %}
+              {% include "chronos/partials/subject_colour.html" with subject=sub.subject %}
+            {% else %}
+              {% include "chronos/partials/subject_colour.html" with subject=lesson_period.lesson.subject %}
+            {% endif %}
           {% endif %}
         {% endif %}
+        {% endwith %}
         "
         {# Add CSS class for sub when it's a sub #}
      class="{% if lesson_period.get_substitution and smart %}lesson-with-sub{% endif %}"