Theme API

Django Template Tags are simple Python functions which accepts a 1 or more value, an optional argument, process those values and return a value to be displayed on the page.
Name Description
Public Methods in the Template Tags
includeFonts() Function to include fonts HTML.
{% includeFonts %}
includeFavicon() Function to print favicon URL.
<link rel="shortcut icon" href="{% includeFavicon %}"/>
getIcon(path, classNames = 'svg-icon', folder = 'media/icons/') Get SVG icon by path.
{% getIcon 'duotune/arrows/arr079.svg' 'svg-icon fs-2 text-success' %}
printHtmlClasses(scope) Print HTML classes based on the scope.
{% printHtmlClasses 'body' %}
printHtmlAttributes(scope) Print HTML attribute based on the scope.
{% printHtmlAttributes as 'body' %}
getGlobalAssets(type) Get global asset files path from the settings.
{% getGlobalAssets 'css' as assets_css %}
getCustomJs() Get custom js files from the settings.
{% getCustomJs as js %}
getCustomCss() Get custom css files from the settings.
{% getCustomCss as css %}
getVendors(type) Get vendor assets files based on the type, either js or css.
{% getVendors 'js' as vendors_js %}
isRtlDirection() Check current text direction based on the settings.
{% isRtlDirection %}
asset(path) Get asset URL by path.
<img alt="Logo" src="{% asset 'media/logos/logo-2.svg' %}" class="h-30px" />
Public Methods in Python
addHtmlAttribute(scope, name, value) Add HTML attributes by scope.
KTTheme.addHtmlAttribute("body", "data-kt-app-sidebar-fixed", "true")
addHtmlAttributes(scope, attributes) Add multiple HTML attributes by scope.
KTTheme.addHtmlAttributes("body", attributes)
addHtmlClass(scope, value) Add HTML class by scope.
KTTheme.addHtmlClass("body", "app-default")
printHtmlAttributes(scope) Print HTML attributes for the HTML template.
KTTheme.printHtmlAttributes("body")
printHtmlClasses(scope, full = True) Print HTML classes for the HTML template.
printHtmlClasses("body", False)
getIcon(path, classNames = 'svg-icon', folder = 'media/icons/') Get SVG icon content.
KTTheme.getIcon('duotune/arrows/arr079.svg', 'svg-icon fs-2 text-success')
asset(path) Get an image path in assets folder by path.
KTTheme.asset(path)
setModeSwitch(Bool flag) Enable or disable the theme mode switch.
KTTheme.setModeSwitch(flag)
isModeSwitchEnabled() Check the theme mode switch status.
KTTheme.isModeSwitchEnabled()
setModeDefault(String mode) Set the default theme mode. The supported values are light, dark and system.
KTTheme.setModeDefault(mode)
getModeDefault() Get the default theme value.
KTTheme.getModeDefault()
setDirection(String direction) Set style direction.
KTTheme.setDirection(direction)
getDirection() Get style direction.
KTTheme.getDirection()
isRtlDirection() Check if style direction is RTL.
KTTheme.isRtlDirection()
extendCssFilename(path) Extend CSS file name with RTL or dark mode.
KTTheme.extendCssFilename(path)
includeFavicon() Include favicon from settings.
KTTheme.includeFavicon()
includeFonts() Include the fonts from settings.
KTTheme.includeFonts()
getGlobalAssets(type) Get the global assets.
KTTheme.getGlobalAssets(type)
addVendors(vendors) Add multiple vendors to the page by name. Refer to settings.KT_THEME_VENDORS.
KTTheme.addVendors(vendors)
addVendor(vendor) Add single vendor to the page by name. Refer to settings.KT_THEME_VENDORS.
KTTheme.addVendor(vendor)
addJavascriptFile(file) Add custom javascript file to the page.
KTTheme.addJavascriptFile(file)
addCssFile(file) Add custom CSS file to the page.
KTTheme.addCssFile(file)
getVendors(type) Get vendor files from settings. Refer to settings.KT_THEME_VENDORS.
KTTheme.getVendors(type)
setLayoutView(view) Set the current page layout and init the layout bootstrap file.
KTTheme.setLayoutView(view)
Preview Get Help Buy Now