Theme API

Name Description
AddHtmlAttribute(string scope, string attributeName, string attributeValue) Adds new attribute for html element specified in function parameters.
KTTheme.AddHtmlAttribute("html", "direction", "rtl");
AddHtmlClass(string scope, string className) Adds new class for html element specified in function parameters.
KTTheme.AddHtmlClass("body", "header-fixed");
PrintHtmlAttributes(string scope) Returns all attributes by scope name, attributes are separated with space.
<html @Html.Raw(KTTheme.PrintHtmlAttributes("html"))>...</html>
PrintHtmlClasses(string scope) Returns classes by scope name, classes are separated with space.
<body class='@KTTheme.PrintHtmlClasses("body")'>...</body>
getIcon(string path, string classNames) Returns a code of svg icon wrapped with span tag, classes will be added on span element.
@((MarkupString)KTTheme.getIcon("duotune/ecommerce/ecm001.svg", "svg-icon fs-1 text-success"))
SetModeSwitch(bool flag) Enables/disables the mode switch.
KTTheme.SetModeSwitch(false);
IsModeSwitchEnabled() Checks if mode switch is enabled.
KTTheme.IsModeSwitchEnabled()
SetModeDefault(String mode) Sets the default theme mode. The supported values are light, dark and system.
KTTheme.SetModeDefault("dark")
GetModeDefault() Returns the default theme mode value.
KTTheme.getModeDefault()
SetDirection(string direction) Sets theme direction LTR/RTL.
KTTheme.SetDirection("RTL");
GetDirection() Returns current theme direction.
KTTheme.GetDirection()
IsRtlDirection() Checks if currently RTL direction is enabled.
KTTheme.IsRtlDirection()
GetAssetPath(string path) Returns full asset path path.
KTTheme.GetAssetPath("plugins/global/plugins.bundle.css");
ExtendCssFilename(string path) Extends css file name with .rtl to use RTL direction styles.
KTTheme.ExtendCssFilename("css/style.bundle.css")
GetFavicon() Returns favicon icon path from the configuration.
KTTheme.GetFavicon();
GetFonts() Returns array fonts from the configuration.
KTTheme.GetFonts();
GetGlobalAssets(String type) Returns theme global asset files defined in the configuration.
@foreach(string file in KTTheme.GetGlobalAssets("Css")){
    <link rel="stylesheet" type="text/css" href="@file" />
}
GetAttributeValue(string scope, string attributeName) Returns attribute value, specified in params, scope, and attribute name.
KTTheme.GetAttributeValue("body", "data-kt-app-layout")
Preview Get Help Buy Now