[]
The creation of custom themes and applying them on Web Designer and Js Viewer is now simpler.
The modules '@mescius/activereportsnet-designer' and '@mescius/activereportsnet-viewer' provide 'ColorTheme' and 'ColorThemes' objects, which can be used in both designer and viewer components to customize their appearance. Using the respective APIs, you can modify the color scheme of all interface elements within the Designer and Viewer to align with specific use case requirements. Let's explore some quick use cases and update the Script.js file in our WebSamples for WebDesigner and Js Viewer.
import { createViewer, ColorTheme, ColorThemes } from '@mescius/activereportsnet-viewer';
import { arWebDesigner} from '@mescius/activereportsnet-designer';
Use the following code to create a custom theme:
var theme = {
name: 'testTheme',
backgroundMain: '#f0f0f0',
backgroundPanels: '#ffffff',
primary: 'blue',
secondary: 'green',
neutral: 'grey',
error: 'red',
warning: 'yellow',
fontFamily: 'Arial'
};
Use the following code to create a custom theme based on built-in theme:
var theme = {
...ActiveReports.ColorThemes.default
name: 'testTheme',
primary: 'blue',
secondary: 'green'
});
Use Theme Picker to select from the pre-defined themes in the application.
Use the initialTheme API to apply an initial or default theme to the WebDesigner component.
The following code sets a custom theme as the initial theme of the WebDesigner.
GrapeCity.ActiveReports.Designer.create('#ar-web-designer', {
themes: {
initialTheme: 'testTheme',
themeSelector: {
enabled: false,
availableThemes: ['Default', theme]
}
}
});
The following code sets a built-in theme as the initial theme of the WebDesigner. Here are the built-in themes you can choose from: default, defaultDark, darkOled, highContrast, and highContrastDark.
GrapeCity.ActiveReports.Designer.create('#ar-web-designer', {
themes: {
initialTheme: 'defaultDark',
themeSelector: { enabled: false }
},
});
Use the initialTheme API to apply an initial or default theme to the Js Viewer component.
Use Theme Picker to select from the pre-defined themes in the application.
The following code sets a custom theme as the initial theme of the Js Viewer.
GrapeCity.ActiveReports.JSViewer.create({
element: '#root',
themes: {
initialTheme: 'testTheme',
themeSelector: {
enabled: false,
availableThemes: ['Default', theme]
}
}
});
The following code sets a built-in theme as the initial theme of the Js Viewer. Here are the built-in themes you can choose from: activeReports, activeReportsDark, darkOled, default, defaultDark, highContrast, and highContrastDark.
GrapeCity.ActiveReports.JSViewer.create({
element: '#root',
themes: {
initialTheme: 'defaultDark',
themeSelector: { enabled: false }
},
});