Colormate is a flexible and powerful color management library designed for JavaScript and TypeScript applications. With separate modules for core color transformations and theme management, Colormate offers developers an optimized, modular way to handle color conversions, validations, adjustments, and theming.
Colormate brings together essential color utilities and a powerful theme management system, catering to modern applications that need precise color manipulation. It’s built with modularity in mind, making it easy to use and extend only what you need, whether that’s color transformations, validations, or responsive theming.
The core
package provides a set of robust utilities for handling color transformations, validations, and adjustments, including:
- Conversions between HEX, RGB, HSL, and CMYK formats.
- Validation utilities for multiple color formats.
- Brightness adjustment functions.
- Complementary color generation.
- Optimized performance with built-in caching and memoization.
For detailed usage instructions, see the @colormate/core documentation.
The theming
package extends the core capabilities of Colormate, offering developers a comprehensive toolkit to manage color themes with ease. Key features include:
- Dark and Light Mode Support: Seamlessly switch between dark and light themes.
- Tailwind and Bootstrap Color Compatibility: Apply color classes like
text-white
,bg-dark
, etc., in a way that integrates smoothly with existing frameworks. - Theme Provider and Context: Easily manage and apply theme colors across your application using React and Next.js.
- Color Class Utilities: Dynamically assign color classes like
bg-light
ortext-dark
based on current theme settings.
Stay tuned for the full release of @colormate/theming
!
Install each package independently based on your requirements.
For core utilities:
npm install @colormate/core
For theme management (coming soon):
npm install @colormate/theming
With Colormate, you can import only the functionality you need from each package.
Convert between color formats, adjust brightness, or validate color input with @colormate/core
.
import { HexToRgb, RgbToHex, ColorValidator } from "@colormate/core";
// Convert HEX to RGB
const rgbColor = HexToRgb.convertHexToRgb("#FF5733");
// Validate RGB color
const isValidRgb = ColorValidator.isValidRgb({ r: 255, g: 87, b: 51 });
We welcome contributions to Colormate! Please feel free to open issues, suggest features, or create pull requests. Follow these steps to contribute:
- Fork the repository.
- Create a new branch with your feature or fix.
- Submit a pull request with a detailed description of your changes.
For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License. See the LICENSE file for more details.