@upmo-ai/theme

中文文档
1.0.0-rc.1发布于 2026/11/03AGPL-3.0-onlyTypeScriptES Module

The Mantine 9 theme for Upmo, built from @upmo-ai/tokens. Exports the theme object, the CSS-variables resolver that maps Mantine onto Upmo tokens, and the color-scheme wiring.

原始使用文档
文档目录3 节
  1. Usage
  2. The dark primary fill
  3. Build

@upmo-ai/theme

The Mantine 9 theme for Upmo, built entirely from @upmo-ai/tokens. No colour, spacing or radius literals: every value reads a token.

It exports three things:

  • upmoTheme - the Mantine createTheme object (primary colour, type and radius scales, breakpoints, component defaults for the crisp, sharp, bordered look).
  • cssVariablesResolver - maps Mantine's internal colour variables onto the Upmo token variables. Mantine writes its colours as inline variables on the document, which a stylesheet cannot override, so this resolver is required for the page ground, text, borders and the primary fill to follow the tokens.
  • tokenVariables - the raw Mantine-name to token-variable map, for tests and for the docs preview pipeline.

Usage

import '@mantine/core/styles.css';
import '@upmo-ai/tokens/tokens.css';
import { MantineProvider } from '@mantine/core';
import { upmoTheme, cssVariablesResolver } from '@upmo-ai/theme';

export function App({ children }) {
  return (
    <MantineProvider theme={upmoTheme} cssVariablesResolver={cssVariablesResolver}>
      {children}
    </MantineProvider>
  );
}

Import order matters: Mantine's CSS first, then the tokens CSS, then any local overrides.

The dark primary fill

The dark primary button uses a brighter, more saturated emerald than the light one, so it stays vivid on the dark ground. This is done two ways that agree: Mantine's primaryShade is { light: 7, dark: 5 }, and the resolver pins the filled primary to the --primary-fill token (which is scheme-aware in @upmo-ai/tokens). A hover glow (--glow-primary) applies in dark only.

Build

pnpm --filter @upmo-ai/theme build   # tsup: ESM + d.ts

版本与发布记录

@upmo-ai/theme 共发布 2 个版本,首次发布于 2026/11/03;过去 12 个月发布了 2 个版本。

版本发布日期距今
1.0.0-rc.1latest2026/11/03今天
0.0.0-stage2026/11/03今天

关于 @upmo-ai/theme 的常见问题

@upmo-ai/theme 是什么?

Upmo的Mantine 9主题,由@upmo-ai/tokens构建。导出主题对象、将Mantine映射到Upmo令牌的css变量解析器以及配色方案连接。

如何安装 @upmo-ai/theme?

在项目目录运行 npm install @upmo-ai/theme,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@mantine/core(^9.7.4)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@upmo-ai/theme 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@upmo-ai/theme 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@upmo-ai/theme 可以商用吗?

@upmo-ai/theme 使用 AGPL-3.0-only 许可。最严格的 Copyleft:除分发外,通过网络向用户提供基于它的服务也需要开源对应源码。闭源 SaaS 使用前务必评估。以上为概括,不构成法律意见,请以许可原文为准。

@upmo-ai/theme 还在维护吗?

最新版本 1.0.0-rc.1 发布于 2026/11/03(今天);至今共发布 2 个版本,其中过去 12 个月发布了 2 个;首次发布于 2026/11/03。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。