@db-ux/db-theme

中文文档
7.2.0发布于 2026/10/23SEE LICENSE IN LICENSEES Module近 30 天下载 5973
原始使用文档
文档目录6 节
  1. Install
  2. Usage with @db-ux/core-components
  3. Import
  4. Advanced Settings
  5. Deutsche Bahn brand
  6. License

@db-ux/db-theme

We provide db-theme for DB Apps in this package. Because of legal concern some files are encrypted. To decrypt them you need to go to Marketingportal. Note: Deep links aren't working, you need to click the link again after login.

You will find two environment variables on the page:

  • ASSET_PASSWORD
  • ASSET_INIT_VECTOR

Before you install @db-ux/db-theme you need to create a .env file and add it to your .gitignore. Afterward, you add those two variables to the .env file.

ASSET_PASSWORD=db-theme
ASSET_INIT_VECTOR=db-theme

The postinstall script inside @db-ux/db-theme package will decrypt the files for you. If the decryption didn't work for you (e.g. because the Git lifecycle scripts, such as postinstall, have been deactivated, e.g. by the ignore-scripts setting), you will need to run the decryption scripts manually (see our "Contribution" / "Compare" documentation section for more information). Alternatively, you can include these node scripts in your lifecycle scripts.

Note: You can use process.env. local or in CI/CD to pass the required environment variables to postinstall.

Install

Note: Read the disclaimer above :)

npm i @db-ux/db-theme

Usage with @db-ux/core-components

Import

There are different ways to include the theme. Therefore, you need to import the correct .css file. There are multiple files depending on the bundler you use. [TYPE] should be replaced with your bundler, if you don't use relative paths:

  • relative: No bundler
  • absolute: No bundler
  • rollup: vite, rollup
  • webpack: webpack, nextjs

JS/TS

// main.[js|ts]
import "@db-ux/core-components/build/styles/bundle.css"; /* loads whitelabel */
import "@db-ux/db-theme/build/styles/[TYPE].css"; /* Overwrite whitelabel  */

CSS

/* main.css */
@import "@db-ux/core-components/build/styles/bundle.css"; /* loads whitelabel */
@import "@db-ux/db-theme/build/styles/[TYPE].css"; /* Overwrite whitelabel  */

Vite

You might need to add an additional resolve in vite.config.[js|ts]:

import * as path from "node:path";

export default defineConfig({
    ...
    resolve: {
        alias: {
            "@db-ux": path.resolve("node_modules/@db-ux"),
        },
    },
});

Advanced Settings

Instead of overwriting the whitelabel ([TYPE].css) you could also include each .css you need in your project:

// main.[js|ts]

/* load components */
import "@db-ux/core-components/build/styles/index.css";

/* load foundations (optional) */
import "@db-ux/core-foundations/build/styles/helpers/classes/all.css";
import "@db-ux/core-foundations/build/styles/density/classes/all.css";
import "@db-ux/core-foundations/build/styles/fonts/classes/all.css";
import "@db-ux/core-foundations/build/styles/colors/classes/all.css";

/* load assets */
import "@db-ux/db-theme-fonts/build/styles/[TYPE].css";
import "@db-ux/db-theme-icons/build/styles/[TYPE].css";

/* load theme */
import "@db-ux/db-theme/build/styles/index.css";

Deutsche Bahn brand

As we'd like to perfectly support our users and customers on their digital journey, the usage of Deutsche Bahn brand and trademarks are bound of clear guidelines and restrictions even if being used with the code that we're providing with this product; Deutsche Bahn fully reserves all rights regarding the Deutsche Bahn brand, even though that we're providing the code of DB UX products free to use and release it under the Apache 2.0 license. Please have a look at our brand portal at https://marketingportal.extranet.deutschebahn.com/ for any further questions and whom to contact on any brand issues.

You aren't allowed to use this package or any of its contents (like e.g. design assets as well as protected characteristics and trademarks) for any usage outside of Deutsche Bahn websites and applications.

License

This project is licensed under special Apache-2.0, see the LICENCE file in this package.

版本与发布记录

@db-ux/db-theme 共发布 64 个版本,首次发布于 2024/12/19;过去 12 个月发布了 22 个版本。

版本发布日期距今
7.2.0latest2026/10/2319 天前
7.1.02026/10/2319 天前
7.0.02026/10/1527 天前
6.3.02026/09/241 个月前
6.2.02026/08/202 个月前
6.1.02026/08/132 个月前

其他发布通道:next → 6.0.0-fix-safari-font-jumping-4n2iq789。

关于 @db-ux/db-theme 的常见问题

如何安装 @db-ux/db-theme?

在项目目录运行 npm install @db-ux/db-theme,或使用 pnpm add / yarn add / bun add。

@db-ux/db-theme 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/db-ux__db-theme 是否存在。

@db-ux/db-theme 支持 ESM 还是 CommonJS?

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

@db-ux/db-theme 可以商用吗?

@db-ux/db-theme 使用 SEE LICENSE IN LICENSE 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@db-ux/db-theme 的下载量有多少?

根据 npm 官方下载统计,@db-ux/db-theme 在 2026/10/12 – 2026/11/10 这 30 天内被下载 5,973 次,日均约 199 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@db-ux/db-theme 还在维护吗?

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