Back to Devexpress

Themes and Styles in Reporting Components for Web

xtrareports-403927-web-reporting-common-features-themes-and-styles.md

latest12.2 KB
Original Source

Themes and Styles in Reporting Components for Web

  • Jul 18, 2024
  • 4 minutes to read

Themes for Web Reporting are based on Generic , Generic Compact , Material Design , and Material Design Compact themes. For more information, review the following help topic: Predefined Themes. Due to design considerations, compact themes for web reporting components are the same as the themes without the word “compact” in their names.

You can view all available themes in our demo application. To switch themes, use the theme selector in the upper right corner of the application.

Run Demo

The predefined themes and their respective files are listed below. A theme consists of stylesheets that contain a collection of CSS classes.

Predefined Themes

Generic Themes

ThemeCSS File (Generic)CSS File (Generic Compact)
Lightdx.light.css
dx-analytics.light.cssdx.light.compact.css
dx-analytics.light.compact.css
Darkdx.dark.css
dx-analytics.dark.cssdx.dark.compact.css
dx-analytics.dark.compact.css
Carminedx.carmine.css
dx-analytics.carmine.cssdx.carmine.compact.css
dx-analytics.carmine.compact.css
Soft Bluedx.softblue.css
dx-analytics.softblue.cssdx.softblue.compact.css
dx-analytics.softblue.compact.css >
Green Mistdx.greenmist.css
dx-analytics.greenmist.cssdx.greenmist.compact.css
dx-analytics.greenmist.compact.css
Dark Moondx.darkmoon.css
dx-analytics.darkmoon.cssdx.darkmoon.compact.css
dx-analytics.darkmoon.compact.css
Dark Violetdx.darkviolet.css
dx-analytics.darkviolet.cssdx.darkviolet.compact.css
dx-analytics.darkviolet.compact.css
Contrastdx.contrast.css
dx-analytics.contrast.cssdx.contrast.compact.css
dx-analytics.contrast.compact.css

Light (Default)

Dark

Carmine

Dark Moon

Soft Blue

Dark Violet

Green Mist

Contrast

How to Apply a Custom Theme

Review the following help topics for information on how to customize a color scheme in a web reporting application:

Material Design Themes

ThemeCSS File (Material Design)CSS File (Material Design Compact)
Blue Lightdx.material.blue.light.css
dx-analytics.material.blue.light.cssdx.material.blue.light.compact.css
dx-analytics.material.blue.light.compact.css
Blue Darkdx.material.blue.dark.css
dx-analytics.material.blue.dark.cssdx.material.blue.dark.compact.css
dx-analytics.material.blue.dark.compact.css
Lime Lightdx.material.lime.light.css
dx-analytics.material.lime.light.cssdx.material.lime.light.compact.css
dx-analytics.material.lime.light.compact.css
Lime Darkdx.material.lime.dark.css
dx-analytics.material.lime.dark.cssdx.material.lime.dark.compact.css
dx-analytics.material.lime.dark.compact.css
Orange Lightdx.material.orange.light.css
dx-analytics.material.orange.light.cssdx.material.orange.light.compact.css
dx-analytics.material.orange.light.compact.css
Orange Darkdx.material.orange.dark.css
dx-analytics.material.orange.dark.cssdx.material.orange.dark.compact.css
dx-analytics.material.orange.dark.compact.css
Purple Lightdx.material.purple.light.css
dx-analytics.material.purple.light.cssdx.material.purple.light.compact.css
dx-analytics.material.purple.light.compact.css
Purple Darkdx.material.purple.dark.css
dx-analytics.material.purple.dark.cssdx.material.purple.dark.compact.css
dx-analytics.material.purple.dark.compact.css
Teal Lightdx.material.teal.light.css
dx-analytics.material.teal.light.cssdx.material.teal.light.compact.css
dx-analytics.material.teal.light.compact.css
Teal Darkdx.material.teal.dark.css
dx-analytics.material.teal.dark.cssdx.material.teal.dark.compact.css
dx-analytics.material.teal.dark.compact.css

Blue Light

Blue Dark

Lime Light

Lime Dark

Orange Light

Orange Dark

Purple Light

Purple Dark

Teal Light

Teal Dark

How to Apply a Predefined Theme

ASP.NET Core

To apply a predefined theme, include the respective CSS files into the page that contains the reporting component. If your project uses bundled resources, add the corresponding entry to the bundleconfig.json file. The following code adds the Orange Light Material theme:

json
{
"outputFileName": "wwwroot/css/dx.material.orange.light.bundle.css",
"inputFiles": [
    "node_modules/devextreme-dist/css/dx.material.orange.light.css",
    "node_modules/@devexpress/analytics-core/dist/css/dx-analytics.material.orange.light.css"
],
"minify": {
    "enabled": false,
    "adjustRelativePaths": false
}
},

Make sure that the application has access to fonts required for the Material theme. If your application uses Libman , add the following entry to the configuration file:

json
{
  "version": "1.0",
  "defaultProvider": "filesystem",
  "libraries": [

    {
      "library": "node_modules/devextreme-dist/css/icons/",
      "destination": "wwwroot/css/icons",
      "files": [
        "dxiconsmaterial.ttf",
        "dxiconsmaterial.woff",
        "dxiconsmaterial.woff2",
        "dxicons.ttf",
        "dxicons.woff2",
        "dxicons.woff"
      ]
    }
  ]
}

For more information on LibMan , review the following article: Use LibMan with ASP.NET Core in Visual Studio.

ASP.NET MVC

To apply a predefined theme, pass its name as the optional clientUIControlColorScheme parameter to the GetStyleSheets method. Use one of the DevExpress.Web.ASPxWebClientUIControl constant fields to get a theme name. The following code applies the Material Orange Light color scheme to the Reporting application:

cshtml
<head>
...
@Html.DevExpress().GetStyleSheets(ASPxWebClientUIControl.ColorSchemeMaterialOrangeLight,
        new StyleSheet { ExtensionSuite = ExtensionSuite.NavigationAndLayout },
        new StyleSheet { ExtensionSuite = ExtensionSuite.Editors },
        new StyleSheet { ExtensionSuite = ExtensionSuite.Report }
)
...
</head>

As an alternative, use the ASPxWebClientUIControl.GlobalColorScheme property to specify the theme.

csharp
using DevExpress.Web;
//...

    public class HomeController : Controller
    {
        public ActionResult Viewer() {
            ASPxWebClientUIControl.GlobalColorScheme = ASPxWebClientUIControl.ColorSchemeMaterialOrangeLight;
            return View();
        }
    //...
    }
vb
Imports DevExpress.Web
' ...

Public Class HomeController
    Inherits System.Web.Mvc.Controller

    Function Viewer() As ActionResult
            ASPxWebClientUIControl.GlobalColorScheme = ASPxWebClientUIControl.ColorSchemeMaterialOrangeLight
        Return View()
        ' ...
    End Function
End Class

ASP.NET Web Forms

Set the ASPxWebClientUIControl.ColorScheme property to specify a theme. The following code applies the Material Orange Light color scheme:

csharp
public partial class WebForm1 : System.Web.UI.Page {
    protected void Page_Load(object sender, EventArgs e) {
        ASPxWebReportingControl.ColorScheme = DevExpress.Web.ASPxWebClientUIControl.ColorSchemeMaterialOrangeLight;

    }
}
vb
Partial Public Class WebForm1
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        ASPxWebReportingControl.ColorScheme = DevExpress.Web.ASPxWebClientUIControl.ColorSchemeMaterialOrangeLight

    End Sub
End Class

You can specify the color scheme in ASP.NET markup. The following code applies the Material Orange Light color scheme to the Document Viewer:

html
<asp:Content ID="Content" ContentPlaceHolderID="MainContent" runat="server">
    <dx:ASPxWebDocumentViewer ID="ASPxWebReportingControl" runat="server" ColorScheme="material.orange.light">
    </dx:ASPxWebDocumentViewer>
</asp:Content>

As an alternative, use the ASPxWebClientUIControl.GlobalColorScheme property to specify the theme for the entire application:

csharp
void Application_PreRequestHandlerExecute(object sender, EventArgs e)
{
    DevExpress.Web.ASPxWebClientUIControl.GlobalColorScheme = DevExpress.Web.ASPxWebClientUIControl.ColorSchemeMaterialOrangeLight;
}
vb
Sub Application_PreRequestHandlerExecute(ByVal sender As Object, ByVal e As EventArgs)
    DevExpress.Web.ASPxWebClientUIControl.GlobalColorScheme = DevExpress.Web.ASPxWebClientUIControl.ColorSchemeMaterialOrangeLight
End Sub

JavaScript Reporting (Angular, React, Vue)

To apply a predefined theme, include the respective CSS files to the page that contains the reporting component. The following code applies the Material Orange Light theme to the Document Viewer:

typescript
// ...
@Component({
  selector: 'report-viewer',
  encapsulation: ViewEncapsulation.None,
  templateUrl: './report-viewer.html',
  styleUrls: [
    "../../../node_modules/devextreme/dist/css/dx.material.orange.light.css",
    "../../../node_modules/@devexpress/analytics-core/dist/css/dx-analytics.common.css",
    "../../../node_modules/@devexpress/analytics-core/dist/css/dx-analytics.material.orange.light.css",
    "../../../node_modules/devexpress-reporting/dist/css/dx-webdocumentviewer.css"
  ]
  // ...
}