Is this possible to add new Color Theme in CM

Hi,

By default, we have 3 Themes are coming. is this possible to add new theme( let say Green) in CM? if yes, can you please explain the process to do this.

Regards

-Sandeep

Pedro Ribeiro Tinoco wrote:

Hello Noida Sandeep,

We have a way to do this, I’ll detail the steps to do it.

The current themes we have are following the following naming convention: cmf.style.*

So… first, let’s define a theme name: **cmf.style.green

**Now, in your config.json, add the new them
e to the Supported Themes array:

**
**Take into account that it is a needed to have a theme and the accessibility mode of the specific theme.

Then, make sure both themes are added to the styles array in your angular.json file, as shown below:

Then, create a filder inside your /HTML/src/assets directory called styles.

Add a **/themes **folder inside /assets.

Last but not least, create two folders - one for each theme: cmf.style.green and cmf.style.green.accessibility, as follows:

Then… you just need to define the color palette as the other items have it defined:

Here is a **pallete.less **example:

@useBlueLogo: false; //Main logo to use

//PAGE

@styleColor000: rgb(250, 250, 250); //Background

@styleColor001: rgb(161, 0, 0); //Primary

@styleColor002: rgb(225, 175, 175); //Secondary

@styleColor003: rgb(240, 200, 200); //Selected

@styleColor004: rgb(0, 0, 0); //Text

@styleColor005: rgb(255, 255, 255); //Widget background

@styleColor006: rgb(0, 0, 0); //Black

@styleColor007: rgb(255, 255, 255); //White

@styleColor008: rgb(255, 255, 255); //Text on primary background

@styleColor009: rgb(0, 0, 0); //Text on secondary background

@styleColor010: rgb(161, 0, 0); //Selected icons

@styleColor011: rgb(161, 0, 0); //Links on selected lines

@styleColor012: rgba(0, 0, 0, 0.2); //Border color (with fade applied)

//NAVIGATION BAR

@styleColor101: rgb(161, 0, 0); //Navigation menu

@styleColor102: rgb(255, 255, 255); //Navigation menu text

@styleColor103: rgb(245, 230, 230); //Navigation submenu

@styleColor104: rgb(0, 0, 0); //Navigation submenu text

@styleColor105: rgb(161, 0, 0); //Navigation submenu icon

//PAGE TAB BAR

@styleColor201: rgb(201, 0, 0); //Tab background

@styleColor202: rgb(255, 255, 255); //Tab primary

@styleColor203: rgb(255, 255, 255); //Tab text

@styleColor204: rgb(250, 250, 250); //Tab Selected

@styleColor205: rgb(0, 0, 0); //Tab Selected Text

@styleColor206: rgb(161, 0, 0); //Tab Selected primary

//TOOLBAR

@styleColor301: rgb(250, 250, 250); //Toolbar background

@styleColor302: rgb(161, 0, 0); //Toolbar primary

@styleColor303: rgb(0, 0, 0); //Toolbar text

// MENU

@styleColor401: rgb(255, 255, 255); //Menu background

@styleColor402: rgb(0, 0, 0); //Menu text

@styleColor403: rgb(161, 0, 0); //Menu text

@styleColor404: rgb(244, 204, 204); //Menu selected

// MODAL & DIALOG

@styleColor501: rgb(201, 0, 0); //Modal header background

@styleColor502: rgb(255, 255, 255); //Modal header text

@styleColor503: rgb(255, 255, 255); //Modal header primary

@styleColor504: rgb(245, 245, 245); //Modal footer

//NOTIFICATIONS

@styleColor601: rgb(255, 255, 255); //Toast background

@styleColor602: rgb(0, 0, 0); //Toast close

// DASHBOARDS

@styleColor701: rgb(161, 0, 0); // Primary Color

@styleColor702: rgb(184, 209, 224); // Primary Color

@styleColor703: rgb(170, 170, 170); // Primary Color

@styleColor704: rgb(65, 65, 65); // Primary Color

@styleColor705: rgb(225, 85, 50); // Secondary Color

@styleColor706: rgb(240, 60, 60); // Secondary Color

@styleColor707: rgb(216, 216, 216); // Secondary Color

//== IMAGES ==

//BACKGROUND PATTERNS

@diagonalLinesImage: url(“”);

And here is a cmf.style.green example:

/* Theme Styles */

@import “./palette.less”;

/* Core Styles */

@import “../../../../../node_modules/cmf-core/assets/style/_theme.less”;

@color-black: rgb(0, 0, 0);

@color-gray: rgb(140, 140, 140);

@color-light-gray: rgb(240, 240, 240);

@color-white: rgb(255, 255, 255);

@color-light-blue: rgb(20, 169, 250);

@color-dark-blue: rgb(14, 134, 199);

@color-yellow: rgb(221, 204, 119);

@color-dark-yellow: rgb(226, 172, 15);

@color-green: rgb(95, 152, 115);

@color-dark-green: rgb(28, 82, 28);

@color-red: rgb(210, 50, 35);

@color-dark-red: rgb(101, 21, 16);

@color-orange: rgb(216, 130, 191);

@color-purple: rgb(124, 48, 138);

@color-cmf-blue: rgb(0, 122, 201);

@color-light-green: rgb(132, 245, 132);

/* Dashboards */

@db-color-green: rgb(151, 198, 1);

@db-color-yellow: rgb(163, 139, 66);

@db-color-red: rgb(103, 12, 84);

/* Classes & var colors */

@color-disabled: fade(@color-white, 30%);

@color-success: @color-dark-green;

@color-warning: @color-dark-yellow;

@color-info: @color-dark-blue;

@color-error: @color-dark-red;

@color-outdated: @color-orange;

.cmf-color-success { color: @color-success; }

.cmf-color-warning { color: @color-warning; }

.cmf-color-info { color: @color-info; }

.cmf-color-error { color: @color-error; }

.background-color-yellow { background-color: @color-yellow; }

.background-color-red { background-color: @color-red; }

.background-color-green { background-color: @color-green; }

/* MES Styles */

@import “../../../../../node_modules/cmf-mes/assets/style/_theme.less”;

Now you just need to alter the colors and have fun with it :blush:
Hope this helps.

Best regards,
Pedro Tinoco



Hello Pedro, is this also feasible for corporate font packages?