- Issue created by @2dareis2do
- π¬π§United Kingdom 2dareis2do
Ok I have created a small module that allows you to add and preview styles from your custom theme. This can be used with bootstrap_barrio and bootstrap (barrio) sass based themes. More info https://www.drupal.org/project/style_guide β
- π¬π§United Kingdom 2dareis2do
One issue I have noticed with bootswatch implementation is that there is an option to select the bootswatch library from the Load library select list at /admin/appearance/settings/my_barrio_sass_subtheme
However, when using bootstrap_sass sub theme, the option for library should be set to none. (another issue when using bootstrap_sass subtheme is that the library is required with composer despite it never actually being used when using bootstrap_sass).
- If I choose to load a bootswatch implementation, the bootstrap files are being loaded twice e.g. bootstrap.min.js from the cdn and the complied version required by bootstrap_sass sub-theme.
- Despite loading a bootswatch theme from cdn, I cannot compile it which means that many features are not available, such as control over how light and dark mode are implemented.
- π¬π§United Kingdom 2dareis2do
After loading via scss I notice that variables -dark appears to be missing.
Raised issue with bootswatch
- π¬π§United Kingdom 2dareis2do
Actually maybe variable-dark is not really an issue. One thing I notice is that we have dependency on barrio theme
e.g. in gulp we have // '../../contrib/bootstrap_barrio/scss' set as an include path.
This is then imported in subtheme e.g. in import.scss we have:
@import "barrio";
Personally I would prefer if these files are copied over to the subtheme when it is created. This gives me the option to switch off any and where necessary update them in the sub theme.
- π¬π§United Kingdom 2dareis2do
One other small thing, because we have added './node_modules/bootstrap/scss' as an include path in gulp, rather than including them using the full path:
''@import "../node_modules/bootstrap/scss/variables";
they can also be included simply by adding
@import "variables";
etcor
@import "bootstrap";
Not sure what happens if there are two variables files? Hopefully it compiles them both i the right order. Personally i am including local variables first and the bootstrap that includes it's own !default variables
- π¬π§United Kingdom 2dareis2do
Ok just checked and benefit of adding bootswatch folder to list of include files and there is a problem. I think we need to specify the order of files here so I have got it working as expected by making sure we load the bootswatch variables first.
This order works for me:
@import "typography"; @import "../node_modules/bootswatch/dist/flatly/variables"; @import "variables"; @import "bootstrap"; // includes variables and theme-colours @import "../node_modules/bootswatch/dist/flatly/bootswatch"; @import "custom-shades"; @import "barrio";
barrio and components are copied across to sub theme and references to the following variables are removed:
// :root, // [data-bs-theme=light] { // --bb-primary-dark: #0c63e3; // --bb-primary-text: #212529; // --bb-secondary-dark: #5a6168; // --bb-h1-color: #212529; // --bb-h2-color: #212529; // --bb-h3-color: #212529; // } // [data-bs-theme=dark] { // color-scheme: dark; // --bb-primary-text: #dee2e6; // --bb-h1-color: #dee2e6; // --bb-h2-color: #dee2e6; // --bb-h3-color: #dee2e6; // }
also removed all references to colours in variables e.g.
// $primary-shade: rgb(255, 78, 46); // $primary-light: tint-color($primary-shade, 37%); // $primary-dark: shade-color($primary-shade, 12%); // $accent-shade: rgb(0, 121, 192); // $accent-light: tint-color($accent-shade, 37%); // $accent-dark: shade-color($accent-shade, 12%);
Finally, also remove reference to all these variables in components. We want to use bootstrap colour system where possible.
Please see screenshots with flatly theme loaded, working with both light and dark modes
- π¬π§United Kingdom 2dareis2do
IF I want to load cosmo, I can simply change the following 2 lines (variables, bootswatch):
@import "../node_modules/bootswatch/dist/cosmo/variables"; @import "variables"; @import "bootstrap"; // includes variables and theme-colours @import "../node_modules/bootswatch/dist/cosmo/bootswatch";
- π¬π§United Kingdom 2dareis2do
Screenshots from sketchy light and dark modes
- π¬π§United Kingdom 2dareis2do
Updated screen shots after disabling the following fonts from typography.scss
// $font-family-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; // $font-family-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; // $font-size-root: null;
- π¬π§United Kingdom 2dareis2do
Light and dark mode front end with unmodified fonts