All articles

How to create a custom passbolt theme with the UI Kit

7 min. read

Benjamin

Benjamin

18 August, 2022

With the recent availability of the UI kit, it is now easier than ever to customize your passbolt. We will demonstrate it in this step by step tutorial by explaining how you can create your own custom passbolt theme.

Step 1: Install and launch the StoryBook UI kit

Prerequisites

UI Kit installation

sudo npm install -g grunt-cli
git clone https://github.com/passbolt/passbolt_styleguide.git
cd passbolt_styleguide
cp src/less/abstractions/colors_custom.sample.less src/less/abstractions/colors_custom.less
npm run dev:storybook:install
npm run dev:build:custom-theme
npm run dev:storybook:start
npm run dev:watch:custom-theme

UI Kit structure and usage

Fig. Colors on Storybook (source: Storybook)
Fig. Password workspace on Storybook (source: Storybook)

Two brand new “Solarized” themes

Fig. Password workspace with the Solarized light theme on Storybook (source: Storybook)
Fig. Password workspace with the Solarized dark theme on Storybook (source: Storybook)

Step 2: Create your custom theme

Use the “custom” playground theme as a base

Fig. Custom theme selection in Storybook (source: Storybook)

Palette explanations

/* palette */
@main-color: hsl(44,87%,98%);
@text-icon-main-color: hsl(194,81%,14%);
@workspace-bar: hsl(194,81%,14%);
@workspace-text: hsl(194,81%,40%);
@primary-color-1: hsl(194,100%,25%);
@primary-color-2: hsl(194,100%,20%);
@primary-color-3: hsl(194,100%,15%);
@primary-color-4: hsl(194,100%,10%);
@success-1: hsl(68,100%,30%);
@success-2: hsl(45,100%,35%);
@warning-1: hsl(18,80%,54%);
@warning-2: hsl(18,80%,64%);
@warning-3: hsl(18,80%,74%);
@warning-4: hsl(18,80%,44%);
@alert-1: hsl(1,71%,52%);
@alert-2: hsl(1,71%,62%);
@alert-3: hsl(1,71%,72%);

Specific variables

/* logos */
@logourl: url(‘@{images}/logo/logo_white.svg’);
@passbolt-icon-without-badge: url(‘@{images}/logo/icon-without-badge.svg’);
@passbolt-icon-badge-1: url(‘@{images}/logo/icon-badge-1.svg’);
@passbolt-icon-badge-2: url(‘@{images}/logo/icon-badge-2.svg’);
@passbolt-icon-badge-3: url(‘@{images}/logo/icon-badge-3.svg’);
@passbolt-icon-badge-4: url(‘@{images}/logo/icon-badge-4.svg’);
@passbolt-icon-badge-5: url(‘@{images}/logo/icon-badge-5.svg’);
@passbolt-icon-badge-5-plus: url(‘@{images}/logo/icon-badge-5+.svg’);
@passbolt-icon-inactive: url(‘@{images}/logo/icon-inactive.svg’);
/* box shadows */
@shadow-opacity-hover-black: 0.5;
@shadow-opacity-hover-white: 0.25;
@shadow-opacity-active-white: 0.25;
@shadow-opacity-active-black: 0.5;
@shadow-opacity-dropdown: 0.5;
@shadow-opacity-select: 0.5;
@shadow-opacity-info-panel: 0.75;
/* controls */
@controls-check:url(‘@{images}/controls/check_black.svg’);
@controls-check:url(‘@{images}/controls/check_white.svg’);

Custom theme example: Black Midgar

  • Hexadecimal colors
  • Hexadecimal colors with transparency
  • RGB colors
  • RGBA colors
  • HSL colors
  • HSLA colors

Let’s do it

Fig. Custom palette variables for the Black Midgar theme, in our IDE (source: Visual Studio Code)
Fig. Password workspace with the custom theme “Black Midgar” on Storybook (source: Storybook)

Disclaimer

Naming your theme

Create the theme files

@import “../../abstractions/colors_black-midgar.less”;

Reference the new theme

theme_custom: {
    expand: true,
    flatten: true,
    cwd: “src/less/themes/black_midgar”,
    src: “*.less”,
    dest: “src/css/themes/black_midgar”,
    ext: “.css”
},
items: [
    { value: ‘default’, title: ‘Default’},
    { value: ‘midgar’, title: ‘Midgar’},
    { value: ‘black_midgar’, title: ‘Black Midgar’}
],

Publishing your new theme

Share your thoughts

Continue reading

2022: A Year In Review

7 min. read

2022: A Year In Review

Read about passbolt’s top moments from 2022, including releases, events, awards, and more. See our recap and what’s planned for 2023.

Shelby Lee Neubeck

Shelby Lee Neubeck

5 January, 2023

Meet Passbolt UI Kit

3 min. read

Meet Passbolt UI Kit

Our design system is now available as a Storybook project. It includes an extendable style guide and reusable React components which can be used as playground by designers and developers.

Vivien Muller

Vivien Muller

22 July, 2022

Flag of European UnionMade in Europe. Privacy by default.