@esri/calcite-colors

中文文档
6.1.0发布于 2023/01/05SEE LICENSE IN README.mdTypeScriptES Module零依赖近 30 天下载 11万

Authoritative color variables for Esri

原始使用文档
文档目录10 节
  1. Color reference files
  2. Sass Variables
  3. Sass Theme Mixins
  4. ES6 Export
  5. UI Colors
  6. Chart Colors
  7. Colors naming anatomy
  8. Build instructions
  9. Licensing
  10. Contributing to Calcite Colors

Calcite Colors

saturated color wheel

The calcite-colors repository provides Esri's official color palette including documentation, reference files, and helpers in multiple file formats.

Color reference files

The following links are to download the .ase swatch for use in Adobe products such as Adobe Photoshop and Adobe Illustrator. Additionally, there is a PDF download of the visual reference color palette.

Sass Variables

A Sass variables file can be found in the root directory colors.scss. This is the main source to consume the color variables.

Sass Theme Mixins

A pair of Sass mixins are available which will return the two themes as CSS custom properties. In this way, you can add css vars to your app if need be:

@import "@esri/calcite-colors/dist/colors.scss";

:root {
  @include calcite-theme-light();
}

[theme="dark"] {
  @include calcite-theme-dark();
}

These colors are then accessible with the var syntax:

.my-element {
  border-color: var(--calcite-ui-blue-1);
}

ES6 Export

In a modern javascript environment you can import the colors via ES6 import:

import { colors } from "@esri/calcite-colors/dist/colors";

console.log(colors["ui-blue"]); // => "#007ac2"

UI Colors

In both the Sass and JSON file are UI Color variables. These variables should be the standard usage of color for most applications. They'll serve as an easy way for users to grab the main usage colors so colors stay consistent across applications. They include both Light and Dark theme variables. Dark theme variables have -dark appended. Additionally, both light and dark include variables for hover and pressed states ($ui-blue-2, $ui-red-3).

Chart Colors

Colors for charts are included as well. These can be used to import colors for charting libraries.

Colors naming anatomy

colors naming anatomy

Build instructions

To run a build run npm run build within a terminal at the project's root directory. This will compile the Typescript files into JavaScript modules.

Make sure to run npm install has been run before the first time building

Licensing

COPYRIGHT © 2021 Esri

All rights reserved under the copyright laws of the United States and applicable international laws, treaties, and conventions.

This material is licensed for use under the Esri Master License Agreement (MLA), and is bound by the terms of that agreement. You may redistribute and use this code without modification, provided you adhere to the terms of the MLA and include this copyright notice.

See use restrictions at http://www.esri.com/legal/pdfs/mla_e204_e300/english

For additional information, contact: Environmental Systems Research Institute, Inc. Attn: Contracts and Legal Services Department 380 New York Street Redlands, California, USA 92373 USA

email: [email protected]

Contributing to Calcite Colors

Please read the contribute document.

版本与发布记录

@esri/calcite-colors 共发布 21 个版本,首次发布于 2018/08/18;过去 12 个月发布了 0 个版本。

版本发布日期距今
6.1.0latest2023/01/053 年前
6.0.12021/08/105 年前
6.0.02021/01/305 年前
5.0.02020/10/216 年前
4.0.12020/10/156 年前
4.0.02020/10/156 年前

关于 @esri/calcite-colors 的常见问题

@esri/calcite-colors 是什么?

Authoritative color variables for Esri

如何安装 @esri/calcite-colors?

在项目目录运行 npm install @esri/calcite-colors,或使用 pnpm add / yarn add / bun add。

@esri/calcite-colors 支持 TypeScript 吗?

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

@esri/calcite-colors 支持 ESM 还是 CommonJS?

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

@esri/calcite-colors 可以商用吗?

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

@esri/calcite-colors 的下载量有多少?

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

@esri/calcite-colors 还在维护吗?

最新版本 6.1.0 发布于 2023/01/05(3 年前);至今共发布 21 个版本,其中过去 12 个月发布了 0 个;首次发布于 2018/08/18。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。