💄 Renueva los estilos de Basic y Bootsier

- Bootsier: paleta propia a partir del logotipo, campos rellenos con
  sombra al enfocar, fieldsets y mensajes con sombra en vez de borde,
  desplegables sin borde, migas con fondo y paginador adaptable.
- Bootsier: quita la rejilla de Bootstrap (la maquetación es de Flex y
  Grid) y el container-fluid interior de la barra de navegación.
- Basic: margen inferior en campos y bloques, padding lateral en el
  envoltorio de la página y paginador que se reparte en varias líneas.
- Nuevo ejemplo theme-showcase con todos los componentes en los dos
  temas.
This commit is contained in:
Manuel Cillero 2026-11-16 14:22:18 +01:00
parent 8761c50fbb
commit d83f8b0f7f
14 changed files with 930 additions and 79 deletions

View file

@ -19,6 +19,46 @@
font-display: swap;
}
// Background of the form fields ($input-bg in _bootsier-variables.scss), of disabled fields
// ($input-disabled-bg), of unchecked checks ($form-check-input-bg), of fieldsets, of dropdown menus
// ($dropdown-bg) and of breadcrumbs ($breadcrumb-bg), color of the group titles of dropdown menus
// ($dropdown-header-color, a lighter gray than their items in light mode, nearly white in dark
// mode), color of the legends of fieldsets (darker than Bootstrap's secondary color in light mode,
// since their thin weight makes them lighter), and shadow of focused fields
// ($input-focus-box-shadow), for each color mode. On a dark background the primary color barely
// shows, so the dark mode uses a lighter tint of it with more opacity.
:root,
[data-bs-theme="light"] {
--bootsier-input-bg: #f1f3f4;
--bootsier-input-disabled-bg: #f7f8f9;
--bootsier-check-bg: #e2e5e8;
--bootsier-fieldset-bg: #fefefe;
--bootsier-dropdown-bg: #fdfdfd;
--bootsier-breadcrumb-bg: #f8f9fa;
--bootsier-dropdown-header-color: rgba(var(--bs-body-color-rgb), .65);
--bootsier-legend-color: rgba(var(--bs-body-color-rgb), .9);
--bootsier-focus-shadow: 0 0 2px #{rgba($primary, .15)}, 0 0 6px #{rgba($primary, .35)};
}
@include color-mode(dark, true) {
--bootsier-input-bg: #{$gray-800};
--bootsier-input-disabled-bg: #31363b;
--bootsier-check-bg: #{$gray-700};
--bootsier-fieldset-bg: #292e33;
--bootsier-dropdown-bg: #3e444a;
--bootsier-breadcrumb-bg: #292e33;
--bootsier-dropdown-header-color: rgba(var(--bs-emphasis-color-rgb), .85);
--bootsier-legend-color: var(--bs-secondary-color);
--bootsier-focus-shadow:
0 0 2px #{rgba(tint-color($primary, 60%), .4)}, 0 0 6px #{rgba(tint-color($primary, 60%), .7)};
}
// Disabled form fields also fade as disabled buttons do.
.form-control:disabled,
.form-select:disabled {
opacity: $btn-disabled-opacity;
}
// Font-relative top offset to keep the skip-link hidden at any font size.
.skip-link {
top: -3em;
@ -48,12 +88,20 @@
margin: 1rem 0;
}
// Fieldset with border and floating legend.
// Space below each block (Block), from Bootstrap's spacing unit, so consecutive blocks (and what
// follows them) do not sit right together. Twice $spacer, as the 2rem of the Basic theme.
.block {
margin-bottom: $spacer * 2;
}
// Fieldset outlined only by a soft shadow (Bootstrap's reboot already removes the border), with a
// floating legend.
fieldset {
position: relative;
background-color: var(--bs-body-bg);
border: var(--bs-border-width) solid var(--bs-border-color);
background-color: var(--bootsier-fieldset-bg);
border-radius: var(--bs-border-radius);
// Offset down with a negative spread: strongest below, softer at the sides, faintest on top.
box-shadow: 0 1px 3px rgba(0, 0, 0, .10), 0 4px 8px -2px rgba(0, 0, 0, .22);
padding: 2rem 1rem 1rem;
margin: 2rem 0 1rem;
}
@ -63,13 +111,14 @@ fieldset > legend {
top: 0;
left: 1rem;
transform: translateY(-50%);
color: var(--bs-secondary-color);
color: var(--bootsier-legend-color);
background-color: var(--bs-body-bg);
border: var(--bs-border-width) solid var(--bs-border-color);
// Soft outline with the gray of the form fields, in both color modes.
border: var(--bs-border-width) solid var(--bootsier-input-bg);
border-radius: var(--bs-border-radius);
padding: 0.125rem 0.75rem;
font-size: ($font-size-sm + $font-size-base) / 2;
font-weight: var(--bs-font-weight-normal);
font-weight: $font-weight-light;
line-height: 1.25;
width: fit-content;
max-width: 75%;
@ -82,6 +131,11 @@ fieldset > legend {
margin-bottom: 1rem;
}
// Labels start a little inside, clear of the rounded corner of their field.
.form-label {
padding-left: .25rem;
}
// Gap between group label and first inline check.
.form-label + .form-check-inline {
margin-left: 1rem;
@ -99,11 +153,68 @@ fieldset > legend {
text-align: center;
}
// Images with this class show their colors inverted in dark mode, such as a dark logo that would
// otherwise blend into the background. Only for images that keep their look when inverted: a full
// color one would change its hues.
[data-bs-theme="dark"] .image-invert-dark {
filter: invert(1);
}
// Dropdown menus have no border (_bootsier-variables.scss), so a soft shadow sets them apart from
// the content they cover, as fieldsets are outlined. Bootstrap only adds its own with
// $enable-shadows.
.dropdown-menu {
box-shadow: 0 1px 3px rgba(0, 0, 0, .10), 0 4px 8px -2px rgba(0, 0, 0, .22);
}
// Group titles of dropdown menus in a lighter weight than their items.
.dropdown-header {
font-weight: $font-weight-light;
}
// Navbars have no inner container, so they line up with the rest of the page. Fixed bars span the
// whole viewport, so they take back the side padding of a container off its edges.
.navbar.fixed-top,
.navbar.fixed-bottom {
padding-right: $container-padding-x * .5;
padding-left: $container-padding-x * .5;
}
// The first link of the first menu and the last link of the last menu drop their outer padding, so
// their text lines up with the rest of the page (next to the brand, its own margin keeps them
// apart). Collapsed bars stack their links with no side padding already.
.navbar-nav:first-child > .nav-item:first-child > .nav-link {
padding-left: 0;
}
.navbar-nav:last-child > .nav-item:last-child > .nav-link {
padding-right: 0;
}
// Disabled links of navbars, lighter in dark mode: Bootstrap's 30% of the text color barely shows
// on the dark background (links take 65%).
[data-bs-theme="dark"] .navbar {
--bs-navbar-disabled-color: rgba(var(--bs-emphasis-color-rgb), .45);
}
// Messages component. Classes are fixed by pagetop core (`.message`, `.message-info`,
// `.message-warning`, `.message-error`); reusing Bootstrap's own `.alert`/`.alert-*` styles keeps
// the palette in sync with the active Bootstrap theme instead of duplicating it here.
.message {
@extend .alert;
// Outlined by a shadow tinted with the text color of each variant instead of a border. A single
// offset shadow is always stronger below than at the sides, so three are combined (left, right
// and below) to reach the same width on those three sides, leaving the top faint.
--bootsier-message-shadow: color-mix(in srgb, var(--bs-alert-color) 35%, transparent);
border: 0;
box-shadow:
0 1px 2px color-mix(in srgb, var(--bs-alert-color) 15%, transparent),
-4px 0 6px -4px var(--bootsier-message-shadow),
4px 0 6px -4px var(--bootsier-message-shadow),
0 3px 6px -3px var(--bootsier-message-shadow);
}
// No shadow in dark mode, where it barely shows: the background of each variant is enough.
[data-bs-theme="dark"] .message {
box-shadow: none;
}
.message-info {
@extend .alert-info;
@ -133,6 +244,14 @@ fieldset > legend {
opacity: 1;
}
// Message of a table without rows, as in the Basic theme: centered, in italics and muted (inside
// .table, to win over the color Bootstrap gives to every cell).
.table .table-empty {
text-align: center;
font-style: italic;
color: var(--bs-secondary-color);
}
// List filters (ListFilter): fields and button on one row, wrapping when there is no room.
.list-filter {
display: flex;
@ -150,8 +269,9 @@ fieldset > legend {
// colors and opacity change, never sizes: the dot always takes its room, hidden, so nothing moves
// when it shows up. A vivid orange, set apart from the primary color of the button, darkened just
// enough to keep a 3:1 contrast against the background. Every changed field gets the dot by its
// label, once per field (on the title of a group); text fields and dropdowns also show a gray
// background. Floating labels are left out: Bootstrap draws their background with `::after`.
// label, once per field (on the title of a group); text fields, dropdowns and checks also show
// their border in that color. Floating labels are left out: Bootstrap draws their background with
// `::after`.
.list-filter {
--list-filter-mark: #{mix(#000, $orange, 15%)};
}
@ -173,12 +293,11 @@ fieldset > legend {
.form-control,
.form-select,
.form-check-input {
background-color: var(--bs-secondary-bg);
border-color: var(--list-filter-mark);
}
.form-check-input:checked {
background-color: var(--list-filter-mark);
border-color: var(--list-filter-mark);
}
}
@ -244,6 +363,24 @@ fieldset > legend {
margin-inline-end: 0;
}
// Joined cells, as in Bootstrap, but wrapping onto more lines when they don't fit: a long pager
// never gets wider than the screen (mobile browsers would zoom out the whole page). Each line
// overlaps the border of the one above, as cells do side by side. On small screens they also get
// smaller, so that more of them fit on a line.
.pagination {
flex-wrap: wrap;
}
.pagination .page-link {
margin-bottom: calc(var(--bs-pagination-border-width) * -1);
}
@include media-breakpoint-down(sm) {
.pagination {
--bs-pagination-padding-x: .5rem;
--bs-pagination-padding-y: .25rem;
--bs-pagination-font-size: #{$font-size-base * .875};
}
}
// By default, .page-link-icon shows the text of pager_previous_label/pager_next_label
// ("Previous"/"Next"). The full accessible text lives separately, in the link's aria-label, so
// replacing the visible text here with a symbol does not affect accessibility. To use "‹"/"›"

View file

@ -1,8 +1,4 @@
// Bootstrap utility extensions. Imported just before utilities/api so variable changes take effect.
// CSS Grid (Bootstrap 5): disable legacy grid classes and enable native CSS Grid.
$enable-grid-classes: false;
$enable-cssgrid: true;
// Bootstrap utility extensions. Imported just before utilities/api so the changes take effect.
// Extend the $utilities map with additional classes.
$utilities: map-merge(

View file

@ -10,7 +10,74 @@ $font-family-sans-serif: "Source Sans 3", system-ui, -apple-system, "Segoe UI",
"Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji",
"Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
// Theme colors from the PageTop logo and the Intro component: warm neutrals and state colors of the
// same palette, with a petrol blue as the primary color. The text Bootstrap picks for their
// buttons (white or black) keeps a contrast of at least 4.5:1 with all of them.
$primary: #0e6973; // Petrol blue, a cool counterpoint to the warm palette.
$secondary: #6e604a; // Warm gray of the logo, darkened.
$success: #4d7c0f; // Lime of the logo, as olive green.
$danger: #b91c1c; // Red of the Intro button.
$warning: #ffb84b; // Amber of the logo.
$info: #4cb5c4; // Teal of the screens in the Intro illustration.
$light: #fff1db; // Cream of the Intro blocks.
$dark: #1a202c; // Text color of Intro.
// Filled form fields: text fields, dropdowns and checks take a gray background, one for each color
// mode (--bootsier-input-bg, declared in _bootsier-custom.scss), and the same color as their
// border, which only shows when it changes color (validation). Checked checks already take the
// same color for both.
$input-bg: var(--bootsier-input-bg);
$input-border-color: $input-bg;
// Unchecked checks, radios and switches take a somewhat darker gray (--bootsier-check-bg), since
// they are small and would barely stand out with the background of text fields.
$form-check-input-bg: var(--bootsier-check-bg);
$form-check-input-border: var(--bs-border-width) solid $form-check-input-bg;
// Disabled fields take a lighter background (--bootsier-input-disabled-bg), with the border in the
// same color, and also fade (see _bootsier-custom.scss).
$input-disabled-bg: var(--bootsier-input-disabled-bg);
$input-disabled-border-color: $input-disabled-bg;
// Focused text fields and dropdowns keep their border hidden and stand out with a shadow in the
// primary color, equally wide on all four sides, one for each color mode (--bootsier-focus-shadow,
// declared in _bootsier-custom.scss). Checks keep Bootstrap's focus ring, with no border.
$input-focus-border-color: $input-bg;
$input-focus-box-shadow: var(--bootsier-focus-shadow);
$form-select-focus-box-shadow: $input-focus-box-shadow;
$form-check-input-focus-border: $form-check-input-bg;
// Bootstrap draws the knob of focused switches with $input-focus-border-color inside an SVG, where
// CSS variables do not work: keep its default color.
$form-switch-focus-color: tint-color($primary, 50%);
// Labels closer to their field (Bootstrap's default is .5rem), and two pixels smaller than the
// body text (16px with the 18px of $font-size-base; Bootstrap's default inherits it).
$form-label-margin-bottom: .125rem;
$form-label-font-size: $font-size-base - .125rem;
// Lighter help text than Bootstrap's (.75 opacity), still above a 4.5:1 contrast in both color
// modes (4.9:1 on white), and slightly smaller (Bootstrap's default is .875em).
$form-text-color: rgba(var(--bs-body-color-rgb), .65);
$form-text-font-size: .8125em;
// Table cells centered vertically, as in the Basic theme: with Bootstrap's default (top), a cell
// holding a button is taller and the text of the other cells sticks to the top of the row. Header
// cells keep Bootstrap's bottom alignment.
$table-cell-vertical-align: middle;
// Dropdown menus: a gray background between those of fieldsets and text fields, one for each color
// mode (--bootsier-dropdown-bg, declared in _bootsier-custom.scss), with no outer border nor
// rounded corners; dividers keep the border color. The hovered item takes the gray of text fields,
// since Bootstrap's (--bs-tertiary-bg) would match the menu background.
$dropdown-bg: var(--bootsier-dropdown-bg);
$dropdown-border-width: 0;
$dropdown-border-radius: 0;
$dropdown-inner-border-radius: 0;
$dropdown-link-hover-bg: var(--bootsier-input-bg);
// Group titles of dropdown menus, lighter in light mode (--bootsier-dropdown-header-color).
$dropdown-header-color: var(--bootsier-dropdown-header-color);
// Breadcrumbs: a light gray background, one for each color mode (--bootsier-breadcrumb-bg, declared
// in _bootsier-custom.scss), padding that keeps the text off its edges, and 16px text (1rem),
// smaller than the 18px of $font-size-base.
$breadcrumb-bg: var(--bootsier-breadcrumb-bg);
$breadcrumb-padding-y: .5rem;
$breadcrumb-padding-x: .75rem;
$breadcrumb-font-size: 1rem;

View file

@ -17,12 +17,12 @@
@import "bootstrap-5.3.8/scss/utilities";
// Bootstrap Layout & components
// No "grid": page layout comes from PageTop's own Flex and Grid components.
@import "bootstrap-5.3.8/scss/root";
@import "bootstrap-5.3.8/scss/reboot";
@import "bootstrap-5.3.8/scss/type";
@import "bootstrap-5.3.8/scss/images";
@import "bootstrap-5.3.8/scss/containers";
@import "bootstrap-5.3.8/scss/grid";
@import "bootstrap-5.3.8/scss/tables";
@import "bootstrap-5.3.8/scss/forms";
@import "bootstrap-5.3.8/scss/buttons";