API 参考 · 基础色
@oriatheme/colors
不随主题切换的稳定基础色库,以及 Tailwind v4 兼容的公开 CSS 子路径。包与运行环境
静态值;可在任意 JavaScript、CSS 与 SSR 环境使用。
bash
pnpm add @oriatheme/colorsbash
npm install @oriatheme/colorsbash
yarn add @oriatheme/colorsbash
bun add @oriatheme/colors选择使用方项目已有的一种包管理器和 lockfile;示例只使用 package root export,不要从 src、dist 或 registry template 深层导入。
Exports
| Export | Signature | Description |
|---|---|---|
oriaColors | OriaColors | 26 immutable named scales plus black, white, inherit, transparent, and current. |
oriaColorFamilies | readonly OriaColorFamily[] | The 26 stable family names. |
oriaColorSteps | readonly OriaColorStep[] | 50 through 950 in eleven steps. |
toOriaColorVariable | (family, step) => `--oria-palette-${family}-${step}` | Returns a stable base-color custom property name. |
ts
import { oriaColors, toOriaColorVariable } from "@oriatheme/colors";
const blue = oriaColors.blue[500];
const variable = toOriaColorVariable("blue", 500);CSS
css
@import "@oriatheme/colors/styles.css";
@import "tailwindcss";
@import "@oriatheme/colors/tailwind.css";基础色不会随 OriaTheme 切换。需要随主题变化的界面值应使用 Runtime 写入的语义 --oria-* 变量。