diff --git a/.upgradenotes/MDL-84555-2025031404100029.yml b/.upgradenotes/MDL-84555-2025031404100029.yml
new file mode 100644
index 00000000000..7be29027c31
--- /dev/null
+++ b/.upgradenotes/MDL-84555-2025031404100029.yml
@@ -0,0 +1,14 @@
+issueNumber: MDL-84555
+notes:
+ core_course:
+ - message: >-
+ New core_course\output\activity_icon class to render activity icons with
+ or without purpose color. This output will centralize the way Moodle
+ renders activity icons
+ type: improved
+ core:
+ - message: >-
+ The new PHP enum core\output\local\properties\iconsize can be used to limit
+ the amount of icons sizes an output component can use. The enum has the
+ same values available in the theme_boost scss.
+ type: improved
diff --git a/admin/tool/componentlibrary/content/moodle/components/activityicons.md b/admin/tool/componentlibrary/content/moodle/components/activityicons.md
index 2a8e393dd8c..394f1c75af4 100644
--- a/admin/tool/componentlibrary/content/moodle/components/activityicons.md
+++ b/admin/tool/componentlibrary/content/moodle/components/activityicons.md
@@ -9,43 +9,100 @@ tags:
- Available
- '4.0'
- Updated
-- '4.4'
+- '5.0'
---
## Activity icon types
Moodle activity icons are single black SVG icons that are stored in `mod/PLUGINNAME/pix/monologo.svg`.
-### Minimal activity icons
+## Rendering activity icons
+
+The `core_course\output\activity_icon` class is used to render activity icons. It can be used in several ways depending on the context. Also, there is the `core_course\activity_icon` template that can be included directly from mustache templates.
+
+### Rendering the activity plugin icon
+
+The following example shows how to render the default activity icon:
+
+{{< php >}}
+use core_course\output\activity_icon;
+$renderer = \core\di::get(\core\output\renderer_helper::class)->get_core_renderer();
+
+$icon = activity_icon::from_modname('quiz');
+
+echo $renderer->render($icon);
+{{< /php >}}
+
+By default, the activity icon will be rendered colored with the activity purpose color (see below).
+
+### Rendering the activity icon from a cm_info object
+
+Specific activity instances can have their own custom icons. For example, the `mod_resource` displays the MIME type icon for the resource. To render the activity icon from a `cm_info` object, use the static constructor `from_cm_info`. The method will return an instance of `activity_icon` with the icon URL set to the custom icon if necessary.
+
+It is possible to render the activity icon from a `cm_info` object:
+
+{{< php >}}
+use core_course\output\activity_icon;
+$renderer = \core\di::get(\core\output\renderer_helper::class)->get_core_renderer();
+$cminfo = get_fast_modinfo($courseid)->get_cm($cmid);
+
+$icon = activity_icon::from_cm_info($cminfo);
+
+echo $renderer->render($icon);
+{{< /php >}}
+
+### Rendering the activity icon in dark color
+
+There are pages like the gradebook where the activity icons must be rendered in black color for accessibility or usability reasons. The `core_course\output\activity_icon` class has a `set_colourize` method to define if the icon must be colorized or not.
+
+The following example shows how to render the default activity icon in black:
+
+{{< php >}}
+use core_course\output\activity_icon;
+$renderer = \core\di::get(\core\output\renderer_helper::class)->get_core_renderer();
+
+$icon = activity_icon::from_modname('quiz')
+ ->set_colourize(false);
+
+echo $renderer->render($icon);
+{{< /php >}}
+
+### Set the activity icon size
When rendered in a page with limited space the icons will be shown in their original design, for example on the course gradebook where activity show in the grade table header.
-> NOTE: The icon is using the ```.icon``` CSS class which limits the maximum width and height. It's recommended to define width and height into the SVG.
+The `core_course\output\activity_icon` class has a `set_icon_size` method to define the icon size. The method accepts any value from `core\output\local\properties\iconsize` enum.
-{{< example >}}
-
-{{< /example >}}
+The following example shows how to render the default activity icon with a custom size:
-### Coloured activity icons
+{{< php >}}
+use core_course\output\activity_icon;
+use core\output\local\properties\iconsize;
+$renderer = \core\di::get(\core\output\renderer_helper::class)->get_core_renderer();
-In places like the course page and the activity chooser icons have a more prominent role and they should be rendered outlined colored against a transparent background.
+$icon = activity_icon::from_modname('quiz')
+ ->set_icon_size(iconsize::SIZE4);
-The CSS classes for these icons are ```activityiconcontainer``` wrapper class with the added activity name. And the ```activityicon``` class for the image. See the template ```course/format/templates/local/content/cm/title.mustache``` for more info.
+echo $renderer->render($icon);
+{{< /php >}}
-
+### Add extra classes to the activity icon
-### Activity purposes
+The `core_course\output\activity_icon` class has a `set_extra_classes` method to add extra classes to the icon container.
+
+The following example shows how to render the default activity icon with extra classes:
+
+{{< php >}}
+use core_course\output\activity_icon;
+$renderer = \core\di::get(\core\output\renderer_helper::class)->get_core_renderer();
+
+$icon = activity_icon::from_modname('quiz')
+ ->set_extra_classes(['my-extra-class']);
+
+echo $renderer->render($icon);
+{{< /php >}}
+
+## Activity purposes
In the HTML for the example above you might notice the ```assessment``` css class after ```.activityiconcontainer```. This class is the result of assigning a *purpose* to the quiz activity in ```/mod/quiz/lib.php```.
@@ -94,16 +151,24 @@ $info = new cached_cm_info();
$info->iconurl = new moodle_url('https://moodle.org/theme/moodleorg/pix/moodle_logo_small.svg');
{{< /php >}}
-To get this customised icon, use:
+To get this customised icon url, use:
{{< php >}}
$iconurl = get_fast_modinfo($courseid)->get_cm($cmid)->get_icon_url()->out(false);
{{< /php >}}
-
-
+And to render the custom icon:
+
+{{< php >}}
+use core_course\output\activity_icon;
+
+echo $OUTPUT->render(activity_icon::from_cm_info($cminfo));
+{{< /php >}}
+
+