Variables

variables.less

Petal uses global variables for key properties that affect the look of the common UI elements. All global variables are defined in the variables.less file. Change the value of the variables such as @primary-accent-color, and it will affect all classes where it refers to the variable.

However when editing, we recommended that you do not directly alter the values in the stock variables.less file, but instead use a different file to override the existing values. This is to prevent builds from failing in case new variables have been added or existing ones have been changed in newer versions. Because stock variables.less file is always pulled alongside other files, it will be kept up to date when you update Petal. In the similar sense, it's generally a good idea to not make direct edits to Petal's source code so that you don't have to manually keep track of any changes you made to the files before upgrading to future versions.

Use the included custom-variables.less file instead to insert any variables you want to override, or just create a new file in your project folder containing the override variables, and import the file when compiling.


List of variables (Default values)

// layout
@container-width: 980px;
@container-padding: 15px;
@col-method: flex; // flex or float (legacy)
@col-padding: 15px;

// typography
@base-font: "Lato";
@base-font-size: 16px;
@base-font-color: #333;
@base-line-height: 1.2;
@header-uppercase: true;
@header-letter-spacing: 2px;
@header-font-weight: 900;
@paragraph-line-height: 1.5;

// colors
@primary-accent-color: @blue;
@okay-color: @green;
@warning-color: @yellow;
@danger-color: @red;
@link-text-color: @red;

// buttons 
@btn-border-width: 2px;
@btn-border-radius: 0;
@btn-font-size: 0.9em;
@btn-font-weight: 900;
@btn-letter-spacing: 2px;
@btn-line-height: 1.2;
@btn-dropdown-menu-item-font-size: 0.9em;
@gray-disabled-btn: false;
@btn-disable-transition: false;
@btn-disable-shadows: false;
@btn-spinner-animation-duration: 0.4s;

// forms 
@input-border-width: 2px;
@input-border-radius: 0;
@input-font-size: 0.9em;
@input-textarea-font-size: 0.8em;
@input-label-font-size: 0.8em;
@input-label-font-weight: 900;
@input-label-letter-spacing: 2px;
@input-line-height: 1.2;
@input-caption-font-size: 0.8em;
@input-spinner-color: @primary-accent-color;
@input-spinner-animation-duration: 0.4s;
@input-html5-validation-styles: true;

// checkboxes & radioboxes
@checkbox-size: 20px;
@checkbox-border-width: @input-border-width; //2px
@checkbox-border-radius: 100%;
@radiobox-border-radius: 100%;
@checkbox-color: @primary-accent-color;
@checkbox-disable-transition: false;

// switch toggle
@chk-switch-size: 24px;
@chk-switch-border-width: @input-border-width; //2px
@chk-switch-border-radius: @checkbox-size;
@chk-switch-color: @primary-accent-color;
@chk-switch-disable-transition: false;
@chk-switch-disable-shadows: false;

// selectbox
@selectbox-border-width: @input-border-width; //2px
@selectbox-border-radius: @input-border-radius;
@selectbox-color: @primary-accent-color;
@selectbox-disable-shadows: false;
@include-selecter: true;

// dark
@include-dark: true;

// progress
@spinner-color: @primary-accent-color;

// panels
@panel-border-radius: 0;
@label-border-radius: 0;
@badge-border-radius: 10em;

// petalicons
@petalicon-file-path: '../assets';

Accepted values for the variables depend on the property it's inserted in; generally the variable name implies the CSS property name it's referring to, so it should be pretty straightforward.

Some that have the true or false values are used for switches of toggling some features on and off, like transitions or shadows. As with other variables, try testing out with different values and see how they actually affect the appearance.

Some color variables have their default values referring to another variable (@primary-accent-color) - this is to keep every color consistent by using a single brand color. You can set colors for different elements separately if you wish to.