MDriven Turnkey theming
Line 70: Line 70:
* --base-bg-color
* --base-bg-color
* --base-border-radius
* --base-border-radius
*
* --navbar-height
* --navbar-height
* --navbar-bg-color
* --navbar-bg-color
* --navbar-brand-color
* --navbar-brand-color
* --navbar-link-color
* --navbar-link-color
*
* --sidebar-item-bg-color
* --sidebar-item-bg-color
*
* --primary-color
* --primary-color
* --primary-color-dark
* --primary-color-dark
* --text-on-primary
* --text-on-primary
*
* --danger-color
* --danger-color
* --danger-color-dark
* --danger-color-dark
* --text-on-danger
* --text-on-danger
*
* --warning-color
* --warning-color
* --warning-color-dark
* --warning-color-dark
* --text-on-warning
* --text-on-warning
*
* --success-color
* --success-color
* --success-color-dark
* --success-color-dark
* --text-on-success
* --text-on-success
*
* --save-action-bg-color
* --save-action-bg-color
* --save-action-bg-color-dark
* --save-action-bg-color-dark
* --save-action-text-color
* --save-action-text-color
*
* --cancel-action-bg-color
* --cancel-action-bg-color
* --cancel-action-bg-color-dark
* --cancel-action-bg-color-dark
* --cancel-action-text-color
* --cancel-action-text-color
*
* --redo-action-bg-color
* --redo-action-bg-color
* --redo-action-bg-color-dark
* --redo-action-bg-color-dark
* --redo-action-text-color
* --redo-action-text-color
*
* --undo-action-bg-color
* --undo-action-bg-color
* --undo-action-bg-color-dark
* --undo-action-bg-color-dark

Revision as of 13:08, 3 June 2020

MDriven Turnkey's theming process allows you to create your own theme for the Turnkey application. You can change your brand primary color, font-sizes, contextual colors, navbar colors, etc. 

MDriven Turnkey application uses SCSS to greatly simplify the source code for styling an application since it introduces variables and other logic that is missing from standard CSS. This was the reason for us shifting to SCSS format on the source code for styling a Turnkey web app based on Material Design guidelines.

SCSS (Sass) is a text format that compiles into CSS.

How does this differ from "tkusercss"?

As we have described before you may add your own styles to "Content/tkusercss.css" - this article describes how you create the theme in a consistent SCSS supported way that builds the very fabric of every aspect of the Turnkey app.

Where to start?

Use the prototype run - LocalTurnkeyPrototyper option to get your application running locally. You can choose any free port.

LocalTurnkeyPrototyper.jpg
Started Local Turnkey Prototyper.jpg

By doing this you have access the original SCSS files that control all the styling of the Turnkey web app. They are located in "application-root/Content/scss".

SCSS in Turnkey Local Core.png

You can use the Visual Studio Code editor to get context-sensitive help in updating the SCSS files to your liking.

2019-06-16 10h16 53.png

You can install the liveSassCompile plugin that can track your changes and turn the updated theme source code (SCSS) into CSS that the webserver actually uses.

2019-06-16 10h33 40.png

By refreshing your local prototyping app you'll get instant feedback on what the theme style change looks like.

VS Code and Turnkey Core.jpg

When you save a changed SCSS as it is being watched by the sass compiler, it will compile into a new CSS theme file "theme-user.css". This new CSS is found here "application-root/Content/scss/theme-user.css".

Compiled theme file.png

The Turnkey application will recognise that there now is a "application-root/Content/scss/theme-user.css" and will use that instead of the default "application-root/Content/theme-default.css" .

When you refresh your page you will see that your modified theme is applied:

x

There are many possible changes that you may want to experiment with:

  • Primary color;
  • Contextual colours (danger, warning, success and info);
  • Navigation bar color;
  • Button's colours;
  • Action's color;
  • Font-size;
  • Sizes of buttons and input components.

You may want to copy the updated SCSS repository and keep it safe - it will be overwritten with default styles the next time you get the latest version of turnkey core. The edited SCSS is your source code for your styles - even if the css is enough it will be easier for you making changes in the SCSS files. There is no way to go back from a css you have to the original SCSS that created it.

2019-06-16 10h51 36.png

Deploying the new resulting css to the server

Now that we have managed to change the local site we want to apply the same changes to a server side site in azure. This is done by simply copying the resulting "Content/scss/theme-user.css" to your AssetsTK folder for the model - add the same folder levels so that you get "xxxx_AssetsTK/Content/scss/theme-user.css" or "xxxx_AssetsTK/Content/theme-user.css".

Upload your model to the server.

Check file upload.jpg

How do I get the standard back?

To get the standard back you only need to delete the "application-root/Content/scss/theme-user.css" or "application-root/Content/theme-user.css" from the server. To delete files uploaded with AssetsTK refer to here.

Do you want the web page to reload automatically while changing styles?

Read here on how to make your turnkey reload automatically on script change or style change.

CSS Custom properties

In the Turnkey application you're able to change the styles of your application without compiling of the source SASS code. We added the support of the CSS Custom Properties to let you change the appearance of your application in the fastest and easiest way.

Use tkusercss file to tweak the styling of your Turnkey app with a power of CSS custom properties (also known as CSS variables).

  • Create "tkusercss.css" file according to this article in your model directory and place it in the "Content" folder.
  • Add your color values and other setting into the "tkusercss" file.
  • Upload your model with MDriven Designer and get all the changes online in your application instantly.

Structure of "tkusercss.css"

When you created tkusercss.css open it with your's preferred text or code editor and add the following declaration.

:root { }

The :root selector in CSS matches the document's root element and it's a place where we will put our own values for custom properties (CSS variables).

The syntax of the CSS custom properties declaration:

--name-of-custom-property: value;

List of the changeable properties in the Turnkey application

  • --base-font-size
  • --base-bg-color
  • --base-border-radius
  • --navbar-height
  • --navbar-bg-color
  • --navbar-brand-color
  • --navbar-link-color
  • --sidebar-item-bg-color
  • --primary-color
  • --primary-color-dark
  • --text-on-primary
  • --danger-color
  • --danger-color-dark
  • --text-on-danger
  • --warning-color
  • --warning-color-dark
  • --text-on-warning
  • --success-color
  • --success-color-dark
  • --text-on-success
  • --save-action-bg-color
  • --save-action-bg-color-dark
  • --save-action-text-color
  • --cancel-action-bg-color
  • --cancel-action-bg-color-dark
  • --cancel-action-text-color
  • --redo-action-bg-color
  • --redo-action-bg-color-dark
  • --redo-action-text-color
  • --undo-action-bg-color
  • --undo-action-bg-color-dark
  • --undo-action-text-color

Turnkey themes

We made for you couple of precompiled themes for your MDriven Turnkey application. To apply the following themes download zip archive below and extract it. You will receive "theme-user.css" file which you should put into "Content" folder in the AssetsTK, then upload your model with MDriven Designer.

MDriven dark theme

Mdriven dark theme.png
Mdriven-dark-theme-preview-2.png

Download: File:MDriven Dark theme.zip

Vivid blue theme

Vivid blue theme preview.png
Vivid blue theme preview 2.png

Download:File:Vivid blue theme.zip

Lime green theme

Lime green theme preview.png
Lime green theme preview 2.png

Download:File:Lime green theme.zip

Dark blue theme

Dark blue theme preview
Dark blue theme preview 2

Download:File:Dark blue theme.zip

Dark red theme

Dark red- heme preview 1.png
Dark-red-theme-preview-2.png

Download: File:Dark red theme.zip

Compact theme

The compact theme for MDriven Turnkey will make your components smaller and allow you to fit more information on the app's pages.

Download: File:Compact theme.zip

This page was edited 2 days ago on 03/26/2024. What links here