Skip to main content

Customization

If you read about development tools you will find out that you can use Sass, so it is possible to customize the basic styles of FlatifyCSS.

Sass​

The first level of customization happens in the _config.scss file, in this file variables for colors, fonts, and other basic configs are defined, for example, by changing the $CSS_VAR_PFX variable all generated CSS variables will be prefixed with this value.

Take a look at the config file to see how it works. Variables in this file are categorized by their type, general, design, colors, motion, typography, and icons. So you can change their value and see how the changes affect the generated CSS and frontend.

You do not need to edit the package files for this. All variables use !default, so set your own values when you load FlatifyCSS in your Sass file:

style.scss
@use "flatifycss/scss/flatify" with (
$ACCENT_COLOR: #8e44ad,
$BORDER_RADIUS: 0.5em,
$PRIMARY_FONT_FAMILY: ("Inter", sans-serif)
);

Or the older way, which works too:

style.scss
$ACCENT_COLOR: #8e44ad;
$BORDER_RADIUS: 0.5em;

@import "flatifycss/scss/flatify";

For example here is the list of variables that are defined for z-index:

VariableDefault
$ZINDEX_DROPDOWN1000
$ZINDEX_STICKY1010
$ZINDEX_FIXED1020
$ZINDEX_FIREWORKS1025
$ZINDEX_BACKDROP1030
$ZINDEX_MODAL_BACKDROP1030
$ZINDEX_MODAL1040
$ZINDEX_POPOVER1060
$ZINDEX_TOAST1100

You can change their value based on the number of the z-index you use in your project.

General and design​

VariableDefaultWhat it does
$CSS_VAR_PFXflatify__Prefix of every generated CSS variable
$CENTERED_CONTAINERStrueCenters containers with auto margins
$RESPONSIVE_BREAKPOINTS(xs: 575.98px, sm: 576px, md: 768px, lg: 992px, xl: 1200px, xxl: 1400px)See the responsive page, change the values but keep the names
$BORDER_WIDTHmax(2px, 0.18em)Border width of components
$BORDER_RADIUS1emDefault roundness of components
$BORDER_RADIUS_LISTGenerates the roundness setters
$WIDTH_LIST, $HEIGHT_LISTGenerate the width and height setters
$OPACITY_LIST(0, 10, 20, ..., 100)Generates the opacity setters
$HOVER_BRIGHTNESS95%How much elements get darker on hover
$BACKDROP_OPACITY0.5Opacity of the backdrop layer
$LINK_DECORATIONnoneLink text-decoration
$LINK_DECORATION_HOVERunderline 0.125em currentColorLink text-decoration on hover
$LINK_DECORATION_FOCUSnoneLink text-decoration on focus

Colors​

VariableDefaultWhat it does
$BG_COLOR#ffffffPage background
$BG_COLOR_2, $BG_COLOR_3, $BG_COLOR_4#f1f4f7, #ced9e3, #809cb6Darker backgrounds and borders
$TXT_COLOR#2e4051Text color, its light, dark and inverted versions are made from it
$BLUE, $GREEN, $YELLOW, $ORANGE, $RED, $PINK, $PURPLEPalette colors, each one also has _LIGHT, _DARK and _DARKER versions
$ACCENT_COLOR, $SUCCESS_COLOR, $INFO_COLOR, $WARNING_COLOR, $DANGER_COLORblue, green, blue, orange, redState colors
$LIGHT_COLOR, $DARK_COLORbackground and text colorsUsed by .style-light and .style-dark
$HEADING_COLORcurrentColorHeadings color
$LINK_COLOR, $LINK_COLOR_HOVER, $LINK_COLOR_FOCUSaccent, accent light, accent darkLink colors
$TAP_HIGHLIGHT_COLORtransparent-webkit-tap-highlight-color on mobile

The $PALETTE map is built from these variables, do not edit it directly. All hex values are on the colors page.

Motion​

VariableDefaultWhat it does
$SUPPORT_SMOOTH_SCROLLtrueSmooth scrolling for users who do not prefer reduced motion
$SIMPLE_TRANSITION0.15s ease-in-outMost hover and focus transitions
$LONG_TRANSITION1s ease-in-outSlow transitions
$BOUNCING_TRANSITION0.35s cubic-bezier(0.59, -0.39, 0.36, 1.38)Transitions with a little bounce
$ACCORDION_SHOW_ANIMATION_DURATION / $ACCORDION_HIDE_ANIMATION_DURATION300ms / 200msAccordion animations
$ALERT_SHOW_ANIMATION_DURATION / $ALERT_HIDE_ANIMATION_DURATION200ms / 300msAlert animations
$DROPDOWN_SHOW_ANIMATION_DURATION / $DROPDOWN_HIDE_ANIMATION_DURATION300ms / 200msDropdown animations
$MODAL_SHOW_ANIMATION_DURATION / $MODAL_HIDE_ANIMATION_DURATION350ms / 250msModal animations
$SUBMENU_SHOW_ANIMATION_DURATION / $SUBMENU_SHOW_ANIMATION_DELAY350ms / 200msSubmenus in the navigation bar
$TAB_SHOW_ANIMATION_DURATION / $TAB_HIDE_ANIMATION_DURATION300ms / 200msTabs animations
$TOAST_SHOW_ANIMATION_DURATION / $TOAST_HIDE_ANIMATION_DURATION300ms / 200msToast animations

Typography and icons​

Typography variables are listed on the typography page.

Icons are SVG data URLs, you can replace any of them with your own: $ARROW_DOWN_ICON, $BLOCKQUOTE_ICON, $CLOSE_ICON, $EYE_ICON, $SEARCH_ICON and $SELECT_ICON. Each one is also a CSS variable, for example --flatify__close-icon.

CSS​

The next level after customization with Sass is CSS variables. These variables get their values from Sass variables, so if you just want to work with compiled CSS, it is the best choice to change them. The benefits of CSS variables are they can be customized modularly, which means you can have different components with different colors, fonts, etc, just by changing the value of the variables.

Default CSS variables are defined as :root, most of them are defined in the _root.scss file, the rest are defined inside each file which is a separate component, for example, table CSS variables are inside the _table.scss file.

The example of customization each component is provided in the component's documentation page. For example check the table component customization guide.

JavaScript​

There is a JSON file inside the /js folder called config.json, which provides you the most important configuration options for the JavaScript code, for example, you can disable logging errors in the console when something goes wrong. All options are listed on the JavaScript page.