@apollo/brand

中文文档
0.7.0发布于 2024/09/07UNLICENSEDTypeScriptCommonJS零依赖近 30 天下载 1979

This repo contains a basic set of tokens that represent Apollo's brand colors and typographic styles. It also exposes our logotype and symbol logos as SVGs.

原始使用文档
文档目录6 节
  1. Installation
  2. Usage
  3. Colors
  4. Typography
  5. Logos
  6. Example

@apollo/brand

This repo contains a basic set of tokens that represent Apollo's brand colors and typographic styles. It also exposes our logotype and symbol logos as SVGs.

Installation

yarn add @apollo/brand

Usage

Import colors and/or typography from the @apollo/brand package and access design system tokens by drilling into the objects' properties. For a reference of all the available tokens and styles, please refer to the Design System 2.0 document in Figma.

Colors

The colors export contains two children: primitives and tokens.

primitives are palettes named as their color, i.e., orange, purple, black, etc. They each feature a series of numeric shades. For most palettes, they range from 100 to 500 in increments of 100.

tokens are semantically-named colors with variants for light and dark modes. Their names describe the context that they should be used. For example, colors.tokens.border.warning.base should be used as the border color for an element that displays a warning.

The base property at the end of the token above refers to the light mode variant. If this color was being used in dark mode, you would access colors.tokens.border.warning.dark. Every semantic token features base and dark variants.

Typography

The typography export also contains primitives and tokens!

The primitives include named font weights, i.e., normal, medium mapped to their numerical values (400, 500, etc.), and named font sizes that map to numerical font size and line height combinations.

tokens is an object that maps named font variants to the following CSS properties:

  • fontSize
  • lineHeight
  • fontFamily
  • fontWeight

Logos

This package also exposes the Apollo logos as plain SVG files. Depending on your website implementation, you may be able to import them and use them as image URLs, or transform them into React components using a tool like SVGR.

import { ReactComponent as Symbol } from "@apollo/brand/logos/symbol.svg";

const MyComponent = () => {
  return (
    // SVGR magic 🪄
    <Symbol
      style={{
        fill: 'red'
      }}
    />
  );
};

Example

import { colors, typography } from "@apollo/brand";
import logotype from "@apollo/brand/logos/logotype.svg";

const MyComponent = () => {
  return (
    <>
      <img src={logotype} alt="Apollo logo" />
      <h1
        style={{
          ...typography.tokens["3xl"],
          color: colors.tokens.text.primary.base,
          backgroundColor: colors.primitives.navy[100]
        }}
      >
        Welcome to Apollo
      </h1>
    </>
  );
};

版本与发布记录

@apollo/brand 共发布 29 个版本,首次发布于 2023/11/04;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.7.0latest2024/09/072 年前
0.6.02024/08/262 年前
0.5.92024/04/272 年前
0.5.82024/04/262 年前
0.5.72024/04/162 年前
0.5.62024/04/112 年前

关于 @apollo/brand 的常见问题

@apollo/brand 是什么?

This repo contains a basic set of tokens that represent Apollo's brand colors and typographic styles. It also exposes our logotype and symbol logos as SVGs.

如何安装 @apollo/brand?

在项目目录运行 npm install @apollo/brand,或使用 pnpm add / yarn add / bun add。

@apollo/brand 支持 TypeScript 吗?

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

@apollo/brand 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@apollo/brand 可以商用吗?

@apollo/brand 使用 UNLICENSED 许可。作者声明为 UNLICENSED,即不授予公开使用许可(与公共领域的 Unlicense 不同)。使用前需获得作者授权。以上为概括,不构成法律意见,请以许可原文为准。

@apollo/brand 的下载量有多少?

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

@apollo/brand 还在维护吗?

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