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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@akiy2009/auto-design-tokens-optimizer

v1.0.1

Published

Design-token-first color utilities + robust CLI. Normalize tokens, generate scales, support alpha blending and PostCSS plugin. CLI: adt-optimize.

Downloads

193

Readme

Auto Design Tokens Optimizer

デザイントークン自動最適化ツール
パッケージ名: @akiy2009/auto-design-tokens-optimizer


✨ 概要

Auto Design Tokens Optimizer は、デザイントークンを自動で最適化し、
背景色に合わせたコントラスト調整・色相/明度/彩度の微調整により、
一貫性がありアクセシブルな UI カラーを生成する軽量ツールです。

以下のユースケースに最適です:

  • デザインシステムの色を自動で WCAG 対応させたい
  • CSS 変数(--color-primary など)をバラつきなく整えたい
  • JSON トークンを自動で正規化 → 最適化したい
  • PostCSS と組み合わせてビルド時に自動修正したい

CLI と PostCSS プラグインのどちらでも利用できます。


🚀 特徴

  • 🎨 背景色に合わせた自動コントラスト調整(WCAG AA / AAA 対応)
  • 🔧 色相・明度・彩度(HSL)のバランス補正
  • 🏷️ JSON / CSS トークンを自動で正規化
  • 🗂️ CSS 変数・JSON の両方にフル対応
  • ⚡ 使いやすい CLI ツール
  • 🧩 PostCSS プラグインとしても動作
  • 📦 ランタイム依存ほぼゼロの軽量設計

📦 インストール

npm からインストール:

npm install @akiy2009/auto-design-tokens-optimizer

npx で即実行:

npx adt-optimize --help

🛠 使い方(CLI)

🔹 基本

adt-optimize --input tokens.json --output tokens.fixed.json

🔹 CSS 変数の場合

adt-optimize --input styles.css --output styles.fixed.css --format css

⚙ オプション一覧

| オプション | 説明 | | | ---------------------- | ------------------ | -------------- | | --input <file> | 入力ファイル(CSS / JSON) | | | --output <file> | 出力先ファイル | | | --format css | json | 出力形式を強制指定 | | --target-contrast 4.5 | 7.0 | WCAG の目標コントラスト | | --preset wcag-aa | wcag-aaa | アクセシビリティプリセット | | --colors-only | カラー系トークンのみ処理 | | | --dry-run | 出力ファイルを作らず標準出力へ | |

PostCSS プラグインとして使用

postcss.config.js に追加:

module.exports = {
  plugins: [
    require("@gakuseibot/auto-design-tokens-optimizer/postcss")({
      targetContrast: 4.5,
      adjustHue: true,
      adjustSaturation: true
    })
  ]
};

🗂 JSON トークン例

入力: tokens.json

{
  "primary": "#4c8cff",
  "background": "#ffffff",
  "success": "#28c76f"
}

出力: tokens.fixed.json

{
  "primary": "#2d6fe8",
  "background": "#ffffff",
  "success": "#219c58"
}

※ 値は例示であり正確ではありません。

📁 プロジェクト構成

src/
  color.ts
  tokens.ts
  optimizer.ts
  cli-core.ts
  postcss-plugin.ts
  utils.ts
bin/
  adt-optimize.js

📄 ライセンス

このプロジェクトは Apache License 2.0 の下で公開されています。

📬 連絡先

改善案・バグ報告・Pull Request などはお気軽にどうぞ。 Email: [email protected] Discord: @aki._.yama

⭐ サポート

良いと思ったら GitHub リポジトリにスターをお願いします! 開発継続の大きな励みになります。