In 2shine, styling is made flexible and customizable, allowing developers to tailor the framework to fit specific design needs. There are two primary approaches for styling: using CSS variables for straightforward customization and leveraging Sass for more advanced, precompiled adjustments.
The first method, using CSS variables, is ideal for quick, dynamic changes that can be applied directly in the browser. This allows you to adjust key design elements like colors, typography, and component styles without needing to recompile your stylesheets. It's a fast and efficient way to modify Bootstrap's default appearance, whether you're working on individual elements or creating a consistent theme.
For more complex, project-specific customizations, Sass offers a deeper level of flexibility. It allows for the use of functions, mixins, and nesting, enabling advanced modifications before your CSS is compiled. This method is particularly useful when you need to tweak grid systems, spacing, or component behaviors that go beyond the capabilities of CSS variables.
This documentation will guide you through both approaches, helping you understand when to use each based on your customization needs. Whether you're looking for quick tweaks or comprehensive design overhauls, 2shine makes it easy to achieve the perfect look and feel.
Over time, CSS variables have become significantly more powerful, allowing for greater flexibility and dynamic styling directly in the browser. Unlike Sass variables, which require recompilation, CSS variables can be modified at runtime without any build process. This makes it ideal for adapting design aspects like colors, fonts, border radii, and shadows in real-time, as demonstrated in the "Get Started" section.
Bootstrap provides a set of predefined CSS variables for easy customization and theming. Since they are standard CSS, they don't require recompilation like Sass variables, making it quick and flexible to apply changes directly in the browser.
Use Bootstrap CSS variables when:
The themes can be found within the theme/ folder.
theme/
theme.css
This includes the main colors as well as fonts and Bootstrap components that support CSS variables.
This file leverages CSS variables to define theme-specific customizations that can be applied in the project's root or specific components. It includes Bootstrap's root variables and additional custom variables for theme consistency.
Sass variables are more advanced than CSS variables, offering the ability to use nesting, functions, mixins, and complex operations. In Bootstrap, Sass variables allow for deeper customization of the framework, particularly before the CSS is compiled. This is useful for adjusting grid systems, spacing, and component-specific styles. However, changes made with Sass variables require recompilation to take effect.
If a variable is not available in theme.css and cannot be customized with CSS variables, you can override Sass variables directly in the _custom-variables.scss file.
_custom-variables.scss
Use Sass variables when:
TIP: Create your logic in Sass/Scss, but keep defined variables inside theme.css. This approach lets you use Sass without having to recompile when chaning the css variable.
2shine is built to give you many different customization possibilities. You will need to prepare for your customization by installing Node.js and the dependencies required to convert your changes to CSS and JS.
npm ci
npm install
npm run build-prod
You should now be able to make changes to your own 2shine Theme.
For further customization, or things that don't support CSS variables, you can find various stylesheets in the src/scss folder.
src/scss
_custom-pages.scss
/components/*
/layouts/*
/modules/*
You can find the default SCSS variables in the 2shine skin folder. From there, navigate to src/scss/_variables.scss.
src/scss/_variables.scss
There are variables with the prefix tosic, which means they are predefined variables set to your preferences. Most of the variables are self-explanatory, but we will still briefly go over the important ones.
tosic
$primary
$secondary
$theme-colors
.bg-yourcolor
To learn more about the variables, check the comments in the _custom-variables.scss file or refer to the Sass Bootstrap5 documentation.
If you want to change a variable, first try to change it in theme.css. If the variable isn't defined there and there is no Bootstrap variable that can be accessed, make use of the _custom-variables.scss file. There you can directly override existing Sass variables or create your own.
This file is used to overwrite Bootstrap variables with your own custom values. These variables are available globally and can be used to customize Bootstrap's default styles.
To learn more about the variables, check the comments in the _custom-variables.scss or refer to the Sass Bootstrap5 documentation.
This file is used to add custom colors and spacing by merging them into Bootstrap's default maps. It allows for optimized and extended spacing and other customizations.
Get started by removing the comments from the lines of code you want to adjust and start customizing.
To learn more about the variables, check the comments in the _custom-maps.scss or refer to the Sass Bootstrap5 documentation.
_custom-maps.scss
This file is used to add page specific customizations, so for instance the home page might use different spacing then others.
The utils folder contains utility styles that are meant to enhance and optimize the typography, and media-specific customizations. These utilities provide support for common styling tasks that don't necessarily belong to a specific component or layout but are essential for consistent, cross-site behavior.
utils
Files in this folder:
The layouts folder contains styling configurations for all the page layouts. Each layout file defines specific styling rules that apply to the specific layout. These layouts are adaptable to various themes or page designs and can be customized as needed.
layouts
The components folder contains styling configurations for various individual UI elements and functional components. These files focus on specific sections of the website, offering customization options for common features like the navigation, footer, breadcrumbs, and more. Each file within this folder provides targeted adjustments to elements across the layout.
components
The modules folder contains the DNNCentric Contact Form styles.
modules
2shine is not designed for multiple themes by default; however, you can implement theme support yourself using Bootstrap's theming features.
👉https://getbootstrap.com/docs/5.3/customize/color-modes/
Inside theme.css you will see that the data-bs-theme is set to the default-theme:
When inspecting the dom, you will find the theme take effect aswell: