colorupjs
Version:
A modern, lightweight, and comprehensive color utility library for JavaScript/TypeScript with advanced palette generation and WCAG accessibility tools.
120 lines (108 loc) ⢠4.83 kB
Plain Text
# ColorX - Professional Color Utility Library
## š Folder Structure
```
colorx/
āāā src/
ā āāā core/
ā ā āāā types.ts # Core type definitions
ā ā āāā constants.ts # Color constants & mappings
ā ā āāā validators.ts # Input validation utilities
ā āāā converters/
ā ā āāā index.ts # Export all converters
ā ā āāā hex.ts # Hex conversion utilities
ā ā āāā rgb.ts # RGB conversion utilities
ā ā āāā hsl.ts # HSL conversion utilities
ā ā āāā named.ts # Named color utilities
ā āāā analyzers/
ā ā āāā index.ts # Export all analyzers
ā ā āāā brightness.ts # Brightness detection
ā ā āāā contrast.ts # Contrast ratio calculations
ā ā āāā accessibility.ts # WCAG compliance tools
ā āāā generators/
ā ā āāā index.ts # Export all generators
ā ā āāā harmony.ts # Color harmony generators
ā ā āāā palette.ts # Palette generation
ā ā āāā gradient.ts # Gradient utilities
ā ā āāā variations.ts # Tints, shades, tones
ā āāā modifiers/
ā ā āāā index.ts # Export all modifiers
ā ā āāā blend.ts # Color blending
ā ā āāā adjust.ts # Brightness/saturation adjustments
ā ā āāā transform.ts # Color transformations
ā āāā exporters/
ā ā āāā index.ts # Export all exporters
ā ā āāā css.ts # CSS variable generation
ā ā āāā tokens.ts # Design tokens
ā ā āāā formats.ts # Multiple format exports
ā āāā utils/
ā ā āāā index.ts # Export all utilities
ā ā āāā math.ts # Mathematical utilities
ā ā āāā normalize.ts # Color normalization
ā ā āāā helpers.ts # Helper functions
ā āāā index.ts # Main entry point
āāā tests/
ā āāā __mocks__/ # Test mocks
ā āāā converters/ # Converter tests
ā āāā analyzers/ # Analyzer tests
ā āāā generators/ # Generator tests
ā āāā modifiers/ # Modifier tests
ā āāā exporters/ # Exporter tests
ā āāā utils/ # Utility tests
ā āāā integration/ # Integration tests
āāā docs/ # Documentation
āāā examples/ # Usage examples
āāā scripts/ # Build & utility scripts
āāā .github/ # GitHub workflows
āāā dist/ # Build output (auto-generated)
āāā coverage/ # Test coverage (auto-generated)
āāā node_modules/ # Dependencies (auto-generated)
āāā package.json
āāā tsconfig.json
āāā rollup.config.js
āāā jest.config.js
āāā .eslintrc.js
āāā .prettierrc
āāā .gitignore
āāā LICENSE
āāā README.md
```
## š Quick Setup
1. **Initialize Project:**
```bash
mkdir colorx && cd colorx
npm init -y
```
2. **Install Dependencies:**
```bash
# Copy the package.json content above, then:
npm install
```
3. **Create Folder Structure:**
```bash
mkdir -p src/{core,converters,analyzers,generators,modifiers,exporters,utils}
mkdir -p tests/{__mocks__,converters,analyzers,generators,modifiers,exporters,utils,integration}
mkdir -p {docs,examples,scripts,.github/workflows}
```
4. **Development Workflow:**
```bash
npm run dev # Start development build
npm run test:watch # Run tests in watch mode
npm run lint:fix # Fix linting issues
npm run validate # Run full validation
```
5. **Publishing:**
```bash
npm run build # Build for production
npm run prepublishOnly # Full validation + build
npm publish # Publish to NPM
```
## šļø Architecture Principles
- **Modular Design:** Each feature is isolated and composable
- **Type Safety:** Full TypeScript support with strict types
- **Tree Shaking:** Optimized for modern bundlers
- **Performance:** Efficient algorithms with minimal overhead
- **Extensibility:** Plugin-ready architecture
- **Standards Compliance:** WCAG 2.1 AA/AAA support
- **Cross-Platform:** Works in browsers and Node.js
## š Next Steps
I'll now create the core implementation files starting with types, constants, and the main conversion utilities.