# How to enable switcher in any page ?

##### Switcher

Note:- The switcher-1.html page are displayed in pages -> switcher in web

#### How to Enable Styles for switcher?

###### Please Follow the below steps

###### Step1:

Go To any HTML file in Script Section you change our ../assets/js/custom.js link to ../assets/js/custom1.js link link as shown in below image

To enable the switcher then you must have to place below html, css, js in your html page .

For switcher with icon you can refer empty.html page.

Below SWITCHER HTML code is also available in switcher-1.html page.

    <!--  Switcher js -->
    <script src="../assets/switcher/js/switcher.js"></script>

"Below links shows how the switcher page looks like & path of the Switcher page in the template."

https://ibb.co/6Zfp4R3 (Path:-pages/Switcher)

If you want switcher icon in html pages then replace below code in `app header` section

##### How to change any chart color according to your theme color?

By default, the chart color will change based on the theme color.

You can replace the default chart with your own chart, but in order to change the colors of your chart with respect to the theme colors you have to follow the below steps.

#### How to replace your own chart with existing chart and change colors of that particular chart in Dashboard Page ?

Note: This process is only for replace your own chart in index.html page

###### Step1:

Go to root path: assets/js/index1.js in that js file you will find a function named as index " function index() " inside of that function replace the old chart js data with your new chart js data, in order to change your chart color according to your themecolor then add " myVarVal" or "any default color " (Ex:- myVarVal || "#38cab3") value to that particular color field based on your requirement.

###### Step2:

Navigate to root path: assets/js/ and open themeColors.js in that js file you will find a function called "(function names() )" In that function you will find

`"if(document.querySelector('#transactions') !== null){ index(); }"`

Then change it's id name based on the id that you've used for your particular chart.

Ex: How do I modify the Id in the "themeColors.js" file?

Before : `" if(document.querySelector('#transactions') !== null){ index(); }"`
After :`" if(document.querySelector('# your chart id') !== null){ index(); }"`

#### How to add your new chart and change colors of that new chart according to your themecolor in Other Pages ?

Note : This process is only for adding your new chart to other pages.(Skip this process if this is not your requirement)

If you want to change the color of your chart with respect to the themecolor you have to follow the below steps.

###### Step 1:

If you want to add any chart to any other page then follow the below process.

Open js file of the particular chart that you wanted to add, in that js file (for example in my case: mychart.js), and inside of that js file create a new function with " unique " name (for example in my case: myFunction() ), and then place the chart js content inside of that function.

Note: If there is more than one chart then you need to create different functions for different charts respectively.

Ex-1:`myFunction1() { chart js1 content }`
Ex-2:`myFunction2() { chart js2 content }`

###### Step 2:

Navigate to root path: assets/js/themeColors.js in that js file you will find a function called "(function names() )" In that function you will find

`"if(document.querySelector('#transactions') !== null){ index(); }"`

Below this condition add a new condition with the "id name and function name" that you've used in your chart js (Ex: mychart.js)

Ex:`" if(document.querySelector('# your chart id') !== null){ myFunction(); =>created function for the above id }"`

###### Step 3:

If you want to change your chart (Ex: mychart.js) color according to your themecolor then follow the below process

Ex : Go to root path: assets/js/mychart.js in that js file you've already created a function (Ex: myFunction() ) inside of that function there are different color values based on the chart. so, if you want to change the color then add " myVarVal " or "any default color" value (Ex:- myVarVal || "#38cab3")to that particular color field based on your requirement.

NOTE : When page reloads, to active primary color for a color picker in switcher then follow below process:

Uncomment the below code in `themeColor.js` (../assets/js/themeColor.js)

// document.getElementById('colorID').value = localStorage.primaryColor;

// document.getElementById('darkPrimaryColorID').value = localStorage.darkPrimary;

// document.getElementById('transparentPrimaryColorID').value = localStorage.transparentPrimary;

// document.getElementById('transparentBgImgPrimaryColorID').value = localStorage.transparentBgImgPrimary;

// document.getElementById('transparentBgColorID').value = localStorage.transparentBgColor;

##### How to Delete Switcher ?

If you don't want Swicher please follow below procedure to remove Switcher styles.

Step-1: Remove `switcher-1.html` HTML page.

Step-2: Remove the below Switcher related HTML, CSS, JS & Switcher Icon in `empty.html` HTML page.

    	<!--  Switcher js -->
    	<script src="../assets/switcher/js/switcher.js"></script>

Step-3: Replace custom1.js as custom.js in `empty.html` HTML page as show below.

Before: <script src="../assets/js/custom1.js"></script>

After: <script src="../assets/js/custom.js"></script>

Step-4: Remove the Swicher Folder in assets.

Rootpath: (../assets/switcher)