{"_id":"@averagejoeslab/colors","name":"@averagejoeslab/colors","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@averagejoeslab/colors","version":"1.0.0","description":"Color palette library for terminal applications","main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"build":"tsup src/index.ts --format cjs,esm --dts","test":"vitest run","test:watch":"vitest","prepublishOnly":"npm run build"},"keywords":["colors","palette","terminal","cli","ansi","theme"],"author":{"name":"Average Joe's Lab"},"license":"MIT","devDependencies":{"@types/node":"^20.10.0","tsup":"^8.0.1","typescript":"^5.3.0","vitest":"^1.0.0"},"repository":{"type":"git","url":"git+https://github.com/averagejoeslab/colors.git"},"engines":{"node":">=18"},"_id":"@averagejoeslab/colors@1.0.0","gitHead":"3c2935289bc80ad19a77755d4e4090c2b3c170d3","bugs":{"url":"https://github.com/averagejoeslab/colors/issues"},"homepage":"https://github.com/averagejoeslab/colors#readme","_nodeVersion":"22.16.0","_npmVersion":"11.5.2","dist":{"integrity":"sha512-GNj6zr9GyRy18Q0vqTdXUHfGNczS6FZxTX9try0mFZuHzOPx88Hk0PuN09eoSDAD4MgMqcuMXL+qTOFR3ZQtXQ==","shasum":"2c1f223cc3bb1815d34fb44c1bc2ca6b23320c2e","tarball":"https://registry.npmjs.org/@averagejoeslab/colors/-/colors-1.0.0.tgz","fileCount":7,"unpackedSize":62525,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIC+tXwEwPxF5Ocsu3+keaU8fleNLYOCJ9hjIp1DcRZuTAiEAjskJSVywdYWJkpvT4+ZK1Vmlzfz6WrIZLA5quJgfsbo="}]},"_npmUser":{"name":"chasedovey","email":"chase@odovey.com"},"directories":{},"maintainers":[{"name":"chasedovey","email":"chase@odovey.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/colors_1.0.0_1770014877150_0.08185938938403292"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-02T06:47:57.039Z","1.0.0":"2026-02-02T06:47:57.312Z","modified":"2026-02-02T06:47:57.562Z"},"maintainers":[{"name":"chasedovey","email":"chase@odovey.com"}],"description":"Color palette library for terminal applications","homepage":"https://github.com/averagejoeslab/colors#readme","keywords":["colors","palette","terminal","cli","ansi","theme"],"repository":{"type":"git","url":"git+https://github.com/averagejoeslab/colors.git"},"author":{"name":"Average Joe's Lab"},"bugs":{"url":"https://github.com/averagejoeslab/colors/issues"},"license":"MIT","readme":"# @puppuccino/colors\n\nColor types, palettes, and theming for terminal applications.\n\n## Installation\n\n```bash\nnpm install @puppuccino/colors\n```\n\nOr install from GitHub:\n\n```bash\nnpm install github:averagejoeslab/colors\n```\n\n## Features\n\n- **Color Types** - ANSI, 256-color, and RGB color representations\n- **Color Conversion** - Convert between color formats\n- **Palettes** - Pre-built color palettes for consistent styling\n- **Themes** - Light and dark theme definitions\n- **Color Utilities** - Lighten, darken, blend colors\n\n## Usage\n\n### Color Types\n\n```typescript\nimport {\n  AnsiColor,\n  Color256,\n  RGBColor,\n  createColor\n} from '@puppuccino/colors';\n\n// ANSI 16 colors\nconst red = AnsiColor.Red;\nconst brightBlue = AnsiColor.BrightBlue;\n\n// 256-color palette\nconst color = Color256.from(196);  // Bright red\n\n// RGB colors\nconst orange = RGBColor.from(255, 165, 0);\nconst hex = RGBColor.fromHex('#FF5500');\n\n// Create color from various inputs\nconst c1 = createColor('red');           // ANSI red\nconst c2 = createColor(196);             // 256-color\nconst c3 = createColor('#FF5500');       // RGB from hex\nconst c4 = createColor([255, 85, 0]);    // RGB from array\n```\n\n### Color Conversion\n\n```typescript\nimport { toAnsi, to256, toRGB, toHex } from '@puppuccino/colors';\n\nconst rgb = RGBColor.from(255, 100, 50);\n\n// Convert to different formats\nconst ansi = toAnsi(rgb);      // Nearest ANSI color\nconst c256 = to256(rgb);       // Nearest 256-color\nconst hex = toHex(rgb);        // '#FF6432'\n\n// Convert 256 to RGB\nconst fromPalette = toRGB(Color256.from(196));\n```\n\n### Palettes\n\n```typescript\nimport { Palette, createPalette } from '@puppuccino/colors';\n\n// Use built-in palette\nconsole.log(Palette.primary);    // Primary color\nconsole.log(Palette.secondary);  // Secondary color\nconsole.log(Palette.success);    // Green\nconsole.log(Palette.warning);    // Yellow\nconsole.log(Palette.error);      // Red\nconsole.log(Palette.info);       // Blue\n\n// Create custom palette\nconst myPalette = createPalette({\n  brand: '#FF5500',\n  accent: '#00AAFF',\n  muted: [128, 128, 128],\n});\n```\n\n### Themes\n\n```typescript\nimport {\n  Theme,\n  DarkTheme,\n  LightTheme,\n  createTheme\n} from '@puppuccino/colors';\n\n// Use built-in themes\nconst dark = DarkTheme;\nconsole.log(dark.foreground);    // Text color\nconsole.log(dark.background);    // Background color\nconsole.log(dark.accent);        // Accent color\nconsole.log(dark.muted);         // Muted/dimmed color\n\n// Create custom theme\nconst myTheme = createTheme({\n  foreground: '#FFFFFF',\n  background: '#1A1A2E',\n  accent: '#E94560',\n  muted: '#666666',\n\n  // Semantic colors\n  success: '#4CAF50',\n  warning: '#FFC107',\n  error: '#F44336',\n  info: '#2196F3',\n});\n```\n\n### Color Utilities\n\n```typescript\nimport {\n  lighten,\n  darken,\n  blend,\n  contrast,\n  isLight,\n  isDark\n} from '@puppuccino/colors';\n\nconst color = RGBColor.from(100, 150, 200);\n\n// Adjust brightness\nconst lighter = lighten(color, 0.2);   // 20% lighter\nconst darker = darken(color, 0.3);     // 30% darker\n\n// Blend two colors\nconst blended = blend(color1, color2, 0.5);  // 50/50 mix\n\n// Check contrast ratio (for accessibility)\nconst ratio = contrast(foreground, background);\nconsole.log(`Contrast ratio: ${ratio}:1`);\n\n// Check if color is light or dark\nif (isLight(background)) {\n  // Use dark text\n} else {\n  // Use light text\n}\n```\n\n### Adaptive Colors\n\n```typescript\nimport { adaptive, getSystemTheme } from '@puppuccino/colors';\n\n// Get system preference\nconst systemTheme = getSystemTheme();  // 'light' | 'dark'\n\n// Create color that adapts to theme\nconst text = adaptive({\n  light: '#333333',\n  dark: '#EEEEEE',\n});\n\n// Use current theme\nconsole.log(text.current);  // Returns appropriate color\n```\n\n## API Reference\n\n### Color Types\n\n- `AnsiColor` - 16 ANSI color constants\n- `Color256` - 256-color palette wrapper\n- `RGBColor` - RGB color with utilities\n- `createColor()` - Create color from various inputs\n\n### Conversion Functions\n\n- `toAnsi(color)` - Convert to nearest ANSI color\n- `to256(color)` - Convert to nearest 256-color\n- `toRGB(color)` - Convert to RGB\n- `toHex(color)` - Convert to hex string\n\n### Palette & Theme\n\n- `Palette` - Default color palette\n- `createPalette()` - Create custom palette\n- `DarkTheme` / `LightTheme` - Built-in themes\n- `createTheme()` - Create custom theme\n\n### Utilities\n\n- `lighten(color, amount)` - Make color lighter\n- `darken(color, amount)` - Make color darker\n- `blend(c1, c2, ratio)` - Blend two colors\n- `contrast(fg, bg)` - Calculate contrast ratio\n- `isLight(color)` - Check if color is light\n- `isDark(color)` - Check if color is dark\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-e471da7d40f2053b88ddf2bb6007a8ad"}