/* ============================================================ Memos 边栏样式 全部基于 Obsidian CSS 变量,明暗主题分别微调,不写死颜色 ============================================================ */ /* ---------------- 主题令牌 ---------------- */ .memos-sidebar, .memos-settings, .modal.memos-modal-wide, .memos-edit-modal, .memos-compose-modal, .memos-confirm-modal, .memos-image-modal { --memos-radius: var(--radius-m, 8px); --memos-radius-s: var(--radius-s, 4px); --memos-border: var(--background-modifier-border); --memos-border-strong: var(--background-modifier-border-hover, var(--background-modifier-border)); --memos-field-bg: var(--background-primary); --memos-well-bg: var(--background-primary); /* 卡片与输入面板都用主背景色:比侧栏底色亮/白一档,靠 1px 描边 + 极轻阴影分层 */ --memos-card-bg: var(--background-primary); --memos-card-bg-hover: var(--background-primary-alt, var(--background-primary)); --memos-accent: var(--interactive-accent); --memos-accent-hover: var(--interactive-accent-hover, var(--interactive-accent)); --memos-on-accent: var(--text-on-accent, #fff); --memos-ring: var(--background-modifier-border-focus, var(--background-modifier-hover)); --memos-line: var(--background-modifier-border); --memos-card-shadow: none; --memos-pop-shadow: 0 10px 32px rgba(0, 0, 0, 0.22); /* 引用 chip:对应网页端 text-gray-600 / border / zinc 系列 */ --memos-ref-fg: #4b5563; --memos-ref-border: var(--background-modifier-border); --memos-ref-bg: transparent; --memos-ref-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.06); } /* 浅色:白卡片浮在浅灰侧栏上,描边更细、阴影更薄,避免灰成一片 */ .theme-light .memos-sidebar, .theme-light .modal.memos-modal-wide, .theme-light .memos-edit-modal, .theme-light .memos-compose-modal, .theme-light .memos-confirm-modal { --memos-card-shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 1px rgba(16, 24, 40, 0.03); --memos-line: rgba(16, 24, 40, 0.08); --memos-border: rgba(16, 24, 40, 0.11); --memos-border-strong: rgba(16, 24, 40, 0.2); --memos-pop-shadow: 0 12px 32px rgba(16, 24, 40, 0.16); } /* 深色:不靠阴影,靠 1px 亮边分层;卡片比侧栏亮一档 */ .theme-dark .memos-sidebar, .theme-dark .modal.memos-modal-wide, .theme-dark .memos-edit-modal, .theme-dark .memos-compose-modal, .theme-dark .memos-confirm-modal { --memos-card-shadow: none; --memos-line: rgba(255, 255, 255, 0.08); --memos-border: rgba(255, 255, 255, 0.1); --memos-border-strong: rgba(255, 255, 255, 0.2); --memos-pop-shadow: 0 12px 34px rgba(0, 0, 0, 0.55); /* dark:text-gray-400 dark:border-zinc-700 dark:bg-zinc-900 */ --memos-ref-fg: #a1a1aa; --memos-ref-border: rgba(255, 255, 255, 0.12); --memos-ref-bg: rgba(255, 255, 255, 0.03); --memos-ref-shadow: none; } /* ---------------- 基础 ---------------- */ .memos-sidebar { display: flex; flex-direction: column; height: 100%; padding: 0; gap: 8px; overflow: hidden; font-size: 14px; color: var(--text-normal); } .memos-sidebar button, .memos-sidebar select, .memos-sidebar input, .memos-sidebar textarea { font-family: inherit; } .memos-sidebar button:focus-visible, .memos-sidebar select:focus-visible, .memos-sidebar input:focus-visible, .memos-sidebar textarea:focus-visible { outline: 2px solid var(--memos-accent); outline-offset: 1px; } /* 文件选择框(pickImageFiles 动态创建,必须隐藏) */ .memos-file-input, .memos-sidebar input[type="file"] { display: none !important; } /* ---------------- 顶部 ---------------- */ .memos-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 0; } .memos-header-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; } .memos-title-text { font-size: 15px; font-weight: 600; color: var(--text-normal); letter-spacing: 0.2px; } .memos-count { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; } /* 还没拿到全站总数时先显示「已加载条数」,弱化一点表示是临时值 */ .memos-count.is-partial { opacity: 0.65; } .memos-header-actions { display: flex; gap: 2px; } .memos-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0; border: none; border-radius: var(--memos-radius-s); background: transparent; color: var(--text-muted); cursor: pointer; box-shadow: none; transition: background 0.15s ease, color 0.15s ease; } .memos-icon-btn:hover { background: var(--background-modifier-hover); color: var(--text-normal); } .memos-icon-btn .svg-icon { width: 15px; height: 15px; } /* ---------------- 搜索 ---------------- */ .memos-search { display: flex; align-items: center; gap: 6px; margin: 0 12px; padding: 0 10px; border: 1px solid var(--memos-border); border-radius: var(--memos-radius-s); background: var(--memos-well-bg); transition: border-color 0.15s ease, background 0.15s ease; } /* 聚焦只换边框色:不再额外套一圈光晕,避免和外框之间出现「双层边框 + 缝隙」 */ .memos-search:focus-within { border-color: var(--memos-accent); background: var(--memos-field-bg); box-shadow: none; } /* Obsidian 本体给 input[type=search] 自带 padding / height, 那是给整块输入框用的;这里已经在外面套了框,必须清干净,否则文字被顶得离边框很远 */ .memos-search-input { flex: 1 1 auto; min-width: 0; width: 100%; height: 32px !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; border: none !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; -webkit-appearance: none; appearance: none; font-size: 13px; line-height: 32px; color: var(--text-normal); } .memos-search-input:hover, .memos-search-input:active, .memos-search-input:focus, .memos-search-input:focus-visible { outline: none !important; border: none !important; background: transparent !important; box-shadow: none !important; } .memos-search-input::placeholder { color: var(--text-faint); } /* ---------------- 自绘下拉(不用原生 select) ---------------- Obsidian 本体对 select 有自己的 padding / 背景 / 箭头声明,不同版本下 文字落点会飘(表现为偏右),且 select 内的文字位置无法在 CSS 里精确控制。 这里换成「按钮 + 浮层」,文字靠 flex 居中,浮层自己定位。 */ .memos-dd { position: relative; display: inline-flex; flex: 0 0 auto; } .memos-dd.is-hidden { display: none; } /* 文字居中不用 flex,改成「块级 + text-align:center + 左右对称 padding」: 箭头绝对定位、完全不占布局空间,所以文字永远落在按钮的几何中线上。 外层保留 1px 描边、不加底色;所有视觉属性都带 !important, 因为 Obsidian 本体有 `button:not(.clickable-icon)`(权重 0,1,1)会给 按钮塞灰底和阴影,不加 !important 就会被它盖掉。 */ .memos-sidebar button.memos-dd-btn, button.memos-dd-btn { position: relative; display: block !important; width: auto !important; box-sizing: border-box; height: 26px !important; min-height: 26px !important; /* 左右严格相等,右侧 16px 里放箭头,文字区仍居中 */ padding: 0 16px !important; margin: 0 !important; border: 1px solid var(--memos-border) !important; border-radius: var(--memos-radius-s); background: transparent !important; color: var(--text-muted) !important; font-family: inherit; font-size: 12px !important; /* 26px 高扣掉上下各 1px 边框,行高 24 才是垂直居中 */ line-height: 24px !important; text-align: center !important; text-align-last: center !important; white-space: nowrap; cursor: pointer; box-shadow: none !important; transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease; } .memos-sidebar button.memos-dd-btn:hover, button.memos-dd-btn:hover { color: var(--text-normal) !important; border-color: var(--memos-border-strong) !important; background: var(--background-modifier-hover) !important; } .memos-sidebar button.memos-dd-btn.is-active, button.memos-dd-btn.is-active { color: var(--memos-accent) !important; border-color: var(--memos-accent) !important; } /* 双重保险:块盒用 margin:0 auto 居中,不依赖 text-align。 就算主题或本体把 text-align 覆盖掉,文字也仍然在中线上。 不设 max-width,标签多长就显示多长(不再省略号截断)。 */ .memos-dd-label { display: block !important; width: fit-content; margin: 0 auto !important; overflow: visible; text-align: center !important; white-space: nowrap; line-height: 24px !important; } /* 箭头绝对定位:既不参与居中计算,也不影响文字落点 */ .memos-dd-chevron { position: absolute; inset-inline-end: 4px; top: 50%; display: inline-flex; align-items: center; line-height: 0; opacity: 0.55; transform: translateY(-50%); pointer-events: none; } .memos-dd-chevron .svg-icon { width: 10px; height: 10px; } /* 输入区 / 弹窗里的可见性下拉:同样保持透明,只跟输入面板靠边框区分 */ .memos-dd.is-visibility .memos-dd-btn { background: transparent; } /* 浮层挂在 body 上(fixed),不会被侧栏的滚动容器裁掉。 注意它不在 .memos-sidebar 作用域内,--memos-* 变量要带兜底值。 无边框,只靠一层柔和阴影跟背景分层,跟原生下拉一致。 */ .memos-menu-pop { position: fixed; z-index: 3000; min-width: 0; /* 放宽上限,长标签尽量完整显示(仍留一点余量防止超出屏幕) */ max-width: min(320px, calc(100vw - 24px)); max-height: 280px; overflow-y: auto; padding: 4px !important; border: none !important; border-radius: 6px !important; background: var(--background-primary) !important; /* 完全不要边框线,只留一层柔和阴影做分层 */ box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18) !important; } /* 菜单行是