mirror of
https://github.com/tiennm99/WPlace-AutoBOT.git
synced 2026-10-14 08:17:53 +00:00
wip better style switch
This commit is contained in:
1 parent
abb3c3fffe
commit
5906e4ceac
2 files changed
+247
-61
No files matched your search
+40
-11
@@ -177,19 +177,47 @@
|
||||
const getCurrentTheme = () => CONFIG.THEMES[CONFIG.currentTheme]
|
||||
|
||||
const switchTheme = (themeName) => {
|
||||
if (CONFIG.THEMES[themeName]) {
|
||||
CONFIG.currentTheme = themeName
|
||||
saveThemePreference()
|
||||
if (CONFIG.THEMES[themeName]) {
|
||||
CONFIG.currentTheme = themeName
|
||||
saveThemePreference()
|
||||
|
||||
// Remove existing theme styles
|
||||
const existingStyle = document.querySelector('style[data-wplace-theme="true"]')
|
||||
if (existingStyle) {
|
||||
existingStyle.remove()
|
||||
}
|
||||
// APPLY THEME VARS/CLASS (new)
|
||||
applyTheme()
|
||||
|
||||
// Recreate UI with new theme (cleanup is handled in createUI)
|
||||
createUI()
|
||||
}
|
||||
// Recreate UI (kept for now)
|
||||
createUI()
|
||||
}
|
||||
}
|
||||
|
||||
// Add this helper (place it after getCurrentTheme/switchTheme definitions)
|
||||
function applyTheme() {
|
||||
const theme = getCurrentTheme();
|
||||
// Toggle theme class on documentElement so CSS vars cascade to our UI
|
||||
document.documentElement.classList.remove('wplace-theme--classic', 'wplace-theme--neon');
|
||||
document.documentElement.classList.add(
|
||||
CONFIG.currentTheme === 'Neon Retro' ? 'wplace-theme--neon' : 'wplace-theme--classic'
|
||||
);
|
||||
|
||||
// Also set CSS variables explicitly in case you want runtime overrides
|
||||
const root = document.documentElement;
|
||||
const setVar = (k, v) => { try { root.style.setProperty(k, v); } catch {} };
|
||||
|
||||
setVar('--wplace-primary', theme.primary);
|
||||
setVar('--wplace-secondary', theme.secondary);
|
||||
setVar('--wplace-accent', theme.accent);
|
||||
setVar('--wplace-text', theme.text);
|
||||
setVar('--wplace-highlight', theme.highlight);
|
||||
setVar('--wplace-success', theme.success);
|
||||
setVar('--wplace-error', theme.error);
|
||||
setVar('--wplace-warning', theme.warning);
|
||||
|
||||
// Typography + look
|
||||
setVar('--wplace-font', theme.fontFamily || "'Segoe UI', Roboto, sans-serif");
|
||||
setVar('--wplace-radius', (('' + (theme.borderRadius || '12px'))));
|
||||
setVar('--wplace-border-style', (('' + (theme.borderStyle || 'solid'))));
|
||||
setVar('--wplace-border-width', (('' + (theme.borderWidth || '1px'))));
|
||||
setVar('--wplace-backdrop', (('' + (theme.backdropFilter || 'blur(10px)'))));
|
||||
setVar('--wplace-border-color', 'rgba(255,255,255,0.1)');
|
||||
}
|
||||
|
||||
const saveThemePreference = () => {
|
||||
@@ -3223,6 +3251,7 @@
|
||||
loadLanguagePreference()
|
||||
|
||||
const theme = getCurrentTheme()
|
||||
applyTheme() // <- new: set CSS vars and theme class before building UI
|
||||
|
||||
const fontAwesome = document.createElement("link")
|
||||
fontAwesome.rel = "stylesheet"
|
||||
|
||||
+207
-50
@@ -3,18 +3,90 @@
|
||||
fix layout (positions, widths, z-index), and ensure class names match JS
|
||||
(e.g., .wplace-dragging) so buttons and panels behave correctly. */
|
||||
|
||||
/* ========================= */
|
||||
/* Theme tokens (CSS vars) */
|
||||
/* ========================= */
|
||||
|
||||
/* Default = Classic Autobot */
|
||||
:root {
|
||||
--wplace-primary: #000000;
|
||||
--wplace-secondary: #111111;
|
||||
--wplace-accent: #222222;
|
||||
--wplace-text: #ffffff;
|
||||
--wplace-highlight: #775ce3;
|
||||
--wplace-success: #00ff00;
|
||||
--wplace-error: #ff0000;
|
||||
--wplace-warning: #ffaa00;
|
||||
|
||||
--wplace-radius: 12px;
|
||||
--wplace-border-style: solid;
|
||||
--wplace-border-width: 1px;
|
||||
--wplace-border-color: rgba(255, 255, 255, 0.1);
|
||||
--wplace-shadow: 0 8px 32px rgba(0, 0, 0, 0.6),
|
||||
0 0 0 1px rgba(255, 255, 255, 0.1);
|
||||
--wplace-backdrop: blur(10px);
|
||||
--wplace-font: 'Segoe UI', Roboto, sans-serif;
|
||||
|
||||
--wplace-z-overlay: 10000;
|
||||
--wplace-z-alert: 10001;
|
||||
--wplace-z-settings: 100001;
|
||||
|
||||
/* feature toggles */
|
||||
--wplace-scanline: 0;
|
||||
--wplace-pixel-blink: 0;
|
||||
}
|
||||
|
||||
/* Optional theme class hooks (you can switch these on body or html) */
|
||||
.wplace-theme--classic {
|
||||
--wplace-primary: #000000;
|
||||
--wplace-secondary: #111111;
|
||||
--wplace-accent: #222222;
|
||||
--wplace-text: #ffffff;
|
||||
--wplace-highlight: #775ce3;
|
||||
--wplace-success: #00ff00;
|
||||
--wplace-error: #ff0000;
|
||||
--wplace-warning: #ffaa00;
|
||||
|
||||
--wplace-radius: 12px;
|
||||
--wplace-shadow: 0 8px 32px rgba(0, 0, 0, 0.6),
|
||||
0 0 0 1px rgba(255, 255, 255, 0.1);
|
||||
--wplace-backdrop: blur(10px);
|
||||
--wplace-font: 'Segoe UI', Roboto, sans-serif;
|
||||
|
||||
--wplace-scanline: 0;
|
||||
--wplace-pixel-blink: 0;
|
||||
}
|
||||
|
||||
.wplace-theme--neon {
|
||||
--wplace-primary: #1a1a2e;
|
||||
--wplace-secondary: #16213e;
|
||||
--wplace-accent: #0f3460;
|
||||
--wplace-text: #00ff41;
|
||||
--wplace-highlight: #ff6b35;
|
||||
--wplace-success: #39ff14;
|
||||
--wplace-error: #ff073a;
|
||||
--wplace-warning: #ffff00;
|
||||
|
||||
--wplace-radius: 0;
|
||||
--wplace-shadow: 0 0 20px rgba(0, 255, 65, 0.3),
|
||||
inset 0 0 20px rgba(0, 255, 65, 0.1);
|
||||
--wplace-backdrop: none;
|
||||
--wplace-font: 'Press Start 2P', monospace;
|
||||
|
||||
--wplace-scanline: 1;
|
||||
--wplace-pixel-blink: 1;
|
||||
}
|
||||
|
||||
/* ========================= */
|
||||
/* Core animations (shared) */
|
||||
/* ========================= */
|
||||
@keyframes neonGlow {
|
||||
0%,
|
||||
100% {
|
||||
text-shadow: 0 0 5px currentColor, 0 0 10px currentColor,
|
||||
0 0 15px currentColor;
|
||||
text-shadow: 0 0 5px currentColor, 0 0 10px currentColor, 0 0 15px currentColor;
|
||||
}
|
||||
50% {
|
||||
text-shadow: 0 0 2px currentColor, 0 0 5px currentColor,
|
||||
0 0 8px currentColor;
|
||||
text-shadow: 0 0 2px currentColor, 0 0 5px currentColor, 0 0 8px currentColor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,12 +172,20 @@
|
||||
transition: all 0.3s ease;
|
||||
user-select: none;
|
||||
display: none; /* JS will set display: block inline when ready */
|
||||
|
||||
/* Theme hooks */
|
||||
background: var(--wplace-primary);
|
||||
color: var(--wplace-text);
|
||||
border-radius: var(--wplace-radius);
|
||||
box-shadow: var(--wplace-shadow);
|
||||
font-family: var(--wplace-font);
|
||||
backdrop-filter: var(--wplace-backdrop);
|
||||
border: var(--wplace-border-width) var(--wplace-border-style) var(--wplace-border-color);
|
||||
}
|
||||
|
||||
#wplace-image-bot-container.wplace-dragging {
|
||||
transition: none;
|
||||
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8),
|
||||
0 0 0 2px rgba(255, 255, 255, 0.2);
|
||||
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8), 0 0 0 2px rgba(255, 255, 255, 0.2);
|
||||
transform: scale(1.02);
|
||||
z-index: 9999;
|
||||
}
|
||||
@@ -134,6 +214,15 @@
|
||||
transition: all 0.3s ease;
|
||||
user-select: none;
|
||||
display: none;
|
||||
|
||||
/* Theme hooks */
|
||||
background: var(--wplace-primary);
|
||||
color: var(--wplace-text);
|
||||
border-radius: var(--wplace-radius);
|
||||
box-shadow: var(--wplace-shadow);
|
||||
font-family: var(--wplace-font);
|
||||
backdrop-filter: var(--wplace-backdrop);
|
||||
border: var(--wplace-border-width) var(--wplace-border-style) var(--wplace-border-color);
|
||||
}
|
||||
|
||||
#wplace-stats-container.wplace-dragging {
|
||||
@@ -143,8 +232,7 @@
|
||||
/* Back-compat for legacy class (some earlier CSS used this) */
|
||||
.wplace-drag-active {
|
||||
transition: none !important;
|
||||
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8),
|
||||
0 0 0 2px rgba(255, 255, 255, 0.2) !important;
|
||||
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8), 0 0 0 2px rgba(255, 255, 255, 0.2) !important;
|
||||
transform: scale(1.02) !important;
|
||||
z-index: 9999 !important;
|
||||
}
|
||||
@@ -162,6 +250,11 @@
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
padding: 8px 12px;
|
||||
|
||||
/* Theme hooks */
|
||||
background: var(--wplace-secondary);
|
||||
color: var(--wplace-highlight);
|
||||
border-bottom: var(--wplace-border-width) var(--wplace-border-style) var(--wplace-border-color);
|
||||
}
|
||||
|
||||
.wplace-header-title {
|
||||
@@ -188,10 +281,15 @@
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
font-size: 10px;
|
||||
/* Theme tweak */
|
||||
background: var(--wplace-accent);
|
||||
color: var(--wplace-text);
|
||||
}
|
||||
|
||||
.wplace-header-btn:hover {
|
||||
transform: scale(1.1);
|
||||
background: var(--wplace-text);
|
||||
color: var(--wplace-primary);
|
||||
}
|
||||
|
||||
.wplace-content {
|
||||
@@ -211,6 +309,7 @@
|
||||
padding: 8px;
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
border-radius: var(--wplace-radius);
|
||||
}
|
||||
|
||||
.wplace-section {
|
||||
@@ -218,6 +317,7 @@
|
||||
padding: 12px;
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
border-radius: var(--wplace-radius);
|
||||
}
|
||||
|
||||
.wplace-section-title {
|
||||
@@ -229,6 +329,7 @@
|
||||
gap: 6px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
color: var(--wplace-highlight);
|
||||
}
|
||||
|
||||
/* ========================= */
|
||||
@@ -259,8 +360,11 @@
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
padding: 8px 12px;
|
||||
border-radius: 8px;
|
||||
border-radius: var(--wplace-radius);
|
||||
border: none;
|
||||
background: var(--wplace-accent);
|
||||
color: var(--wplace-text);
|
||||
font-family: var(--wplace-font);
|
||||
}
|
||||
|
||||
.wplace-btn::before {
|
||||
@@ -270,12 +374,7 @@
|
||||
left: -100%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(
|
||||
90deg,
|
||||
transparent,
|
||||
rgba(255, 255, 255, 0.2),
|
||||
transparent
|
||||
);
|
||||
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
|
||||
transition: left 0.5s;
|
||||
}
|
||||
|
||||
@@ -307,11 +406,42 @@
|
||||
box-shadow: 0 0 15px #8e2de2;
|
||||
}
|
||||
|
||||
/* button variants via theme */
|
||||
.wplace-btn-start {
|
||||
background: var(--wplace-success);
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.wplace-btn-stop {
|
||||
background: var(--wplace-error);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.wplace-btn-select {
|
||||
background: var(--wplace-highlight);
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.wplace-btn-upload {
|
||||
background: var(--wplace-secondary);
|
||||
border: 1px dashed var(--wplace-highlight);
|
||||
color: var(--wplace-text);
|
||||
}
|
||||
|
||||
.wplace-btn-file {
|
||||
background: var(--wplace-warning);
|
||||
color: #000;
|
||||
}
|
||||
|
||||
/* ========================= */
|
||||
/* Stats and progress */
|
||||
/* ========================= */
|
||||
.wplace-stats {
|
||||
margin-bottom: 8px;
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
border-radius: var(--wplace-radius);
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.wplace-stat-item {
|
||||
@@ -336,6 +466,7 @@
|
||||
|
||||
.wplace-stat-value {
|
||||
font-weight: 600;
|
||||
color: var(--wplace-highlight);
|
||||
}
|
||||
|
||||
.wplace-colors-section {
|
||||
@@ -369,9 +500,9 @@
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
background: var(--wplace-secondary);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
border-radius: 8px;
|
||||
border-radius: var(--wplace-radius);
|
||||
margin: 8px 0;
|
||||
height: 6px;
|
||||
}
|
||||
@@ -380,21 +511,14 @@
|
||||
position: relative;
|
||||
height: 6px;
|
||||
transition: width 0.5s ease;
|
||||
background: linear-gradient(135deg, var(--wplace-highlight) 0%, #9370db 100%);
|
||||
}
|
||||
|
||||
.wplace-progress-bar::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: linear-gradient(
|
||||
90deg,
|
||||
transparent,
|
||||
rgba(255, 255, 255, 0.3),
|
||||
transparent
|
||||
);
|
||||
inset: 0;
|
||||
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
|
||||
animation: shimmer 2s infinite;
|
||||
}
|
||||
|
||||
@@ -407,26 +531,34 @@
|
||||
overflow: hidden;
|
||||
padding: 6px;
|
||||
border: 1px solid;
|
||||
border-radius: 8px;
|
||||
border-radius: var(--wplace-radius);
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.status-default {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-color: var(--wplace-border-color);
|
||||
color: var(--wplace-text);
|
||||
}
|
||||
|
||||
.status-success {
|
||||
background: rgba(0, 255, 0, 0.1);
|
||||
border-color: var(--wplace-success);
|
||||
color: var(--wplace-success);
|
||||
box-shadow: 0 0 15px currentColor;
|
||||
}
|
||||
|
||||
.status-error {
|
||||
background: rgba(255, 0, 0, 0.1);
|
||||
border-color: var(--wplace-error);
|
||||
color: var(--wplace-error);
|
||||
box-shadow: 0 0 15px currentColor;
|
||||
}
|
||||
|
||||
.status-warning {
|
||||
background: rgba(255, 165, 0, 0.1);
|
||||
border-color: var(--wplace-warning);
|
||||
color: var(--wplace-warning);
|
||||
box-shadow: 0 0 15px currentColor;
|
||||
}
|
||||
|
||||
@@ -439,11 +571,18 @@
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 10000;
|
||||
z-index: var(--wplace-z-overlay);
|
||||
width: 90%;
|
||||
max-width: 700px;
|
||||
max-height: 90%;
|
||||
overflow: auto;
|
||||
|
||||
/* Theme */
|
||||
background: var(--wplace-primary);
|
||||
border: var(--wplace-border-width) var(--wplace-border-style) var(--wplace-text);
|
||||
border-radius: var(--wplace-radius);
|
||||
box-shadow: var(--wplace-shadow);
|
||||
font-family: var(--wplace-font);
|
||||
}
|
||||
|
||||
.resize-preview-wrapper {
|
||||
@@ -454,6 +593,7 @@
|
||||
margin: 15px 0;
|
||||
height: 300px;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--wplace-accent);
|
||||
}
|
||||
|
||||
.resize-canvas-stack {
|
||||
@@ -495,14 +635,12 @@
|
||||
|
||||
.wplace-btn.active,
|
||||
.wplace-btn[aria-pressed='true'] {
|
||||
box-shadow: 0 0 8px rgba(0, 0, 0, 0.25) inset,
|
||||
0 0 6px rgba(0, 0, 0, 0.2) !important;
|
||||
box-shadow: 0 0 8px rgba(0, 0, 0, 0.25) inset, 0 0 6px rgba(0, 0, 0, 0.2) !important;
|
||||
}
|
||||
|
||||
.mask-mode-group .wplace-btn.active,
|
||||
.mask-mode-group .wplace-btn[aria-pressed='true'] {
|
||||
box-shadow: 0 0 8px rgba(0, 0, 0, 0.25) inset,
|
||||
0 0 6px rgba(0, 0, 0, 0.2);
|
||||
box-shadow: 0 0 8px rgba(0, 0, 0, 0.25) inset, 0 0 6px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.resize-controls {
|
||||
@@ -669,9 +807,18 @@
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 10001;
|
||||
z-index: var(--wplace-z-alert);
|
||||
min-width: 400px;
|
||||
max-width: 500px;
|
||||
|
||||
/* Theme */
|
||||
background: var(--wplace-primary);
|
||||
color: var(--wplace-text);
|
||||
font-family: var(--wplace-font);
|
||||
border-radius: var(--wplace-radius);
|
||||
box-shadow: var(--wplace-shadow);
|
||||
backdrop-filter: var(--wplace-backdrop);
|
||||
border: var(--wplace-border-width) var(--wplace-border-style) var(--wplace-border-color);
|
||||
}
|
||||
|
||||
.wplace-settings {
|
||||
@@ -685,18 +832,6 @@
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.wplace-setting-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.wplace-setting-title i {
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
/* ========================= */
|
||||
/* Form controls */
|
||||
/* ========================= */
|
||||
@@ -851,10 +986,10 @@
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
padding: 12px 20px;
|
||||
border-radius: 8px;
|
||||
border-radius: var(--wplace-radius);
|
||||
color: white;
|
||||
font-weight: 600;
|
||||
z-index: 10001;
|
||||
z-index: var(--wplace-z-alert);
|
||||
max-width: 400px;
|
||||
text-align: center;
|
||||
animation: slideDown 0.3s ease-out;
|
||||
@@ -967,15 +1102,19 @@
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 100001;
|
||||
display: none;
|
||||
font-family: 'Segoe UI', Roboto, sans-serif;
|
||||
font-family: var(--wplace-font);
|
||||
min-width: 400px;
|
||||
max-width: 500px;
|
||||
max-height: 80vh;
|
||||
overflow-y: auto;
|
||||
animation: slideIn 0.3s ease-out;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
border-radius: 16px;
|
||||
border-radius: var(--wplace-radius);
|
||||
padding: 0;
|
||||
background: var(--wplace-primary);
|
||||
color: var(--wplace-text);
|
||||
box-shadow: var(--wplace-shadow);
|
||||
backdrop-filter: var(--wplace-backdrop);
|
||||
}
|
||||
|
||||
.wplace-settings-container-base.show {
|
||||
@@ -996,3 +1135,21 @@
|
||||
.wplace-stats-container.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Theme flourishes for Neon (scanline/pixel blink) */
|
||||
.wplace-theme--neon #wplace-image-bot-container::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 2px;
|
||||
background: linear-gradient(90deg, transparent, var(--wplace-text), transparent);
|
||||
z-index: 1;
|
||||
pointer-events: none;
|
||||
animation: scanline 3s linear infinite;
|
||||
}
|
||||
|
||||
.wplace-theme--neon .wplace-btn:hover:not(:disabled) {
|
||||
animation: pixelBlink 0.5s infinite;
|
||||
}
|
||||
Reference in new issue
Block a user