Set the icon color to a standard color of the theme

I cannot see, what I am missing. I try to apply my Theme-Info-Color to an icon, but I cannot find out where the Colors object comes from in the example.

In my code I get the error:
error CS0103: The name 'Colors' does not exist in the current context

I use this code in my .razor file:

<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Start" Gap="1rem" Class="rz-p-4">
	<RadzenIcon Icon="info" IconColor="@Colors.Info" Style="width: 100px; height: 100px; border-radius: 50%; font-size: 4.5rem;" />                            
	<RadzenStack Gap="0">                                
		<RadzenText TextStyle="TextStyle.Body1" class="rz-display-flex rz-mt-2 rz-my-0">Some further details...</RadzenText>
	</RadzenStack>
</RadzenStack>

The code is from the demo pages:

Thank you for a hint.

Hi @rene,

The Colors class is in the Radzen namespace. Make sure you have it in _Imports.razor. Also be sure to use an up-to-date version of Radzen.Blazor as the Colors class was added recently (three months ago).

1 Like

Thank you for your quick response. Sadly, I had no luck yet.
I am using Radzen Blazor Studio 1.21.1. and I am working on a server-side project.
I have two _Imports.razor files: one in the project root:

@using System.Net.Http
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.AspNetCore.Components.Authorization
@using Microsoft.JSInterop
@using MyProject.Shared
@using Radzen

and one in the Pages folder:

@layout MainLayout
@using Radzen
@using Radzen.Blazor

Is that a problem or unusal?
I tried to directly use:
@using Radzen, @using Radzen.Blazor, @using Radzen.Colors and @using Radzen.Blazor.Colors inside my AddProject.razor file (from which I pasted the code above).
But I always get the same CS0103 error, that Colors does not exist.

Thank you for your help.

Check the second part of my reply - you are probably using an older version of Radzen.Blazor which doesn't contain the Colors class yet.

I changed my .csproj file and set the .net version to 8.0:
<TargetFramework>net8.0</TargetFramework>
and the Radzen.Blazor version to
<PackageReference Include="Radzen.Blazor" Version="4.24.2" />
This resolved the issue. Thank you for your help.

This wasn't required just FYI - only upgrading the Radzen.Blazor package version.