From 0c3d709d635f3689746dc550f5b5d0ca18e36a25 Mon Sep 17 00:00:00 2001 From: Serhiii Nanai <59769569+Serj-N@users.noreply.github.com> Date: Tue, 2 Dec 2025 20:52:36 +0200 Subject: [PATCH] feat: add assignment color codes to Progress API (#37438) * feat: change list of color codes * fix: add missing color * style: rename attribute for assignment color list * docs: add explanation for current implementation --- .../course_home_api/progress/serializers.py | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lms/djangoapps/course_home_api/progress/serializers.py b/lms/djangoapps/course_home_api/progress/serializers.py index c48660a41c..2aefe40d6a 100644 --- a/lms/djangoapps/course_home_api/progress/serializers.py +++ b/lms/djangoapps/course_home_api/progress/serializers.py @@ -96,8 +96,27 @@ class GradingPolicySerializer(ReadOnlySerializer): """ Serializer for grading policy """ + + # This implementation of the color coding feature is temporary and for testing purposes only. + # All CSS should be handled by design tokens, this is not implemented yet in Paragon. + # The backend should only work with labels, and the final design includes dynamic Label assignment per course + # (not CSS codes but color Labels), platform-level configuration, etc. + # See discussions in the associated PR for further details: https://github.com/openedx/edx-platform/pull/37438 + ASSIGNMENT_COLORS = [ + "#D24242", # Crimson Red + "#7B9645", # Olive Green + "#5A5AD8", # Periwinkle Blue + "#B0842C", # Amber Gold + "#2E90C2", # Ocean Blue + "#D13F88", # Magenta Pink + "#36A17D", # Jade Green + "#AE5AD8", # Lavender Purple + "#3BA03B", # Forest Green + ] + assignment_policies = serializers.SerializerMethodField() grade_range = serializers.DictField(source='GRADE_CUTOFFS') + assignment_colors = serializers.SerializerMethodField() def get_assignment_policies(self, grading_policy): return [{ @@ -108,6 +127,9 @@ class GradingPolicySerializer(ReadOnlySerializer): 'weight': assignment_policy['weight'], } for assignment_policy in grading_policy['GRADER']] + def get_assignment_colors(self, obj): + return self.ASSIGNMENT_COLORS + class CertificateDataSerializer(ReadOnlySerializer): """