@konce-pt/tokens
v0.22.0
Published
Design tokens for Koncept UI - OKLCH palette, light/dark theme, built with Style Dictionary (CSS vars, SCSS, TS).
Maintainers
Readme
Koncept UI - Design Tokens
Design tokens for Koncept UI - OKLCH palette, light/dark theme, built with Style Dictionary.
The framework-agnostic foundation of Koncept UI. A three-tier token system (primitives -> semantic -> component) exported as CSS custom properties, SCSS and TypeScript. Neutral OKLCH palette with light and dark themes.
Installation
npm i @konce-pt/tokensUsage
Angular CLI - add the CSS to angular.json -> styles[]:
"styles": [
"node_modules/@konce-pt/tokens/dist/css/tokens.css",
"node_modules/@konce-pt/tokens/dist/css/tokens.dark.css",
"src/styles.scss"
]Vite / webpack - import the CSS directly:
import '@konce-pt/tokens/css';
import '@konce-pt/tokens/css/dark';SCSS - the ./scss entry gives both compile-time $ values and mixins that emit the runtime custom properties:
@use 'pkg:@konce-pt/tokens/scss' as t;
@include t.kpt-root-tokens; // :root { --kpt-* } (primitives + light semantic + component tokens)
@include t.kpt-dark-tokens; // [data-theme="dark"] { ... } (dark overrides)
.brand { color: t.$kpt-color-primary; } // compile-time valueThe pkg: prefix is how Sass resolves a package exports entry; the Angular CLI and Vite understand
it out of the box, and the Sass CLI needs --pkg-importer=node.
TypeScript constants:
import { KPT_COLOR_PRIMARY, KPT_SPACE_4 } from '@konce-pt/tokens';Compile-time $ values and TypeScript constants hold the light theme; the dark theme exists only
as custom properties.
Every token is a --kpt-* custom property, e.g. var(--kpt-color-primary), var(--kpt-space-4), var(--kpt-radius-md). Dark theme activates under [data-theme="dark"] on the root element; the library does not read prefers-color-scheme itself, so wire that up in the application if you want it to follow the OS.
Breakpoints
Responsive breakpoints are primitives, so the whole library shares one contract:
| Token | Value |
| --- | --- |
| --kpt-breakpoint-sm | 640px |
| --kpt-breakpoint-md | 768px |
| --kpt-breakpoint-lg | 1024px |
| --kpt-breakpoint-xl | 1280px |
| --kpt-breakpoint-2xl | 1536px |
@media cannot read var(), so use the SCSS variant in queries and keep the custom
properties for documentation and reads from JavaScript:
@use 'pkg:@konce-pt/tokens/scss' as t;
@media (min-width: t.$kpt-breakpoint-md) { /* ... */ }@konce-pt/grid builds its whole layout
system on these tokens.
Semantic layer & block allowlist
The semantic tier covers surfaces (surface, -raised|-sunken|-hover|-selected|-variant), muted
fills (muted, muted-hover, on-muted), text (on-surface, -muted; aliases text, text-muted,
text-subtle, text-inverse), borders (border, border-strong), focus-ring, overlays
(overlay, overlay-scrim) and every accent role in full - primary/danger/success/warning/info
each with -hover/-contrast/-subtle/-border (primary also has -active; on-primary and
on-danger for text on the fill) - plus shadows --kpt-elevation-1..4 (aliases --kpt-shadow-{sm,md,lg}).
The build also emits dist/registry/tokens.json, available as @konce-pt/tokens/registry - an
allowlist (name, value: { light, dark }, layer, group, control, editable, themed,
blockUsable, optional refs and description/descriptionEn) that powers token validation for
Koncept UI blocks.
Full reference for LLMs: llms.txt (EN)
and llms-pl.txt (PL).
License
MIT © konce.pt
Wersja polska
Framework-agnostyczny fundament Koncept UI: trójpoziomowy system tokenów (prymitywy -> semantyczne -> komponentowe) eksportowany do CSS custom properties, SCSS i TypeScript. Neutralna paleta OKLCH, motyw jasny i ciemny.
Angular CLI - CSS w angular.json -> styles[]:
"styles": [
"node_modules/@konce-pt/tokens/dist/css/tokens.css",
"node_modules/@konce-pt/tokens/dist/css/tokens.dark.css",
"src/styles.scss"
]Vite/webpack - import '@konce-pt/tokens/css'; import '@konce-pt/tokens/css/dark';
SCSS - wejście ./scss daje zmienne $ (compile-time) oraz mixiny emitujące custom properties w runtime:
@use 'pkg:@konce-pt/tokens/scss' as t;
@include t.kpt-root-tokens; // :root { --kpt-* }
@include t.kpt-dark-tokens; // [data-theme="dark"] { ... }Zmienne $ i stałe TypeScript to wartości motywu jasnego; ciemny istnieje tylko jako custom
properties. Prefiks pkg: pozwala Sassowi czytać exports paczki; Angular CLI i Vite rozumieją
go od razu, a Sass CLI potrzebuje --pkg-importer=node.
Allowlista dla bloków - @konce-pt/tokens/registry (dist/registry/tokens.json): każdy token
z wartością jasną i ciemną, warstwą i polem blockUsable; na niej stoi walidacja
bloków Koncept UI.
Breakpointy - prymitywy wspólne dla całej biblioteki: sm 640px, md 768px, lg 1024px,
xl 1280px, 2xl 1536px. W @media używaj wariantu SCSS (t.$kpt-breakpoint-md), bo @media
nie potrafi czytać var(); custom properties --kpt-breakpoint-* służą dokumentacji i odczytowi
z JavaScriptu. Na tych tokenach stoi cały @konce-pt/grid.
Każdy token to własność --kpt-*, np. var(--kpt-color-primary). Motyw ciemny pod [data-theme="dark"].
Pełny opis: llms.txt (EN)
i llms-pl.txt (PL).
Licencja: MIT © konce.pt
