MCPcopy Create free account
hub / github.com/Yantesoft/LinuxdoAssistant / injectFloatingPanelStyles

Function injectFloatingPanelStyles

linuxdo-helper.user.js:466–531  ·  view source on GitHub ↗

* 注入悬浮面板样式,支持亮色/暗色主题

()

Source from the content-addressed store, hash-verified

464 * 注入悬浮面板样式,支持亮色/暗色主题
465 */
466 function injectFloatingPanelStyles() {
467 if (document.getElementById('linuxdo-helper-panel-style')) {
468 return;
469 }
470
471 const style = document.createElement('style');
472 style.id = 'linuxdo-helper-panel-style';
473 style.textContent = `
474 #linuxdo-speed-slider {
475 --linuxdo-helper-bg: var(--secondary, #ffffff);
476 --linuxdo-helper-text: var(--primary, #333333);
477 --linuxdo-helper-muted: var(--primary-medium, #666666);
478 --linuxdo-helper-border: var(--primary-low, rgba(0, 0, 0, 0.12));
479 --linuxdo-helper-slider-bg: var(--primary-low, #dddddd);
480
481 background: var(--linuxdo-helper-bg);
482 color: var(--linuxdo-helper-text);
483 border: 1px solid var(--linuxdo-helper-border);
484 box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
485 color-scheme: light dark;
486 }
487
488 #linuxdo-speed-slider .linuxdo-helper-label,
489 #linuxdo-speed-slider .linuxdo-helper-mode-toggle {
490 color: var(--linuxdo-helper-text);
491 }
492
493 #linuxdo-speed-slider .linuxdo-helper-value {
494 color: var(--linuxdo-helper-muted);
495 }
496
497 #linuxdo-speed-slider input[type="range"] {
498 background: var(--linuxdo-helper-slider-bg);
499 }
500
501 #linuxdo-speed-slider .linuxdo-helper-speed-button {
502 width: 28px;
503 height: 28px;
504 border: 1px solid var(--linuxdo-helper-border);
505 border-radius: 6px;
506 background: transparent;
507 color: var(--linuxdo-helper-text);
508 font-size: 18px;
509 line-height: 1;
510 cursor: pointer;
511 }
512
513 #linuxdo-speed-slider .linuxdo-helper-speed-button:active {
514 transform: translateY(1px);
515 }
516
517 @media (prefers-color-scheme: dark) {
518 #linuxdo-speed-slider {
519 --linuxdo-helper-bg: var(--secondary, #1f2328);
520 --linuxdo-helper-text: var(--primary, #f0f0f0);
521 --linuxdo-helper-muted: var(--primary-medium, #b8b8b8);
522 --linuxdo-helper-border: var(--primary-low, rgba(255, 255, 255, 0.14));
523 --linuxdo-helper-slider-bg: var(--primary-low, #3a3f45);

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected