npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@king-design/themes

v1.0.9

Published

King-Design UI 自定义主题库

Downloads

193

Readme

@king-design/themes

面向 King-Design UI 的主题配置库,提供开箱即用的内置主题与可扩展的 Theme 结构,帮助业务在不同品牌/视觉风格下快速完成主题切换与统一设计落地。

为什么要用这个库

  • 统一管理颜色、尺寸、组件级样式变量,避免样式分散
  • 通过主题对象集中维护视觉规范,降低多产品线维护成本
  • 支持按需导入,减小业务侧引入体积
  • 同时兼容 ESM / CommonJS,适配不同工程体系

安装

npm install @king-design/themes

快速开始

1. 引入内置主题

import { scubablue } from '@king-design/themes';

// scubablue 即可作为你的主题配置对象使用
console.log(scubablue.color.primary); // #5370FF

2. 按需引入(推荐在追求包体积时使用)

import scubablue from '@king-design/themes/scubablue';

3. 在 @king-design 组件库中注入主题(业务接入示例)

import { setTheme } from '@king-design/vue';
import { scubablue } from '@king-design/themes';

setTheme(scubablue);

你的组件库/应用框架只需要约定“如何消费 theme 对象”,即可完成主题接入。

内置主题

scubablue(深海蓝)

  • 更丰富的色彩体系(如 purpletealyellow 等扩展色)
  • 包含 table 等组件级主题变量
  • 适合有品牌色表达和更多业务场景的系统

TypeScript 支持

库导出 Theme 类型,可用于自定义主题扩展与静态校验:

import type { Theme } from '@king-design/themes';

export const customTheme: Theme = {
    color: {
        primary: '#1f6fff',
        success: '#23D464',
    },
    button: {
        radius: 6,
    },
};

Theme 为递归结构,支持以下值类型:

  • string
  • number
  • Theme(嵌套对象)

API 参考

根入口导出

  • Theme 类型
  • scubablue 主题对象

子路径导出

  • @king-design/themes/scubablue

开发与构建

# 构建
npm run build

发布命令(维护者)

# patch 版本发布
npm run release

# minor 版本发布
npm run release-minor

# beta 版本发布
npm run release-beta

产物说明

构建输出目录:dist/

  • dist/index.js:ESM 入口
  • dist/index.cjs.js:CommonJS 入口
  • dist/index.d.ts:类型声明
  • dist/themes/*:主题按文件拆分后的 ESM/CJS/类型声明

最佳实践建议

  • 业务侧不要直接硬编码颜色,优先从主题变量读取
  • 按“语义变量”命名(如 primarywarning),避免与具体色值强绑定
  • 新增主题时尽量保持变量结构一致,降低组件适配成本
  • 可在应用启动时注入主题,在用户切换品牌时动态替换主题对象

License

MIT