Files
SillyTavern/public/css/backgrounds.css
T
LandCohee eec837cee6 Layout Update (#4514)
* init

* mostly working messy version

* css layout, mobile is fixed

* revert changes

* more of the above

* cleanup

* revert breaking fixes, cleanup dead code

* dead code

* delete fallback

* spacing

* css tweaks and removed getChatBackgroundsList

* mobile sizing

* revert unrelated changes

* use name instead of context

* debounce from constants.js

* replace if/else

* pass images directly

* more of the above

* buttons

* buttons functionality

* add default column counts

* remove .mobile-only-menu-toggle when clicked (layering fix)

* lint

* universal column default of 3

* sacrifice firefox for chrome

* Restore media query

This reverts commit 295a5a8190.

* Add disabled attribute styles for menu_button

* use opacity 0, pointer events none instead of display:none

* Format styles

* Fix type errors

* Add blur event handler to close mobile menu when focus is lost

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-09-16 13:20:06 +03:00

254 lines
5.3 KiB
CSS

/* Main Page Backgrounds */
#bg1,
#bg_custom {
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
position: absolute;
width: 100%;
height: 100%;
transition: background-image var(--animation-duration-3x) ease-in-out;
}
/* Fitting options */
#background_fitting {
max-width: 6em;
}
/* Fill/Cover - scales to fill width while maintaining aspect ratio */
#bg1.cover,
#bg_custom.cover {
background-size: cover;
background-position: center;
}
/* Fit/Contain - shows entire image maintaining aspect ratio */
#bg1.contain,
#bg_custom.contain {
background-size: contain;
background-position: center;
background-repeat: no-repeat;
}
/* Stretch - stretches to fill entire space */
#bg1.stretch,
#bg_custom.stretch {
background-size: 100% 100%;
}
/* Center - centers without scaling */
#bg1.center,
#bg_custom.center {
background-size: auto;
background-position: center;
background-repeat: no-repeat;
}
body.reduced-motion #bg1,
body.reduced-motion #bg_custom {
transition: none;
}
#bg1 {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=');
z-index: -3;
}
#bg_custom {
background-image: none;
z-index: -2;
}
.bg_example.flex-container.locked:not(:focus-visible) {
outline-color: var(--golden);
}
/* This is the main flex container for the entire drawer */
#Backgrounds.drawer-content.openDrawer.bg-drawer-layout {
display: flex;
flex-direction: column;
height: auto;
height: calc-size(auto, size);
overflow: hidden;
width: var(--sheldWidth);
max-width: var(--sheldWidth);
padding: 0;
}
#bg-header-fixed {
flex-shrink: 0;
padding: 5px;
background-color: var(--SmartThemeBlurTintColor);
border-bottom: 1px solid var(--SmartThemeBorderColor);
}
#bg-header-fixed>.flex-container {
display: flex;
align-items: center;
gap: 5px;
}
/* Control buttons in header */
.heading-container-with-controls {
position: relative;
}
.heading-container-with-controls .heading-text {
margin: 10px 0;
}
.heading-container-with-controls .heading-controls {
position: absolute;
right: 5px;
top: 50%;
transform: translateY(-50%);
display: flex;
gap: 5px;
}
#bg-scrollable-content {
flex-grow: 1;
overflow-y: auto;
overflow-x: hidden;
padding: 0 5px 15px;
}
#bg_menu_content,
#bg_custom_content {
display: grid;
gap: 5px;
width: 100%;
grid-template-columns: repeat(var(--bg-thumb-columns, 5), 1fr);
}
#bg-filter {
font-size: calc(var(--mainFontSize) * 0.95);
}
/* Thumbnails */
.bg_example:hover .BGSampleTitle {
opacity: 1;
}
.bg_example .mobile-only-menu-toggle {
display: none;
}
.bg_example {
cursor: pointer;
box-shadow: 0 0 7px var(--black50a);
position: relative;
overflow: hidden;
border-radius: 8px;
border: 0px solid transparent;
outline: 2px solid var(--SmartThemeBorderColor);
outline-offset: -1px;
height: auto;
aspect-ratio: 16 / 9;
}
.bg_example:focus-visible {
outline-offset: inherit;
}
.bg_example .jg-menu {
display: flex;
position: absolute;
top: 2px;
right: 2px;
background-color: rgba(0, 0, 0, 0.5);
border-radius: 5px;
padding: 3px 3px;
z-index: 3;
backdrop-filter: blur(4px);
border: 1px solid var(--SmartThemeBorderColor);
justify-items: center;
align-items: center;
opacity: 0;
visibility: hidden;
transform: scale(0.9);
transform-origin: center;
transition: opacity var(--animation-duration) ease-out, visibility var(--animation-duration) ease-out, transform var(--animation-duration) ease-out;
}
.bg_example:hover .jg-menu,
.bg_example:focus-within .jg-menu {
opacity: 1;
visibility: visible;
transform: scale(1);
}
.bg_example .jg-button {
display: flex;
width: 24px;
height: 24px;
align-items: center;
justify-content: center;
color: white;
padding: 5px;
font-size: 1.1em;
border-radius: 5px;
transition: background-color var(--animation-duration) ease;
}
.bg_example .jg-button:hover {
background-color: rgba(255, 255, 255, 0.2);
}
.bg_example .jg-unlock {
display: none;
}
.bg_example.locked .jg-lock {
display: none;
}
.bg_example.locked .jg-unlock {
display: flex;
}
.thumbnail-clipper {
position: absolute;
top: -2px;
left: -2px;
right: -2px;
bottom: -2px;
overflow: hidden;
border-radius: inherit;
background-size: cover;
background-position: center;
}
.bg_example:not([custom="true"]) .jg-copy,
.bg_example[custom="true"] .jg-edit {
display: none;
}
/* Thumbnail Title */
.bg_example .BGSampleTitle {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
color: var(--SmartThemeBodyColor);
font-size: 0.9em;
font-weight: 600;
padding: 0px 6px 2px;
text-align: center;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
opacity: 0;
transition: opacity var(--animation-duration) ease-in-out;
pointer-events: none;
border-radius: 0 0 8px 8px;
}
.bg_example:hover .BGSampleTitle,
.bg_example:focus-within .BGSampleTitle {
opacity: 1;
}