MCPcopy Index your code
hub / github.com/evilmartians/figma-polychrom

github.com/evilmartians/figma-polychrom @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
145 symbols 468 edges 98 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Polychrom—APCA Contrast Checker

How It Works:

  • Select a layer or text with a visible solid fill, and Polychrom will display the contrast level between the selection and an automatically detected layer background.
  • Select two layers with solid fills, and Polychrom will indicate the contrast between them.
  • Choose multiple layers, and Polychrom will provide a list of contrasts for each selected layer and its background.
  • Modify the color using the built-in color picker, and Polychrom will instantly adjust the contrast value.

Features

  • Displays the contrast level according to the APCA method.
  • Offers text size recommendations for regular (weight 400) and bold (weight 700) font styles, following the APCA contrast-to-font table.
  • Converts original colors to the OKLCH color model, facilitating easy copying of CSS codes to the clipboard. RGB and HEX formats are also available.

What is APCA?

The Accessible Perceptual Contrast Algorithm (APCA) is a novel method for calculating and predicting readability contrast. This model is specially optimized for ensuring accessible color visibility on self-illuminated RGB computer displays and devices. It also addresses the requirements of visually impaired users, focusing on improving visual readability.

APCA is a candidate contrast method for the forthcoming WCAG 3 and is concurrently evolving as the APCA Readability Criterion, an independent standard managed by Inclusive Reading Technologies.

Read more: APCA in a Nutshell.

Installation

Clone the repository:

git clone https://github.com/evilmartians/figma-polychrom.git

Navigate to the project directory:

cd figma-polychrom

Install the dependencies:

pnpm install

Development

Run the development server:

pnpm dev

Build

Build the plugin:

pnpm build

Testing the Plugin in Figma

Setting up the Plugin for Testing

  1. Build the plugin using pnpm build or pnpm dev to ensure the latest changes are included.
  2. Open Figma Desktop (the plugin development requires the desktop version, not the web version)
  3. Import the plugin:
  4. Go to Menu → Plugins → Development → Import plugin from manifest...
  5. Navigate to your project directory and select the manifest.json file
  6. The plugin will appear in your Development section under Plugins

Running the Plugin

  1. Launch the plugin:
  2. Go to Menu → Plugins → Development → Polychrom
  3. Or use the shortcut Cmd/Ctrl + / and search for "Polychrom"

Contributing

  • Fork the repository.
  • Create a new branch for your feature or bugfix.
  • Make your changes.
  • Push your changes and create a pull request.
  • We appreciate any contributions! Please make sure to test your code and adhere to our coding standards.

Extension points exported contracts — how you extend this code

UIColor (Interface)
(no doc)
src/types/common.ts
ContrastConclusion (Interface)
(no doc)
src/ui/types/index.ts
PolychromNode (Interface)
(no doc)
src/types/common.ts
Props (Interface)
(no doc)
src/ui/components/ThemeVariablesProvider.tsx
ContrastConfig (Interface)
(no doc)
src/types/apcach.d.ts
Props (Interface)
(no doc)
src/ui/components/TextMetrics.tsx
ApcachColor (Interface)
(no doc)
src/types/apcach.d.ts
TooltipOptions (Interface)
(no doc)
src/ui/components/Tooltip.tsx

Core symbols most depended-on inside this repo

isEmpty
called by 34
src/utils/not-empty.ts
notEmpty
called by 24
src/utils/not-empty.ts
getConclusionByScore
called by 17
src/ui/services/apca/conclusion.ts
formatColorForTheme
called by 15
src/ui/components/ThemeVariablesProvider.tsx
areNodesIntersecting
called by 9
src/api/services/figma/intersections/are-nodes-intersecting.ts
createPolychromNode
called by 9
src/api/services/figma/nodes/create-polychrom-node.ts
getSiblingsThatAreBelowByZIndex
called by 8
src/api/services/figma/intersections/get-siblings-that-are-below-by-z-index.ts
isContainedIn
called by 7
src/api/services/figma/intersections/is-contained-in.ts

Shape

Function 111
Interface 28
Enum 6

Languages

TypeScript100%

Modules by API surface

src/ui/services/theme/generate-ui-colors.ts12 symbols
src/utils/colors/formatters.ts11 symbols
src/types/messages.ts7 symbols
src/ui/components/Tooltip.tsx5 symbols
src/ui/services/blend/blend-colors.ts4 symbols
src/ui/components/ThemeVariablesProvider.tsx4 symbols
src/ui/components/Selection.tsx4 symbols
src/api/services/messages/send-saved-color-space-display-mode.ts4 symbols
src/ui/stores/selected-nodes.ts3 symbols
src/api/services/payload/build-general-selection-payload.ts3 symbols
src/utils/not-empty.ts2 symbols
src/ui/stores/color-space-display-mode.ts2 symbols

For agents

$ claude mcp add figma-polychrom \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact