Edit this page

Sass-Based Themes

As of the R1 2017 release, the Kendo UI distribution includes Sass-based themes.

Currently, Kendo UI delivers a single Sass theme. This is the Default v2 theme which is a modern update of the Kendo UI Default theme. The work on revamping the Kendo UI Bootstrap theme has also started and the new theme is soon expected to be available.

Overview

Apart from being written in a different language, the Sass-based themes are slightly different from the Less-based ones. This article outlines those differences and demonstrates how to use the Sass-based themes.

Differences

In Kendo UI, the Sass-based themes demonstrate the following differences from the Less-based ones:

  • Each Sass-based theme is represented by a single CSS file that combines the layout and the themes of the components. As a result, you do not need to match a theme with its common file.
  • Based on the widget you work with, the Sass-based themes can build a part of the widget theme in a similar way the Download Builder trims unused scripts.
  • The Sass-based themes are available on NPM. Each theme is stored as an NPM package and can be easily upgraded.
  • Each Sass-based theme is compatible with the Kendo UI components for Angular 2. This enables you to port parts of your application to Angular 2 while maintaining their styling.

Browser Limitations

The following CSS features, which are used by the Sass-based themes, provide limited browser support:

  • Flexbox layout—Not supported by Internet Explorer 10 and earlier.
  • CSS gradients—Not supported by Internet Explorer 9 and earlier.
  • Web Open Font Format—Not supported by Internet Explorer 8 and earlier.
  • Border radius—Not supported by Internet Explorer 8 and earlier.
  • Alpha transparency colors—Not supported by Internet Explorer 8 and earlier.

Getting the Themes

To get the Sass-based Kendo UI themes, you can:

  • Use the pre-build CSS files.
  • Use the NPM packages.

Using Pre-Built CSS

To get a complete theme by using its pre-built CSS files, apply either of the following approaches:

  • Use the CSS files that are shipped with the Kendo UI distribution. For example, the Default v2 theme is distributed as styles/kendo.default-v2.min.css.
  • Use the NPM package which contains a pre-built dist/all.css CSS file for the theme. For more information on how to obtain the NPM package, refer to the following section on using NPM packages.

Using NPM Packages

The Kendo UI Sass-based themes are located on the Progress NPM registry:

  • Kendo UI Default Theme—Available as @progress/kendo-theme-default.
  • Kendo UI Bootstrap Theme—Available as @progress/kendo-theme-bootstrap.

To access the Progress NPM registry, you need an active Telerik account with an active commercial license. For more information on how to access the NPM registry, refer to the installation instructions for Kendo UI Professional.

Customizing the Themes

To customize a Sass-based theme, create a .scss file and consume the theme package in the following way:

  1. Obtain the theme source through the NPM package.

    npm install @progress/kendo-theme-default
    
  2. Create a .scss file that will consume the theme. For the purposes of the this example, this is styles.scss.

  3. To build the theme files, import them into the file.

    @import "node_modules/@progress/kendo-theme-default/scss/all";
    

    To include the styles of specific widgets, use their names in the path.

    @import "node_modules/@progress/kendo-theme-default/scss/grid";
    @import "node_modules/@progress/kendo-theme-default/scss/treeview";
    
  4. To customize the variables that are used in the theme, change the theme before you import the theme files.

    $accent: #E82C0C; // brand color
    
    @import "node_modules/@progress/kendo-theme-default/scss/all";
    
  5. Build the styles.scss file through a Sass compiler. For example, use node-sass.

    node-sass styles.scss styles.css
    

Variables

The following list describes the theme variables available for adjustment in the Kendo UI Default theme.

Common

Name Default value Description
$font-size 14px Base font size across all components.
$font-family inherit Font family across all components.
$font-family-monospace Consolas, "Ubuntu Mono", "Lucida Console", "Courier New", monospace Font family for monospaced text. Used for styling the code.
$line-height (20 / 14) Line height used along with $font-size.
$border-radius 2px Border radius for all components.
$accent #ff6358 The color that focuses the user attention.
Used for primary buttons and for elements of primary importance across the theme.
$accent-contrast #ffffff The color used along with the accent color denoted by $accent.
Used to provide contrast between the background and foreground colors.
$base-text #656565 The text color of the components' chrome area.
$base-bg #f6f6f6 The background of the components' chrome area.
$base-border rgba( black, .08 ) The border color of the components' chrome area.
$base-gradient $base-bg, darken( $base-bg, 2% ) The gradient background of the components' chrome area.
$hovered-text #656565 The text color of hovered items.
$hovered-bg #ededed The background of hovered items.
$hovered-border rgba( black, .15 ) The border color of hovered items.
$hovered-gradient $hovered-bg, darken( $hovered-bg, 2% ) The gradient background of hovered items.
$selected-text $accent-contrast The text color of selected items.
$selected-bg $accent The background of selected items.
$selected-border rgba( black, .1 ) The border color of selected items.
$selected-gradient none The gradient background of selected items.
$error #f5503e The color for error messages and states.
$warning #fdce3e The color for warning messages and states.
$success #5ec232 The color for success messages and states.
$info #3e80ed The color for informational messages and states.

Buttons

Name Default value Description
$button-text $base-text The text color of the buttons.
$button-bg $base-bg The background of the buttons.
$button-border $base-border The border color of the buttons.
$button-gradient $base-gradient The background gradient of the buttons.
$button-hovered-text $hovered-text The text color of hovered buttons.
$button-hovered-bg $hovered-bg The background of hovered buttons.
$button-hovered-border $hovered-border The border color of hovered buttons.
$button-hovered-gradient $hovered-gradient The background gradient of hovered buttons.
$button-pressed-text $selected-text The text color of pressed buttons.
$button-pressed-bg $selected-bg The background color of pressed buttons.
$button-pressed-border $selected-border The border color of pressed buttons.
$button-pressed-gradient none The background gradient of pressed buttons.
$button-focused-shadow 0 3px 4px 0 rgba(0, 0, 0, .06) The shadow of focused buttons.

Charts

Name Default value Description
$series-a #ff6358 The color of the first series.
$series-b #ffd246 The color of the second series.
$series-c #78d237 The color of the third series.
$series-d #28b4c8 The color of the fourth series.
$series-e #2d73f5 The color of the fifth series.
$series-f #aa46be The color of the sixth series.
$chart-major-lines rgba(0, 0, 0, .08) The color of the Chart grid lines (major).
$chart-minor-lines rgba(0, 0, 0, .04) The color of the Chart grid lines (minor).

Toolbar

Name Default value Description
$toolbar-padding-x $padding-x The horizontal padding of the container.
$toolbar-padding-y $padding-x The vertical padding of the container.

Mixins

exports

Outputs a module once, no matter how many times it is included.

Parameters
  • name: String—The name of the exported module.

Contribution

To contribute to the development of the Kendo UI Default Theme, refer to the telerik/kendo-theme-default GitHub repository it is stored in.

Sass Theme Builder

Progress Sass Theme Builder for Kendo UI is an Angular web application that enables you to create new or customize existing themes.

The tool renders the same look and feel as the look and feel of all other components in the suite. It also delivers full control over the skin elements of each component and automatically updates its composite units. After you create the skin and achieve the desired look of the theme, the Sass Theme Builder enables you to download and integrate it in your project.

Figure 1: A preview of the Sass Theme Builder

Theme Builder Overview

Creating New Themes

To create a new theme:

  1. On the initial Sass Theme Builder pane, select the Start Theming option.
  2. Choose one of the existing skins to use as a base. The currently available built-in skins are Default and Bootsrap.

    Figure 2: Selecting a base theme

    Theme Builder Create and Download 1

Customizing Existing Themes

The Sass Theme Builder supports the following options for customization:

  • Color pickers which customize the appearance of the components.
  • The Apply changes instantly option which enables you to observe the changes on the fly.
  • Manual updates of each component element.
  • Utilization of predefined color swatches.

Functionalities for Customization

To customize an existing theme, use the following Sass Theme Builder functionalities:

  1. Color Swatches—Contains predefined color palettes that you can apply to all components in your application.
  2. Default—Provides the applicable color customization options.
  3. Preview Components—Keeps the main view of the components. It reflects the customization changes you make each time you add or remove theme elements.
  4. Download—Downloads the archive that holds the generated style files after the customization completes. When you click the button, a dialog appears and prompts you to name your theme.

Figure 3: Available options for customization

Theme Builder Create and Download 3

Importing the Themes

To upload an existing theme you have previously created:

  1. On the initial Sass Theme Builder pane, select Import Theme.
  2. Upload the variables.scss file which contains your current modifications of the customized theme. As a result, the selected components and styling elements load.
  3. Start customizing your theme.

Figure 4: Importing themes for customization

Themebuilder import existing theme

Adding the Themes to Your Project

When you complete the modifications and the theme is ready to be used:

  1. Download the theme as a compact archive by clicking the Download button.
  2. Add the newly created Theme folder to your application.
  3. Include the all.css file in the head tag of your HTML document.

Important

Avoid referencing the kendo.common.min.css and kendo.rtl.min.css files because the exported CSS file contains all styles you need.

See Also

Other articles on styling, appearance, and rendering of Kendo UI widgets:

Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy