← Files Daybreak Defense FactoryARCHIVED FILE

.internal/defense-factory-ui/src/workbench/patch-diff-theme.ts

2.21 KB · Nov 23, 2026 · 18:13 UTC

↓ Download file

See the change to this file →

import { registerCustomTheme } from "@pierre/diffs";

export const patchTheme = {
  light: "security-patch-light",
  dark: "pierre-dark",
};

registerCustomTheme(patchTheme.light, async () => ({
  name: patchTheme.light,
  type: "light",
  colors: { "editor.foreground": "#303030", "editor.background": "#ffffff" },
  tokenColors: [
    { scope: ["keyword", "storage"], settings: { foreground: "#c74014" } },
    {
      scope: ["entity.name.type", "support.type"],
      settings: { foreground: "#6e33bd" },
    },
    {
      scope: [
        "keyword.operator",
        "entity.name.namespace",
        "entity.name.type.rust",
        "entity.name.type.lifetime.rust",
      ],
      settings: { foreground: "#303030" },
    },
    {
      scope: "meta.use.rust entity.name.type.rust",
      settings: { foreground: "#6e33bd" },
    },
    { scope: "string", settings: { foreground: "#16823c" } },
    { scope: "comment", settings: { foreground: "#6e6e6e" } },
  ],
}));

// FileDiff renders inside a shadow root. Keep the host theme and align its
// gutters and separators to the file browser while retaining its code layout.
export const patchCodeCSS = `
  :host { color-scheme: inherit; --diffs-bg: var(--color-surface); }
  [data-diff] {
    --diffs-grid-number-column-width: max(30px, var(--diffs-min-number-column-width-default));
    --diffs-gap-style: none;
  }
  [data-code] { scrollbar-gutter: auto; }
  [data-column-number], [data-gutter-buffer] { padding-inline: 0; }
  [data-column-number] { display: flex; align-items: center; justify-content: flex-end; }
  [data-line-number-content] { min-width: auto; }
  [data-column-number]::after { content: ""; flex-basis: 4px; }
  [data-line] { padding-inline-start: 4px; }
  [data-separator="line-info"] {
    height: 28px;
    margin: 0;
    background: transparent;
  }
  [data-line], [data-column-number], [data-separator] {
    margin-block-end: 1px;
  }
  [data-separator-content] { padding-inline: 8px; }
  [data-unified] [data-separator="line-info"] [data-separator-content] { border-radius: 5px; }
  [data-line-type="change-addition"] { --diffs-computed-diff-line-bg: var(--df-patch-add-bg); }
  [data-line-type="change-deletion"] { --diffs-computed-diff-line-bg: var(--df-patch-remove-bg); }
`;

SHA-256: 18235be7b726547a75aeccd7bb8c62ba1fc541ab3a1cfcc4f2542291b2ff657b