본문으로 건너뛰기
cccskills
무료GitHub에 공개

univer-customize-theme

Customize Univer color themes, branded palettes, dark mode, and theme-aware plugin styles across Sheets, Docs, Slides, Bases, Boards, and PDFs. Use when setting an initial or runtime Theme, consuming ThemeService or --univer-* CSS variables, keeping custom UI or canvas code theme-aware, registering a separate Univer Pro chart theme, or migrating theme code from Univer 0.25.0 to current 1.0 source.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(4)

  • SKILL.md6.8 KB
  • agents/openai.yaml240 B
  • references/products-and-pro.md5.0 KB
  • references/theme-api.md5.8 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Univer Customize Theme

Build and apply a complete Univer theme without bypassing the public Facade or runtime theme service.

Source baseline: current Univer OSS and Pro source, whose manifests identify as 1.0.0-beta.0. Inspect the target application's installed declarations first: the npm release with the same version label can lag the current source API.

Workflow

  1. Decide whether the request concerns the application palette, dark mode, plugin styling, or a Pro Chart theme. These are separate contracts.
  2. Inspect the exact installed version and integration mode. Presets compose plugins and Facade extensions; Plugin Mode requires explicit plugin and /facade imports.
  3. Derive a complete Theme from a built-in theme. Do not hand-write or cast a partial object.
  4. Pass the initial theme to createUniver. Use current FUniver theme methods only when they exist in the target declarations.
  5. Read live colors through ThemeService in plugin/render code and through --univer-* variables in browser CSS.
  6. Verify light and dark appearances in every enabled product host.

Build a complete brand palette

Import from the owning package and keep it on the target application's exact Univer version:

import type { Theme } from '@univerjs/themes';
import { defaultTheme } from '@univerjs/themes';

export const brandTheme: Theme = {
  ...defaultTheme,
  primary: {
    ...defaultTheme.primary,
    50: '#F5F3FF',
    100: '#EDE9FE',
    200: '#DDD6FE',
    300: '#C4B5FD',
    400: '#A78BFA',
    500: '#8B5CF6',
    600: '#7C3AED',
    700: '#6D28D9',
    800: '#5B21B6',
    900: '#4C1D95',
  },
};

The current source schema also contains gray, semantic color ramps, loop-color, and highlight.background. Preserve every branch unless the design intentionally replaces it. See Theme API and migration for the schema, built-ins, and release gate.

Apply the theme

Add the initial theme to the existing createUniver configuration. Keep that integration's locale, preset, container, and explicit stylesheet imports unchanged:

const { univer, univerAPI } = createUniver({
  locale: LocaleType.EN_US,
  locales,
  presets,
  theme: brandTheme,
  darkMode: false,
});

Current source supports runtime changes through the base Facade:

univerAPI.setTheme(brandTheme);
univerAPI.toggleDarkMode(true);

const currentTheme = univerAPI.getCurrentTheme();
const darkMode = univerAPI.isDarkMode();

Theme selection and dark mode are independent. setTheme() does not toggle dark mode, and toggleDarkMode() does not replace the palette.

Preset Mode constructs the base Facade. In manual Plugin Mode, construct it from the public core entry after registering plugins:

import { FUniver } from '@univerjs/core/facade';

const univerAPI = FUniver.newAPI(univer);

There is no @univerjs/themes/facade package. If installed FUniver declarations lack setTheme(), getCurrentTheme(), or isDarkMode(), configure the complete theme during initialization or upgrade; do not reach through univer.__getInjector().

Make custom code theme-aware

For custom DOM, use variables injected by the UI workbench:

.brand-action {
  color: var(--univer-gray-0);
  background: var(--univer-primary-600);
  border-color: var(--univer-primary-700);
}

For plugin services, canvas rendering, and model code, inject ThemeService and resolve the live token instead of importing a built-in palette as runtime state:

import { Inject, ThemeService } from '@univerjs/core';

export class SelectionColorProvider {
  constructor(
    @Inject(ThemeService) private readonly _themeService: ThemeService
  ) {}

  getColor(): string {
    return this._themeService.getColorFromTheme('primary.600');
  }
}

Observe currentTheme$ or darkMode$ when caching derived colors, and release subscriptions with the owner lifecycle. Headless runtimes have ThemeService but do not inject browser CSS variables.

Six products and Pro Charts

One Univer runtime shares its core ThemeService across Sheets, Docs, Slides, Bases, Boards, and PDFs. Theme setup does not register product plugins, load locales, or load CSS. Preserve the aggregate preset CSS or every selected Plugin Mode stylesheet.

Slides, Boards, PDF tables, Sheet ranges, and Pro Charts also have content-level theme/style systems. They do not use the same contract as the application palette. Read Products and Pro themes before changing content or chart colors.

Browser-global boundary

The current UI workbench writes flattened variables to one :root style element and toggles univer-dark on document.documentElement. Multiple browser UI instances in one document therefore do not have isolated CSS palettes or dark-mode classes; the latest document-level update wins. Current disposal also does not restore the previous document-level style or root class. Use one shared appearance or isolate editors in separate documents such as iframes; do not promise that univer.dispose() restores the host page appearance.

Validate

  • Confirm all Univer packages use the target application's exact release.
  • Typecheck the complete Theme; do not cast a partial object.
  • Verify required preset/plugin styles still load.
  • Exercise initial theme setup and any supported runtime switch after the workbench mounts.
  • Inspect DOM UI and canvas content in light and dark mode.
  • Test every enabled product host and Pro Charts separately.
  • Check contrast for text, focus, selection, error, and disabled states.

Avoid

  • Do not mutate a built-in theme object; copy it with nested spreads.
  • Do not mutate document.head or instantiate ThemeSwitcherService yourself.
  • Do not override generated --univer-* values as the source of truth; the next theme emission replaces them.
  • Do not read live runtime colors from defaultTheme inside a plugin.
  • Do not assume changing the application theme rewrites persisted product content colors.
  • Do not migrate 0.25.0 code by changing version strings only; the schema, built-ins, and Facade surface changed.

References

  • Theme API and migration — exact schema, built-ins, Facade/ThemeService APIs, CSS flattening, dark mode, release gate, and 0.25.0 differences
  • Products and Pro themes — six-product behavior, CSS ownership, product content themes, and the independent Pro Chart theme API

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Build applications with Univer Office SDK, covering the Web SDK (browser Office editors, headless Sheets and Docs in Node), Server SDK (self-hosted OT collaboration, storage, auth, Office import/export), AI SDK (agent-operated Office CLIs, reviewable Worktrees), and Binding SDK (plain HTML pages bound to live Sheet data). Use when starting or designing any Univer-based app or choosing Univer packages, including when the user describes a spreadsheet, document, collaboration, or AI-office need without naming a Univer package.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

dream-num/skills782026년 10월 14일 업데이트

Use when installing or operating Univer CLI for .univer files, spreadsheets, documents, slides, Base databases, Board canvases, cross-Unit embedding, worktrees, Facade authoring, inspection, verification, import/export, screenshots, or viewer handoff.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

dream-num/skills782026년 10월 14일 업데이트

Integrate Univer Sheets, Docs, or Slides into React, Vue 3, HTML, or Node.js projects. Use when embedding Univer, choosing preset or plugin mode, initializing instances, configuring themes/locales/workers, or manipulating workbooks, worksheets, ranges, formulas, permissions, and events through the Facade API.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

dream-num/skills782026년 10월 14일 업데이트

Run Univer Sheets, Docs, Slides, Bases, Boards, or PDFs in Node.js without browser UI. Use for server-side or backend Univer, OSS Sheets or Docs Node presets, Pro product Facades and collaboration, JSON snapshot processing, formula or Base child-process workers, or automated unit manipulation with @univerjs/rpc-node.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

dream-num/skills782026년 10월 14일 업데이트

Develop custom plugins for Univer sheets, docs, slides, bases, boards, and PDFs. Use when implementing a Plugin lifecycle, dependency injection, commands/mutations/operations, undo/redo, Facade extensions or custom events, toolbar/context-menu items, shortcuts, icons, popups, or when diagnosing plugin API and registration errors.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

dream-num/skills782026년 10월 14일 업데이트

Integrate current Univer Pro features into browser applications. Use for licensed Sheets, Docs, Slides, Bases, Boards, or PDFs; advanced Sheets presets; collaboration and edit history; Office import/export; printing; pivot tables; charts; sparklines; shapes; Pro workers; license ordering; or Pro Facade APIs.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

dream-num/skills782026년 10월 14일 업데이트

dream-num의 스킬 모두 보기

이 스킬의 문제 신고