@gtalumni-la/tokens
Version:
Tokens - Georgia Tech Alumni Association design tokens generated with Style Dictionary
227 lines (170 loc) ⢠6.51 kB
Markdown
# @gtalumni-la/tokens
[](https://badge.fury.io/js/%40gtalumni-la%2Ftokens)
[](https://github.com/gtalumni-la/gt-design-system/actions/workflows/ci.yml)
[](https://codecov.io/gh/gtalumni-la/gt-design-system)
[](https://opensource.org/licenses/MIT)
[](http://www.typescriptlang.org/)
[](https://bundlephobia.com/package/@gtalumni-la/tokens)
[](https://npmjs.com/package/@gtalumni-la/tokens)
Georgia Tech Alumni Association design tokens generated with Style Dictionary. This package provides a centralized collection of design tokens including colors, typography, spacing, and other design decisions that ensure consistency across all GT Alumni applications.
## š¦ Installation
```bash
npm install @gtalumni-la/tokens
# or
yarn add @gtalumni-la/tokens
# or
pnpm add @gtalumni-la/tokens
```
## š Usage
### JavaScript/TypeScript
```typescript
import {
GtColorPrimaryGold,
GtColorPrimaryNavy,
GtColorNeutralWhite,
GtSpacing2,
GtSpacing4,
GtFontSizeBase,
GtFontSizeLg,
} from '@gtalumni-la/tokens';
// Use in your components
const styles = {
backgroundColor: GtColorPrimaryGold,
color: GtColorNeutralWhite,
padding: GtSpacing4,
fontSize: GtFontSizeBase,
};
```
### CSS Variables
```css
@import '@gtalumni-la/tokens/css';
.my-component {
background-color: var(--gt-color-primary-gold);
color: var(--gt-color-neutral-white);
padding: var(--gt-spacing-4);
font-size: var(--gt-font-size-base);
}
```
### SCSS Variables
```scss
@import '@gtalumni-la/tokens/scss';
.my-component {
background-color: $gt-color-primary-gold;
color: $gt-color-neutral-white;
padding: $gt-spacing-4;
font-size: $gt-font-size-base;
}
```
### JSON Format
```javascript
import tokens from '@gtalumni-la/tokens/json';
// Access token values
const primaryGold = tokens.color.primary.gold.value;
const baseSpacing = tokens.spacing.base.value;
```
## š Available Formats
This package provides design tokens in multiple formats to support different development workflows:
| Format | Import Path | Use Case |
| ------------------------- | -------------------------- | --------------------------------- |
| **TypeScript/JavaScript** | `@gtalumni-la/tokens` | React components, JS applications |
| **CSS Variables** | `@gtalumni-la/tokens/css` | Standard CSS, any framework |
| **SCSS Variables** | `@gtalumni-la/tokens/scss` | Sass/SCSS projects |
| **JSON** | `@gtalumni-la/tokens/json` | Configuration, tooling |
| **Raw JavaScript** | `@gtalumni-la/tokens/js` | Build tools, scripts |
## šØ Design Token Categories
### Colors
Georgia Tech's official brand colors and their variations:
- **Primary Colors**: GT Gold, Navy Blue
- **Neutral Colors**: White, Grays, Black
- **Semantic Colors**: Success, Warning, Error, Info
```typescript
import {
GtColorPrimaryGold, // #b3a369
GtColorPrimaryNavy, // #003057
GtColorNeutralWhite, // #ffffff
GtColorNeutralGray50, // #f9fafb
GtColorNeutralGray900, // #111827
} from '@gtalumni-la/tokens';
```
### Typography
Font sizes, weights, and line heights following GT brand guidelines:
```typescript
import {
GtFontSizeXs, // 0.75rem (12px)
GtFontSizeSm, // 0.875rem (14px)
GtFontSizeBase, // 1rem (16px)
GtFontSizeLg, // 1.125rem (18px)
GtFontSizeXl, // 1.25rem (20px)
GtFontSize2xl, // 1.5rem (24px)
GtFontSize3xl, // 1.875rem (30px)
} from '@gtalumni-la/tokens';
```
### Spacing
Consistent spacing scale for margins, padding, and layout:
```typescript
import {
GtSpacing1, // 0.25rem (4px)
GtSpacing2, // 0.5rem (8px)
GtSpacing3, // 0.75rem (12px)
GtSpacing4, // 1rem (16px)
GtSpacing6, // 1.5rem (24px)
GtSpacing8, // 2rem (32px)
GtSpacing12, // 3rem (48px)
} from '@gtalumni-la/tokens';
```
## š§ Development
### Building Tokens
```bash
# Build all token formats
pnpm build
# Watch for changes during development
pnpm dev
# Type check
pnpm type-check
```
### Project Structure
```text
src/
āāā index.ts # Main export file
āāā tokens.ts # Generated token values
āāā types.ts # TypeScript type definitions
āāā utils.ts # Utility functions
tokens/
āāā colors.json # Color token definitions
āāā spacing.json # Spacing token definitions
āāā typography.json # Typography token definitions
dist/
āāā css/ # CSS custom properties
āāā scss/ # Sass variables
āāā js/ # JavaScript exports
āāā ts/ # TypeScript exports
āāā json/ # Raw JSON tokens
```
## šÆ Design Principles
These tokens follow Georgia Tech's brand guidelines and design principles:
1. **Consistency**: Unified visual language across all applications
2. **Accessibility**: WCAG compliant color contrasts and readable typography
3. **Scalability**: Systematic approach that grows with the design system
4. **Brand Alignment**: Faithful to GT's visual identity and Yellow Jacket spirit
## š¤ Contributing
See the main [CONTRIBUTING.md](../../CONTRIBUTING.md) for development guidelines.
### Token Naming Convention
Tokens follow this naming pattern:
```typescript
Gt[Category][Variant][Scale];
```
Examples:
- `GtColorPrimaryGold` - Primary brand color
- `GtSpacing4` - 4th step in spacing scale
- `GtFontSizeBase` - Base font size
### Adding New Tokens
1. Edit the appropriate JSON file in `tokens/`
2. Run `pnpm build` to generate new formats
3. Update TypeScript types if needed
4. Add usage examples to this README
## š License
MIT Ā© Georgia Tech Alumni Association
## š Related Packages
- [@gtalumni-la/react](../react) - React components using these tokens
- [@gtalumni-la/typescript](../typescript) - Shared TypeScript configuration
- [@gtalumni-la/eslint](../eslint) - Shared ESLint configuration