【油猴脚本】优化Hermes Dashboard Web的字体显示

原版的默认主题字体小,然后英文又全是大写,看着脑子都发晕 花了10分钟让ai改了下字体,取消了uppercase全大写的分格,效果如下图 虽然也就那样,但稍微看起来顺眼了点 // ==UserScript== // @name Hermes Dashboard Typography Tweak //...
【油猴脚本】优化Hermes Dashboard Web的字体显示
【油猴脚本】优化Hermes Dashboard Web的字体显示

原版的默认主题字体小,然后英文又全是大写,看着脑子都发晕 :face_with_crossed_out_eyes:

20260508100820
20260508100839

花了10分钟让ai改了下字体,取消了uppercase全大写的分格,效果如下图

20260508105132
20260508105145

虽然也就那样,但稍微看起来顺眼了点 :rofl:

// ==UserScript==
// @name         Hermes Dashboard Typography Tweak
// @namespace    local.hermes.typography
// @version      1.0.0
// @description  Improve the font stack and basic text rendering on Hermes dashboard pages.
// @match        http://127.0.0.1:9119/*
// @run-at       document-start
// @grant        none
// ==/UserScript==

(function () {
  "use strict";

  const STYLE_ID = "hermes-typography-tweak";

  const css = `
:root {
  --tm-font-sans: "Inter", "Avenir Next", Avenir, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Noto Sans CJK SC", "Segoe UI", sans-serif;
  --tm-font-mono: "SFMono-Regular", "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
}

html, body,
body *:not(svg):not(svg *):not(pre):not(code):not(kbd):not(samp):not([data-no-font-tweak="true"]) {
  font-family: var(--tm-font-sans) !important;
  font-size: 14px !important;
  line-height: 1.55 !important;
  letter-spacing: 0 !important;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  font-weight: 450 !important;
}

h1, h2, h3, h4, h5, h6,
[role="heading"],
.title, .heading,
[class*="title"], [class*="heading"], [class*="Title"], [class*="Heading"],
.logo, [class*="logo"],
nav a, aside a, [role="navigation"] a,
button, input, textarea, select, label, th, td, summary {
  font-family: var(--tm-font-sans) !important;
  letter-spacing: -0.01em !important;
}

h1, h2 {
  font-weight: 750 !important;
  line-height: 1.12 !important;
}

h3, h4, h5, h6 {
  font-weight: 700 !important;
  line-height: 1.2 !important;
}

a, button {
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
}

nav a, aside a, [role="navigation"] a {
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  text-transform: none !important;
}

.uppercase, [class*="uppercase"] {
  text-transform: none !important;
  letter-spacing: 0.01em !important;
}

code, pre, kbd, samp {
  font-family: var(--tm-font-mono) !important;
  font-size: 0.95em !important;
}

input, textarea, select, button {
  font-size: 14px !important;
  line-height: 1.35 !important;
}

::placeholder {
  opacity: 0.6;
}

::selection {
  background: rgba(88, 220, 195, 0.25);
  color: inherit;
}

img, svg, video, canvas {
  image-rendering: auto;
}
`;

  function inject() {
    if (document.getElementById(STYLE_ID)) return;
    const style = document.createElement("style");
    style.id = STYLE_ID;
    style.textContent = css;
    (document.head || document.documentElement).appendChild(style);
  }

  if (document.readyState === "loading") {
    document.addEventListener("DOMContentLoaded", inject, { once: true });
  } else {
    inject();
  }
})();

1 个帖子 - 1 位参与者

阅读完整话题

来源: LinuxDo 最新话题查看原文